Auto upgrade on Centos 6/7 using yum-cron
Posted on June 23, 2016 • 2 minutes • 255 words • Suggest Changes
Using Centos Stream 8 ? This won’t work anymore, it changed to dnf-automatic !
This is one of those things I do when I enter a new server/virtual machine. While this could cause issue’s down the road, (updates are always a bit of a guess) Most simple advice to give to problems in Linux is, “did you update ?”. In Centos its pretty easy to set this up automatic updates, so no server should be without this essential part of configuration. Another big point is security, while this isn’t per definition more secure, its better to have a bad update then to have a few 100 MB of not done updates cause they “might break something”.
- “update”
Seems so logically, but still update everything before you let yum-cron loose.
yum update
- Install the magic
Its as easy as pie.
yum install yum-cron
- configure
Configuration file for Centos 6 is located/etc/sysconfig/yum-cron
for Centos 7 its located at/etc/yum/yum-cron.conf
(a more logically location) Go through the settings, and decide whats best for you, personally I leave most as-if, only changing (Centos7) :
apply_updates = yes
Since I want them installed nightly if available.
- start the service & enable at reboot
# service yum-cron start Redirecting to /bin/systemctl start yum-cron.service # chkconfig yum-cron on Note: Forwarding request to 'systemctl enable yum-cron.service'.
Enjoy ! From now on, your machine will be up-to-date… no more lagging behind! If an error should happen cause of updates, you only have to look back a few days in :
/var/log/yum.log
Happy updating!