Few weeks ago, we showed you how to configure Ubuntu to automatically download and install security patches. Installing updates and security patches regularly in Ubuntu is a good habit to keep. Here’s that post about configuring Ubuntu to automatically download and apply security updates.
This brief tutorial on the other hand shows you how to not just automatically install security updates in Ubuntu, but all software updates. All Ubuntu software that were installed from its official repository will be updated automatically after setting this up.
We all know that there are some risks in configuring Ubuntu to download and install updates unattended, however, the reward is great if your system is quickly patched to stop bad guys from exploiting a zero-day security vulnerability.
This is not going to happen often, but it’s good the always update your systems, manually or automatically.
To get started, press Ctrl – Alt – T on your keyboard to open the terminal. When it opens, run the commands below to setup the unattended upgrade.
sudo dpkg-reconfigure -plow unattended-upgrades
When ask if you which to enable automatic update, choose Yes
Next, run the commands below to open the unattended-upgrades script in Ubuntu.
sudo gedit /etc/apt/apt.conf.d/50unattended-upgrades
Then edit the file and uncomment the lines as shown below.
To automatically remove unneeded packages, edit the line as the bottom of the file to look like this.
Save the file and you’re done.