How to use yum-cron to automatically update RHEL/CentOS Linux

Yum-cron is a package that can be used to automatically update packages on RHEL/CentOS Linux systems. Here are the steps to set up yum-cron:

  1. Install yum-cron:
    sudo yum install yum-cron
  2. Edit the configuration file for yum-cron:
    sudo vi /etc/yum/yum-cron.conf

    The configuration file has several options that can be used to customize the behavior of yum-cron. Some of the most important options are:

    • update_cmd: This option specifies the command that yum-cron will use to perform updates. The default value is default, which means that yum-cron will use the same command that is used by the yum update command. Other options include security (which only updates packages that have security updates), and none (which disables updates).
    • download_updates: This option controls whether or not yum-cron will download updates before installing them. The default value is yes, which means that updates will be downloaded before they are installed.
    • apply_updates: This option controls whether or not yum-cron will apply updates automatically. The default value is no, which means that updates will not be applied automatically.
  3. Start and enable the yum-cron service:
    sudo systemctl start yum-cron
    sudo systemctl enable yum-cron

    This will start the yum-cron service and configure it to start automatically at boot.

Once yum-cron is set up, it will automatically download and install updates according to the configuration file. By default, yum-cron will check for updates every day, but you can customize the schedule by editing the /etc/cron.daily/0yum-daily.cron file. You can also view the yum-cron log file at /var/log/yum.log to see which packages were updated and when.

Leave a Comment