Ubuntu Server housekeeping
1 min read

Ubuntu Server housekeeping

If You're a self-hosting your website, One particular thing that You'd want to take care of is to keep the system up-to-date. The process requires some discipline and planning but most of it can be automated. Ubuntu also offers a package called unattended-upgrades which automatically installs important security updates automatically. There is an additional service offered by Canonical, the company behind ubuntu known as livepatch this can be used to patch the ubuntu kernel automatically and without reboot to increase system uptime. In general, You don't really need livepatch unless you're running a system-critical application on Your server. You can simply SSH into Your server on a lazy Sunday and take out about 15 minutes to get it all updated and good to go. Let's go through the process:

Once You've SSH'd into Your server, You just need to run this set of commands:

sudo apt update
sudo apt upgrade
sudo apt autoclean
sudo apt autoremove

The above commands may ask you to Press Y to perform the installation of updates or removal of obsolete packages. Additionally, whenever there is a major release upgrade to ubuntu, You have to run the following command:

sudo apt dist-upgrade
sudo do-release-upgrade

The above command will ask you for a few permissions and will upgrade to the latest available ubuntu version (current LTS is 18.04 but at the time of writing 20.04 may be announced at any time).

To automate security updates, You can set up unattended-upgrades on ubuntu:

sudo dpkg-reconfigure unattended-upgrades

This will present You with a prompt as such:

Applying updates on a frequent basis is an important part of keeping systems secure. By default, updates need to be applied manually using package management tools. Alternatively, you can choose to have this system automatically download and install important updates.
Automatically download and install stable updates?

You'll have to use the Tab key on your keyboard to select Yes then Press Enter and it'll install Important updates to Your server.

I hope this article was helpful and made you learn something new. If you have any questions or want to discuss tech news, Join our forum discuss.tekduke.com