Installing security updates

Installing security updates regularly is very important to keep your server secure. Follow these steps in order.

  1. Connect to your node and run the following command to update your system:
    sudo apt -y update && sudo apt -y upgrade
  2. If you don't get any errors, the updates were installed successfully.

    If you see the message "The following packages have been kept back", some packages weren't updated because they need additional packages to be installed (new dependencies were introduced).

    Terminal output listing packages that have been kept back

    You can install those updates with the command below, followed by the names of the packages:

    sudo apt -y install --only-upgrade

    Example

    sudo apt -y install --only-upgrade libnss-systemd libpam-systemd libsystemd0 libudev1 systemd systemd-sysv systemd-timesyncd udev
  3. Some updates require a server reboot. To check whether one is required, run:
    sudo cat /var/run/reboot-required

    You can activate the Ubuntu Pro Livepatch service to avoid rebooting your server after a kernel update. This is described in this article.

  4. If it shows "No such file or directory", no reboot is required and you're done. You can stop here.

    If the output shows "system restart required", you need to reboot your server to activate the updates. Continue with the next steps. To reboot your server, run:

    sudo reboot
  5. While your server reboots, your SSH client will show a connection error. This is normal: a reboot turns your server off and on again, so every connected client loses its connection. Reconnect to your server and check that everything is OK.
Knowledge Base Next: Monitoring your node