See what version of CentOS we’re using:

1
cat /etc/redhat-release

Installing the package via yum

1
2
3
4
5
# Install yum-cron
sudo yum install yum-cron

# Configure yum-cron
sudo vim /etc/yum/yum-cron.conf

Set the following to your needs:

1
2
3
4
5
6
7
8
9
10
11
12
#  What kind of update to use:
# default = yum upgrade
# security = yum --security upgrade
# security-severity:Critical = yum --sec-severity=Critical upgrade
# minimal = yum --bugfix upgrade-minimal
# minimal-security = yum --security upgrade-minimal
# minimal-security-severity:Critical = --sec-severity=Critical upgrade-minimal
update_cmd = default

# 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

Then restart the service created by installing this package:

1
2
3
4
sudo systemctl enable yum-cron
# Or "restart" if already started
sudo systemctl start yum-cron
sudo systemctl status yum-cron

You’re done!