One of the biggest steps you can take to ensure your security online is to keep the software on your devices up to date and install any software updates that come out. This advice doesn’t just apply to your computers and phones, but also internet of things devices like a Raspberry Pi or BeagleBone Black. Luckily this is an easy process with the help of one important software package.
In Raspbian and other Debian-based Linux systems, the
unattended-upgrades package automates the process of downloading and installing software updates on your system. You can configure it to either download only security updates or also download general software updates and it will run silently in the background keeping your software up to date. Here’s how to install it on a Raspberry Pi.
We’ll be working from the terminal, so start a shell if you aren’t already working from the command line.
To install unattended-upgrades on your system, all you need to do is install it using apt:
sudo apt-get update
sudo apt-get install unattended-upgrades
These commands will install unattended-upgrades, but it still needs to be tested and enabled before it can be used.
Once you’ve installed unattended-upgrades, it’s a good idea to test that everything is working using a dry run. This will check for software which can be updated but will stop short of actually downloading and installing any updates.
To trigger a dry run, type the following:
sudo unattended-upgrade -d -v --dry-run
In the output, you’ll see your system connect to the package servers, download the latest versions of all your packages, and then if updates are available for your system they’ll be listed here. The most important thing to look for is the absence of any errors. If you’re getting errors now, you’ll need to diagnose what’s preventing this from working before proceeding.
Lastly, to enable unattended-upgrades so it automatically runs on your system, type:
sudo dpkg-reconfigure --priority=low unattended-upgrades
You’ll be presented with a confirmation screen that you want to enable automatic software updates. Select
Yes to proceed.
After that you’re good to go.
From now on your Raspberry Pi will automatically download and install the latest software updates as they become available.