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
aptto install and update packages (applications). Apt is a packaging manager used by Unbuntu.
Enter these commands one at a time into the terminal window.
Tells the OS to check for any updates.
apt -y upgrade
Installs any application updates that resulted from
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,
aptcan remove them.
aptto 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
A note about
sudo. Some commands require an elevated prompt, or root.
Many default VPSs come configured with the
rootuser 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 using
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.
-rflag 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
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.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30
root@vps298933:~# apt upgrade Reading package lists... Done Building dependency tree Reading state information... Done Calculating upgrade... Done The following packages will be upgraded: apport certbot libnss-systemd libpam-systemd libseccomp2 libsystemd0 libudev1 libxcb1 python-certbot-nginx python3-acme python3-apport python3-certbot python3-certbot-nginx python3-problem-report snapd systemd systemd-sysv udev 18 upgraded, 0 newly installed, 0 to remove and 0 not upgraded. Need to get 19.8 MB of archives. After this operation, 75.8 kB of additional disk space will be used. Do you want to continue? [Y/n] y . . . Processing triggers for initramfs-tools (0.130ubuntu3.7) ... update-initramfs: Generating /boot/initrd.img-4.15.0-46-generic Processing triggers for libc-bin (2.27-3ubuntu1) ... root@vps298933:~# root@vps298933:~# shutdown -r now ---------------------------------------------------------------------------------------------- Session stopped - Press <return> to exit tab - Press R to restart session - Press S to save terminal output to file Server unexpectedly closed network connection