
Configure Automatic Updates Centos 7
We suggest that you enable automatic updates for your AMI instance. At the least you should enable security updates.
yum-cron
package. To get started install the unattended upgrades packageyum-cron
package.
# Install yum-cron sudo yum install yum-cron
Edit the yum-cron.conf file
sudo nano /etc/yum/yum-cron.conf
Edit the file with the following
#Install security updates update_cmd = security #Install the updates after downloading apply_updates = yes #Spread the update start time over an hour random_sleep = 60
Startup the service:
# Make sure yum-cron starts at boot-up sudo systemctl enable yum-cron # finally start up the service sudo systemctl start yum-cron
You can check on the status any time by doing:
sudo systemctl status yum-cron
Advanced topics
Choosing which updates to install
# 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
Getting email updates.
# How to send messages. Valid options are stdio and email. If # emit_via includes stdio, messages will be sent to stdout; this is useful # to have cron send the messages. If emit_via includes email, this # program will send email itself according to the configured options. # If emit_via is None or left blank, no messages will be sent. emit_via = email [email] # The address to send email messages from. email_from = centos@myserver # List of addresses to send messages to. email_to = test@example.com # Name of the host to connect to to send email messages. email_host = localhost