Oct 7, 2018

How to update Ubuntu automatically

Methods to automatically update Ubuntu

cron-apt method

The package cron-apt is designed to automatically update the package list and download upgraded packages. Therefore it basically calls the command
apt-get update

Installing Cron-apt

You can get cron-apt from the command line:
sudo apt install cron-apt -y
By default, cron-apt will execute automatically at 4am.

If your system is normally turned off at 4am, you can either edit /etc/cron.d/cron-apt and change the schedule to a time when your PC is likely to be switched on, or you can use Anacron to make it run when your PC is next turned on.

To make cron-apt be executed by Anacron, create a link in /etc/cron.daily or /etc/cron.weekly. For example:
sudo ln -s /usr/sbin/cron-apt /etc/cron.weekly/