Upgrade Ubuntu Script

Summary

This video shows how to upgrade Ubuntu 16.04 LTS Server Edition to Ubuntu 18.04 LTS Server Edition.

This video does not have any verbal commentary as the purpose of this video is to show you the screen output that is generated when the upgrade is performed. Therefore if you run into any issues when performing your upgrade, you can use this video to see how far along your upgrade made it through the process.

This video is the full length upgrade from Ubuntu 16.04 LTS to Ubuntu 18.04 LTS. Pauses from prompts have bee nremoved so that you can see the amount of time required to complete the upgrade and what to expect when performing the upgrade on your server or desktop.

The scenes have not been shortened and were recorded in real time.

A separate video tutorial with commentary is available in a separate video.

The Script

Since I stick with the LTS upgrades, I only do the upgrade process once every two years. That means I usually forget what commands to run to do the upgrade. So I created a script I can run to see and install the upgrade when it is available.

I have used the script below for upgrades starting with the Ubuntu 16.04 LTS version and have not had any issues upgrading to future versions of Ubuntu.

#!/bin/bash

################################################################################
# Description: Script to automatically perform
# Author: Kenny Robinson, @almostengr
################################################################################

# MAKE SURE THAT THE ROOT USER IS RUNNING THE SCRIPT.
if [ "$(id -u)" == "0" ]; then
    echo "Cleaning packages"
    /usr/bin/apt-get clean

    echo "Updating repositories"
    /usr/bin/apt-get update

    echo "Installing updates"
    /usr/bin/apt-get upgrade -y

    echo "Running upgrade script"
    /usr/bin/do-release-upgrade

    # IF REBOOT FILE HAS BEEN CREATED, THEN DO REBOOT
    if [ -f /var/run/reboot-required ]; then
        echo "Reboot is required"
    fi
else
    # THROW ERROR IF NOT RUNNING AS ROOT
    /bin/echo "ERROR: Must be root to run script."
fi

Video

If you have comments or questions about the video, please leave them on the video's YouTube page.

Transcript (Unedited)

There's no transcript for this video.

Updated: 2023-02-14 | Posted: 2018-09-22
Author: Kenny Robinson