Breaking News
Home / How To / How to configure automatic package updates on CentOS 8

How to configure automatic package updates on CentOS 8



Security updates, which most of you agree with, are very important. Under Linux, it is always advisable to keep the installed packages up to date, especially when it comes to security. In general, users should apply security updates to their Linux systems within 30 days of release.

In this tutorial we will show how to set automatic update packages on CentOS 8. This ensures that the system automatically downloads packages and performs updates without manual intervention.

On the CentOS 8 system, we have two ways to set automatic update packages. We can use CLI mode with the "dnf-automatic" tool and the web-based environment that can be implemented via Cockpit Server Management.

Automatic update setup with Dnf auto

Dnf-Automatic are system d devices that can download package upgrades and apply them automatically. Dnf automation provides three different system d drives to control the automatic update.

Below are three system d units provided by dnf-automatic.

  • dnf-Automatic-download.timer for download only
  • dnf-Automatic-install .timer for download package updates and install
  • dnf-automatic-notifyonly.timer will only announce via the omitter configuration

Dnf automatic is installed not by default on the CentOS system, it is available on the BaseOS repository. [1

9659002] Install dnf automatics with the following command.

  sudo dnf install dnf auto 

When installation is complete, go to directory & # 39; / etc / dnf & # 39; and edit the & # 39; Automatic.conf & # 39; configuration.

  cd / etc / dnf / 
vim Automatic.conf

In the "[commands]" section, change the "upgrade_type" you need. You can use the & # 39; default & # 39; to upgrade all packages or use the & # 39; security & # 39; to upgrade all package-related collateral.

[commands]
upgrade_type = default
download_updates = yes

In the "[emitters]" section, deselect the option & # 39; system name & # 39; and change the value with your host name. Then change the & # 39; emit_via & # 39; to motd, you will be shown about package updates at each login.

[emitters]
system_name = hakase-centos8
emit_via = motd

Other options for & # 39; emit_via & # 39; configuration is & # 39; stdio & # 39; which is the default configuration and "email" to send packet update information to your email address.

Now go to the "[email]" section and change each configuration with your own.

[email]
email_from = [email protected]
email_to = root
email_host = localhost

Save and close.

Automatic download of package upgrades

Then start dnf-automatic timer and add it to the system startup.

  sudo systemctl enable - now dnf-automatic .timer 

Now check the status of dnf-auto timer.

  sudo systemctl list-timers * dnf - * 

You will now see two different timers for systemd devices.

The dnf-makecache device will run the dnf-makecache service for updating cache packages, and the dnf-automatic unit runs dnf-automatic service for downloading package upgrades.

 Configure DNS Automatic Updates

Now on all logon actions to the CentOS 8 server, you see the summary of the package upgrade downloaded as a modd (message of the day).

 The package update message upon login

All package upgrades were automatically downloaded through the time service & # 39; dnf-automatic & # 39 ;.

Automatic Installation Package Upgrades

For the automatic package upgrade installation, you can run the & # 39; dnf-automatic-install timer service. & # 39;

Launch timer service & # 39; dnf-auto-install & # 39; and add it to the system boot.

  sudo systemctl enable - -Now dnf-auto-install.timer 

Then check the status of dnf-auto-timer.

  sudo systemctl list-timers * dnf - * 

You will get & # 39; dnf-auto-install "timer on the list.

 Install timer

Now on all login actions continue to the CentOS 8 server, you see a package upgrade summary applied as a modd (today's message).

 Package updates applied

And all package upgrades have been applied automatically through the dnf-auto-install timer service.

Automatic update setup via Cockpit

Open your browser, enter the server's IP address that comes with the standard cockpit port & # 39; 9090 & # 39; and log in with your user and password.

https: / /10.5.5.70:9090/

After you have logged in, go to " Software Updates " and turn on the automatic update button.

 Use the Cockpit to configure automatic package updates

You will now be prompted to install the package " dnf-automatic ", click on the " Install " button. [19659002]   Install dnf-automatic via cockpit

When the installation is complete, select the type of update that suits you and then select the time to update the package.

 Installation complete

Now the automatic timer timer is running on the system.

Click the " Services " menu and select the " Timers " tab.

 Services and timers

You will have the timer dnf-makecache and dnf-automatic installation activated. [19659002] As a result, you have configured the CentOS 8 automatic update using dnf automatically through the cockpit server management.

Reference


Source link