yum-cron is an alternate interface to yum that is optimised to be convenient to call from cron. It provides methods to keep repository metadata up to date, and to check for, download, and apply updates. Rather than accepting many different command line arguments, the different functions of yum cron can be accessed through config files.

Installing

yum install yum-cron

The next thing to do is to add the service to the available services:

systemctl enable yum-cron.service

or

chkconfig yum-cron on
yum-cron

Configuring

Configuring yum-cron involves open /etc/yum/yum-cron.conf in your editor of choice. In centos 7 there are 3 settings that you will need to change:

# Whether a message should emitted when updates are available.
update_messages = yes

# Whether updates should be downloaded when they are available. Note
# that updates_messages must also be yes for updates to be downloaded.
download_updates = yes

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

CentOS 7 also has an hourly configuration file at /etc/yum/yum-cron-hourly.conf

There are 4 lines to change inside this file

What kind of update to use:
default = yum upgrade
security = yum –security upgrade
security-severity:Critical = yum –sec-severity=Critical upgrade
minimal = yum –bugfix update-minimal
minimal-security = yum –security update-minimal
minimal-security-severity:Critical = –sec-severity=Critical update-minimal

update_cmd = security

Whether a message should emitted when updates are available.

update_messages = yes

Whether updates should be downloaded when they are available. Note that updates_messages must also be yes for updates to be downloaded.

download_updates = yes

Whether updates should be applied when they are available. Note that both update_messages and download_updates must also be yes for the update to be applied

apply_updates = yes

You will now have hourly security updates and daily updates for everything else. The updates will download and apply automatically :D

The last thing you need to do is to turn on the yum cron service:

service yum-cron start

or

systemctl start yum-cron.service

Sources: Fedora Project