Automatically installing security updates in Ubuntu has its benefits and risks. There’s always a risk updating or installing patches without supervision, however, not installing security patches quickly leaves your systems vulnerable to malicious tools and the bad guys.
This brief tutorial is going to show you how to quickly configure Ubuntu to automatically install security patches immediately when they become available. Remember that this is only going be effective if your system is connected to the Internet. Without Internet connections, it won’t work. If you believe in keeping your system up-to-date, then follow the steps below to enable this feature.
There are many ways to enable this in Ubuntu, but the most effective is using unattended-upgrade scripts which this post will show you below. Besides using the script to install updates, you can also use Software Sources, cron and aptitude and cron-apt.
To get started, press Ctrl – Alt – T on your keyboard to open the terminal. When it opens, copy and paste the commands below and press Enter.
sudo dpkg-reconfigure -plow unattended-upgrades
When prompted with the screen below, select Yes
This will configure Ubuntu to automatically download and install security updates. By default, updates must manually be applied using package management tools. Selecting Yes on this screen allows for automatic download and installation of security patches.
To see the setting in action, open System Settings –> Software Sources –> Update tab, and you’ll see the option for security updates is grey-out.
To revert the changes, run the commands above again and select ‘No’. This will configure Ubuntu back to manual security update.
Enjoy!