Development

Create automatic updates for Ubuntu

Here is a method to set up automatic updates on your Ubuntu server, avoiding the need to manually check and apply important security updates and patches.

Start by updating your package information:

sudo apt update

Next install unattended-upgrades

sudo apt install unattended-upgrades apt-listchanges bsd-mailx

Enable the unattended security updates with:

sudo dpkg-reconfigure -plow unattended-upgrades

Now to configure some settings for the automatic updates

sudo nano /etc/apt/apt.conf.d/50unattended-upgrades

Ensure the following is set/edited:

Unattended-Upgrade::Mail "YOUREMAIL@email.com";
Unattended-Upgrade::Automatic-Reboot "true";

This ensures the email logs will be sent to and allow for automatic reboots.

Save and exit the file.

Next go to:

sudo nano /etc/apt/listchanges.conf

and set your email again like so:

email_address=YOUREMAIL@email.com

Save and exit the file.

You can verify that the automatic updates is working by running:

sudo unattended-upgrades --dry-run

Whenever new updates are downloaded and installed you will be emailed a log with details. Alternatively you can use

sudo tail -f /var/log/unattended-upgrades/unattended-upgrades.log

To check the logs.

Share

Recent Posts

Kennington reservoir drained drone images

A drained and empty Kennington reservoir images from a drone in early July 2024. The…

1 year ago

Merrimu Reservoir drone images

Merrimu Reservoir from drone. Click images to view larger.

1 year ago

FTP getting array of file details such as size using PHP

Using FTP and PHP to get an array of file details such as size and…

2 years ago

Creating Laravel form requests

Creating and using Laravel form requests to create cleaner code, separation and reusability for your…

2 years ago

Improving the default Laravel login and register views

Improving the default Laravel login and register views in such a simple manner but making…

2 years ago

Laravel validation for checking if value exists in the database

Laravel validation for checking if a field value exists in the database. The validation rule…

2 years ago