Step 2: Update and reboot
Table of Contents
Updating Software Packages
Warning
Are you starting with a fresh install using Ubuntu 18.04 Server
?
If not, please log in to your service provider and reinstall your OS to remove old projects, incorrect configuration, or errors that might exist from broken packages.
A VPS with a default install needs updating to install the latest version of the packages.
The first thing we should do update all of the software on the VPS. This process is very easy because Linux uses automated commands.
We will use
apt
to install and update packages (applications). Apt is a packaging manager used by Unbuntu.
Enter these commands one at a time into the terminal window.
apt update
Tells the OS to check for any updates.
apt -y upgrade
Installs any application updates that resulted from
apt update
.apt -y dist-upgrade
Installs any distribution updates, which are major OS updates.
apt -y autoremove
removes any packages that are no longer needed. Instead of leaving unused packages on your system,
apt
can remove them.-y
flagInforms
apt
to perform the action without asking for a user prompt. Otherwise, the system prompts the user to enter y or n to continue.
sudo apt update
sudo apt -y upgrade
sudo apt -y dist-upgrade
sudo apt -y autoremove
Note
A note about sudo
. Some commands require an elevated prompt, or root.
Many default VPSs come configured with the
root
user only. These VPSs do not require an elevated prompt unless you choose to install a standard user.Other VPSs come with a standard user that is part of the super user (sudo) group. For these users, you must prefix each command that requires an elevated prompt with
sudo
. Or, just switch to the root user usingsudo su
.
Rebooting Linux
Linux rarely needs to reboot. However, it is easier to have the OS install system-level packages during the reboot process instead of installing them manually.
Reboot for system updates to take effect. Wait a minute or so to give the system a chance to reboot before trying to log back into the VPS.
-r
flag tells the system to reboot now, and not wait for a set time.
sudo reboot -n
You can use the equivalent shutdown
command to specify a reason.
This is helpful in a multi-user system. Don’t forget the -r
flag
that tells the system to restart after the shutdown.
sudo shutdown -r now 'Kernel upgrade requires reboot'
You can see from this output that apt
is installing a boot loader,
which is system firmware.
1root@vps298933:~# apt upgrade
2Reading package lists... Done
3Building dependency tree
4Reading state information... Done
5Calculating upgrade... Done
6The following packages will be upgraded:
7 apport certbot libnss-systemd libpam-systemd libseccomp2 libsystemd0 libudev1
8 libxcb1 python-certbot-nginx python3-acme python3-apport python3-certbot
9 python3-certbot-nginx python3-problem-report snapd systemd systemd-sysv udev
1018 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
11Need to get 19.8 MB of archives.
12After this operation, 75.8 kB of additional disk space will be used.
13Do you want to continue? [Y/n] y
14
15. . .
16
17Processing triggers for initramfs-tools (0.130ubuntu3.7) ...
18update-initramfs: Generating /boot/initrd.img-4.15.0-46-generic
19Processing triggers for libc-bin (2.27-3ubuntu1) ...
20root@vps298933:~#
21root@vps298933:~# shutdown -r now
22
23----------------------------------------------------------------------------------------------
24
25Session stopped
26 - Press <return> to exit tab
27 - Press R to restart session
28 - Press S to save terminal output to file
29
30Server unexpectedly closed network connection