Configure automatic updates for Ubuntu Server on Azure

Friends who are accustomed to using Windows should be no strangers to automatic updates. Although the 10th generation without QA often explodes, it is still a very convenient function for server management. The Linux world is a bit different. The Ubuntu server on Azure does not enable automatic updates by default. Let's take a look at how to configure and enable automatic updates.

The version I am using is Ubuntu Server 18.10, the following method is also applicable to 18.04

01

Installation package

This package should already come with the system by default, if not, you need to install it manually:

sudoapt install unattended-upgrades

02

Configure automatic updates

Use nano to edit the configuration file:

sudonano /etc/apt/apt.conf.d/50unattended-upgrades

Uncomment the following line (remove the first double slash "//"), and change the corresponding value to true

" {distro_id}:{distro_codename}-updates";

Unattended-Upgrade::Mail"[email protected]";

Unattended-Upgrade::Remove-Unused-Kernel-Packages"true";

Unattended-Upgrade::Remove-Unused-Dependencies"true";

Unattended-Upgrade::Automatic-Reboot"true";

Change the Email address to your own email address so that you will receive email notifications during automatic updates.

03

Enable automatic updates

Use nano to edit files:

sudo nano/etc/apt/apt.conf.d/20auto-upgrades

Write the following file content

APT::Periodic::Update-Package-Lists"1";

APT::Periodic::Download-Upgradeable-Packages"1";

APT::Periodic::AutocleanInterval"7";

APT::Periodic::Unattended-Upgrade"1";

The 1 in Unattended-Upgrade means checking for updates every 1 day, that is, every day. This can be changed according to your needs. AutocleanInterval represents the period of automatic cleaning of useless packets.

04

test

Execute the following command to test whether the configuration is successful:

sudounattended-upgrades --dry-run --debug

05

Update log

Run the following command to view the automatic update log:

cat/var/log/unattended-upgrades/unattended-upgrades.log

// Linux is really fragrant (this line is commented, you are programmers should not see it)

Recommended Posts

Configure automatic updates for Ubuntu Server on Azure
Configure tomcat on ubuntu server
Configure Nginx Git server on Ubuntu system
Configure Wolfram Engine on Tencent Cloud ubuntu server
Install and configure Mono production environment on Ubuntu Server
Install OpenSSL 1.0.2 on Ubuntu Server 14.04
Upgrade Ubuntu 18.04 on Azure to 18.10
Build Nginx-RTMP live server on ubuntu
Install Chef server workstation on Ubuntu 18.04
Build a file server on ubuntu
Configure ring after installation on Ubuntu 16.04
Use Ubuntu 16.04 for initial server setup
Install Oracle 11gR2 on Ubuntu Server 12.4.0
Install Gnome and VNC on Ubuntu Server
Detailed tutorial on installing python3.7 for ubuntu18
How to install Bacula Server on Ubuntu 14.04
How to use Samba server on Ubuntu 16.04
How to configure Redis cluster on Ubuntu 14.04
Detailed tutorial for installing phpMyAdmin on Ubuntu 18.04
How to configure Redis replication on Ubuntu 16.04
How to install Zabbix on Ubuntu 16.04 Server
How to install and configure NATS on Ubuntu 16.04
How to set static IP on Ubuntu 18.04 Server
Install JDK and configure environment variables on Ubuntu 16.04
How to set static IP on Ubuntu 18.04 Server
How to install and configure ownCloud on Ubuntu 16.04
How to install and configure ownCloud on Ubuntu 16.04
How to install and configure GitLab on Ubuntu 18.04
How to install and configure Ansible on Ubuntu 18.04
How to quickly deploy docker on ubuntu server
How to install and configure Elasticsearch on Ubuntu 16.04
How to install and configure VNC on Ubuntu 18.04
How to install and configure Sphinx on Ubuntu 16.04
How to install and configure OrientDB on Ubuntu 14.04
How to run the parsing server on Ubuntu 14.04
How to configure Apache content caching on Ubuntu 14.04
How to install and configure AppScale on Ubuntu 12.04
How to install and configure PostGIS on Ubuntu 14.04
lamp on ubuntu
Ubuntu configure Tomcat
Ubuntu configure Apache
How to set up a DNS server on Ubuntu 18.04
How to configure FTP server with Vsftpd on CentOS 8
How to configure a fixed IP based on Ubuntu 18.04
How to configure DNS for Ubuntu to make it permanent
How to install and configure NFS server on CentOS 8
How to configure FTP server with Vsftpd on CentOS 8
Tutorial for setting up FTP server in Ubuntu 16.04 environment
How to open https on nginx server under Ubuntu