Skip to content

Instantly share code, notes, and snippets.

@mmalek-sa
Last active July 13, 2023 08:56
Show Gist options
  • Save mmalek-sa/279e14073dae10cf34d49e2a014e45e4 to your computer and use it in GitHub Desktop.
Save mmalek-sa/279e14073dae10cf34d49e2a014e45e4 to your computer and use it in GitHub Desktop.
How to enable yum-cron on Amazon Linux 2, CentOS and RHEL servers to automatically install updates

Automatic updates with yum-cron

If you are on RHEL make sure optional repos are enabled:

subscription-manager repos --enable rhel-7-server-optional-rpms

Then install yum-cron:

yum -y install yum-cron

Enable yum-cron:

systemctl enable yum-cron.service

Edit yum cron config:

vim /etc/yum/yum-cron.conf

make sure apply_updates is set to yes:

# Whether updates should be applied when they are available.  Note
# that download_updates must also be yes for the update to be applied.
apply_updates = yes

Start the service:

systemctl start yum-cron.service

Check status of the service, make sure it’s up:

systemctl status yum-cron.service

active (exited) is the desired value.

Monitor the log files using:

tail -f /var/log/yum.log

and

tail -f /var/log/cron

Or using multitail (yum install multitail)

multitail -f /var/log/cron /var/log/yum.log
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment