Linux

How To Install Updates On CentOS 7

How To Install Updates On CentOS 7
Written by itsubuntu

Insight: How to Install Updates on CentOS 7

CentOS 7 is one of the popular server side Linux operating system. Today, we will show you the method to install updates on CentOS 7.

Tutorial To Install Updates On CentOS 7 Operating System.

There are two ways to install updates on CentOS 7.

Method 1: Automatic updates on CentOS 7.

You can use yum-cron script to configure automatic updates on CentOS 7. Install yum-cron script using following command:

sudo yum install yum-cron

Enable and start the service:

sudo systemctl enable yum-cronsudo systemctl start yum-cron

To verify that the service is running:

systemctl status yum-cron

Configuring yum-cron

There are two configuration files, the hourly configuration file yum-cron.conf and the daily configuration file yum-cron-hourly.conf.

To edit the yum-cron configuration file, open the file in your text editor:

sudo nano /etc/yum/yum-cron-hourly.conf

We changed the update_cmd to security and enabled unattended updates by setting apply_updates to yes:

[commands]
update_cmd = security
update_messages = yes
download_updates = yes
apply_updates = yes
random_sleep = 360

The second sections defines how to send messages.

In the [base] section you can override the settings defined in the yum.conf file. For example, you can exclude specific packages from being updated.

[base]
debuglevel = -2
mdpolicy = group:main
exclude = firefox*

Method 2: Manual updates on CentOS 7.

Run the following command to check the available updates for CentOS 7.
sudo yum check-update
You will see the the output with a list of all packages that are available for update for CentOS 7.
To update single package, run the following command:
sudo yum install curl

Meanwhile, if you want to prevent any pacakges being updated, you can do it with the help of third party app called versionlock , run the following command to install it:

sudo install yum-plugin-versionlock

Run the following command to prevent specific packages from being updated:

sudo yum versionlock curl-*

Summary: Multiple method to install updates on CentOS 7.

About the author

itsubuntu

Leave a Comment