Ubuntu 20.04 includes a built-in tool called “unattended-upgrades” that allows you to set up automatic updates. Here’s how you can set it up:
- First, install the package by running the command “sudo apt install unattended-upgrades”
- Next, configure the package by editing the “/etc/apt/apt.conf.d/50unattended-upgrades” file. In this file, you can set the parameters for the automatic updates such as which packages to update, when to update, and how to notify of updates.
- You can also configure which updates to install by editing the file “/etc/apt/apt.conf.d/20auto-upgrades” and uncommenting the line “Unattended-Upgrade::Allowed-Origins {“;
- You can configure the frequency of the updates by editing the file “/etc/apt/apt.conf.d/10periodic” and uncommenting the line “APT::Periodic::Unattended-Upgrade “1”;”
- Once you’ve finished configuring the package, you can start it by running the command “sudo systemctl start unattended-upgrades”
- To check the status of the package, you can run the command “sudo systemctl status unattended-upgrades”
- To make sure the package starts automatically after a reboot, you can run the command “sudo systemctl enable unattended-upgrades”
Please note that the package “unattended-upgrades” only updates packages that are considered security or important updates, not all updates.
You can also use other tools like “apticron” and “apt-listchanges” to configure automatic updates and to notify of updates via email. It’s also important to check the log files in “/var/log/unattended-upgrades” to confirm that the updates were installed successfully and to troubleshoot any issues.
Please be aware that automatic updates can cause unexpected issues and it’s recommended to test updates in a staging environment before applying them to production systems.