Categories: 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…

2 years ago

Merrimu Reservoir drone images

Merrimu Reservoir from drone. Click images to view larger.

2 years ago

Early September spring shots

Some early September spring shots from a bushwalk, It is still too early for wildflowers.

3 years ago

Cloning an NVMe to SK Hynix Platinum P41 NVMe

I recently needed to clone over a smaller NVMe to a 2TB SK Hynix Platinum…

3 years ago

Using Laravel’s deleteDirectory to delete folders and their contents

If you ever needed a simple solution in Laravel to delete an entire directory and…

3 years ago

How to allow only 1 user to register in a Laravel application

How to enforce only one user to register or be registered in a Laravel web…

3 years ago