How do I configure automatic updates for Ubuntu Linux 18.04 LTS “Bionic Beaver” server?

 

The Linux server security is indeed an essential task for sysadmins. One of the most fundamental ways to keep the server secure is by installing security updates on time to patch vulnerabilities. You need to install the unattended-upgrades package. It will automatically install software updated, including security updates. This page shows how to install security updates automatically when released by the Ubuntu security team.

 

Automatic updates for Ubuntu Linux

  • Update the server, run:
sudo apt update && sudo apt upgrade
  • Install unattended upgrades on Ubuntu. Type the following apt command
sudo apt install unattended-upgrades apt-listchanges bsd-mailx
  • Turn on unattended security updates, run:
sudo dpkg-reconfigure -plow unattended-upgrades

 

Ubunt configure automatic updates
  • Configure automatic updates, enter:
sudo nano /etc/apt/apt.conf.d/50unattended-upgrades

Set up alert email ID:

Unattended-Upgrade::Mail "sysadmin@server1.optusnet.org.uk";

Automatically reboot Ubuntu box WITHOUT CONFIRMATION for kernel updates:

Unattended-Upgrade::Automatic-Reboot "true";

Finally edit the /etc/apt/listchanges.conf and set email ID:

sudo nano /etc/apt/listchanges.conf
email_address=sysadmin@server1.optusnet.org.uk

Save and close the file.

 

  • Verify that it is working by running the following command:
sudo unattended-upgrades --dry-run

See automatic updates logs

Now that you set up automatic updates on Ubuntu Server 18.04 LTS. It is time to see logs. Hence, use the grep command or cat command or more command/egrep command:

sudo cat /var/log/unattended-upgrades/unattended-upgrades.log
sudo tail -f /var/log/unattended-upgrades/unattended-upgrades.log
sudo grep 'linux-image' /var/log/unattended-upgrades/unattended-upgrades.log

And you are done. I hope this helps you to keep the server or virtual machine running in cloud current with the latest security updates automatically.

Pin It on Pinterest

Share This