totn Linux

Linux: How to Update Ubuntu Linux Server 16.04 LTS

In this Linux system administration tutorial you will learn how to update an Ubuntu Linux Server 16.04 LTS (Xenial Xerus) system with screenshots and instructions.

Prerequisites

To complete this tutorial you will require a running Ubuntu Linux Server 16.04 LTS system and an account with sudo administrative privileges. The system must have network connectivity and access to an Ubuntu update server.

Updating

The following steps will guide you through updating an Ubuntu Linux Server 16.04 LTS system. The update process can take some time to complete and some steps may take longer than others.

  1. To begin updating your Ubuntu Linux System, you will need to be logged in using a valid user account for your system. If you are unsure of how to do this, read our tutorial on Logging into Ubuntu Linux Server 16.04 LTS.

    In this tutorial, we have logged in as techonthenet on the host called ubuntu.

  2. To update the software on our system we must first ensure the system has the latest package lists installed.

    To do this enter the command sudo apt-get update after the system prompt.

    The following screenshot demonstrates what you will see.

    Update package list

    Here is a break down of this command:

    sudo
    Execute the command that follows using super user permissions. (The user executing the sudo command MUST have privileges to do so.)
    apt-get update
    Execute the apt-get command with the update directive. The update directive tells apt-get to refresh the system package lists.

    When you have entered the command, press the Enter key to execute the command.

  3. The sudo command will now prompt you to enter the password for your user account before attempting to execute apt-get update with super user permissions.

    Enter sudo password

    After you have entered your password, press the Enter key to continue.

  4. If all goes well, you will see apt-get update begin to update the system's package lists. The apt-get update command can output a great deal of information and may take some time to complete.

    The following screenshot shows some of what you might see.

    After package list update

    When apt-get update is complete you will again see the system prompt appear.

  5. Next we will upgrade the software on our system by entering the command sudo apt-get upgrade at the system prompt.

    The following screenshot demonstrates what you will see.

    Update software packages

    Here is a break down of this command:

    sudo
    Execute the command that follows using super user permissions. (The user executing the sudo command MUST have privileges to do so.)
    apt-get upgrade
    Execute the apt-get command with the upgrade directive. The upgrade directive tells apt-get to download and apply package updates that are available for your system. apt-get determines which packages have updates by checking the system package lists against the versions of the software packages that are currently installed on your system. If there are newer versions of software in the system package lists they will be marked for update.

    If more than 15 minutes has passed since you executed the sudo apt-get update command from the previous steps, sudo will re-ask you to enter your account password.

  6. The apt-get upgrade command will now determine which packages require updating. If new packages are available, it will display something like the following screenshot:

    Please note that your package list will likely differ from what is seen here.

    Confirm software updates

    The apt-get upgrade command will prompt you to answer Y to proceed with the upgrade, or N to abort. (Case does not matter)

    You will notice that the Y is in upper case. This means that it will be the default if nothing is entered. We will press the Enter key to accept this default and continue with the upgrade.

  7. The apt-get upgrade command will now begin downloading and updating your software packages.

    This can take some time so please be patient. You will see output from apt-get upgrade similar to the following:

    After software updates

    When apt-get upgrade is complete you will again see the system prompt appear.

    TIP: Some software packages require special attention to update and will not have been updated by the apt-get upgrade command.

    To upgrade those packages, you will have to tell apt-get which packages to upgrade. This is done by adding each package name to the apt-get command separated by spaces. The following is an example of how we could upgrade the linux kernel.

    sudo apt-get upgrade linux-generic linux-headers-generic linux-image-generic
  8. To ensure there are no more packages available for update, we will re-issue the sudo apt-get upgrade command and press the Enter key to continue.

    Re-issue update software packages

  9. The following line in the screenshot below indicates that there are no more packages available to update.

    0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.

    After re-issue update software packages

  10. In some instances, such as when an update to the Linux kernel is done, you will need to reboot your system to ensure you are using the latest version of your software.

    To reboot your system, enter sudo reboot at the system prompt and press the Enter key to execute the command.

    IMPORTANT: Please be sure that it is appropriate to reboot your system before executing the sudo reboot command! There may be active users or services running on the system that should not be interrupted.

    sudo reboot

    Congratulations, you have successfully updated your Ubuntu Linux Server 16.04 LTS system!