Automatic Updates to OS Using YUM

General support questions
Post Reply
Posts: 18
Joined: 2013/07/01 04:40:10

Automatic Updates to OS Using YUM

Post by Showflash » 2013/07/01 05:23:42

I'm just getting back in to using Linux so forgive me if this is obvious. Just point me to the documentation if it exists and I will read it. Thanks!

I have two questions regarding the following regarding a yum update script, and the questions are marked by "QUESTION."

Note that I am working on the system in the middle of a complete update using 'yum update' I'm on package 530/678.
[Object@localhost Documents]$ cat /etc/redhat-release
CentOS release 6.2 (Final)
[Object@localhost Documents]$ uname -r

I'm using the following web document, and know that it's for CentOS 5 and I'm using CentOS 6. Shouldn't be that much of a difference:

Section 6.1. Automatically Updating Your System states that by executing the command:
su -c '/sbin/chkconfig --level 345 yum on; /sbin/service yum start'

Daily updates are run according to the following: There is no separate yum service that runs on your system. The command given above enables the control script /etc/rc.d/init.d/yum. This control script activates the script /etc/cron.daily/yum.cron, which causes the cron service to perform the system update automatically at 4am each day.

NOTE! When I looked for the yum script(s) the CentOS system did not natively have them installed.
QUESTION: Do I have to install or generate the scripts?

[root@localhost ~]# ls /etc/rc.d/init.d/yum
ls: cannot access /etc/rc.d/init.d/yum: No such file or directory
[root@localhost ~]# ls /etc/rc.d/init.d
abrt-ccpp crond ipmievd matahari-network nmb restorecond snmptrapd
abrtd cups ipsec matahari-service ntpd rgmanager spamassassin
abrt-oops dirsrv iptables matahari-sysconfig ntpdate ricci spice-vdagentd
acpid dirsrv-snmp ipvsadm mcelogd oddjobd rpcbind sshd
atd dnsmasq irqbalance mdmonitor openct rpcgssd sssd
auditd dovecot kadmin messagebus pcscd rpcidmapd sysstat
autofs firstboot kdump modclusterd piranha-gui rpcsvcgssd tgtd
avahi-daemon functions killall mysqld pki-cad rsyslog tog-pegasus
certmonger haldaemon kprop netcf-transaction portreserve sandbox tomcat6
cgconfig halt krb5kdc netconsole postfix saslauthd udev-post
cgred hsqldb libvirt-guests netfs psacct sblim-sfcb vsftpd
cman httpd luci network pulse single wdaemon
corosync ip6tables lvm2-monitor NetworkManager qpidd smartd wpa_supplicant
corosync-notifyd ipa matahari-broker nfs quota_nld smb xinetd
cpuspeed ipa_kpasswd matahari-host nfslock rdisc snmpd ypbind

[root@localhost ~]# ls /etc/cron.daily/*
/etc/cron.daily/00webalizer /etc/cron.daily/logrotate /etc/cron.daily/prelink
/etc/cron.daily/certwatch /etc/cron.daily/makewhatis.cron /etc/cron.daily/readahead.cron
/etc/cron.daily/cups /etc/cron.daily/mlocate.cron /etc/cron.daily/tmpwatch
[root@localhost ~]#

QUESTION: How do I change the time that the system updates every morning? I prefer 12 Noon.


Posts: 18
Joined: 2013/07/01 04:40:10

Re: Automatic Updates to OS Using YUM

Post by Showflash » 2013/07/01 06:25:55

After the update the following changed:

[Object@localhost Documents]$ cat /etc/redhat-release
CentOS release 6.4 (Final)
[Object@localhost Documents]$ uname -r

User avatar
Site Admin
Posts: 33037
Joined: 2009/09/24 10:40:56
Location: Brighton, UK

Automatic Updates to OS Using YUM

Post by TrevorH » 2013/07/01 07:51:14

You would need to install the yum-cron package. It'll drop a config file into /etc/sysconfig/yum-cron that controls what it does (update or just check f.e.). It also provides an /etc/cron.daily/yum-cron file that tells it to run but the system will decide when to do this based on /etc/anacrontab.

Posts: 18
Joined: 2013/07/01 04:40:10

Re: Automatic Updates to OS Using YUM

Post by Showflash » 2013/07/05 22:37:41

Thank you very much!


Posts: 18
Joined: 2013/07/01 04:40:10

Re: Automatic Updates to OS Using YUM

Post by Showflash » 2013/07/06 00:35:57

I found a few other commands that were required to get everuything rolling.

[Object@localhost Documents]$ su -
[root@localhost ~]# yum install yum-cron
Loaded plugins: fastestmirror, security
Determining fastest mirrors
* base:
* extras:
* updates:
base | 3.7 kB 00:00
extras | 3.4 kB 00:00
updates | 3.4 kB 00:00
updates/primary_db | 3.2 MB 00:41
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package yum-cron.noarch 0:3.2.29-40.el6.centos will be installed
--> Processing Dependency: yum-plugin-downloadonly for package: yum-cron-3.2.29-40.el6.centos.noarch
--> Running transaction check
---> Package yum-plugin-downloadonly.noarch 0:1.1.30-14.el6 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

Package Arch Version Repository Size
yum-cron noarch 3.2.29-40.el6.centos base 39 k
Installing for dependencies:
yum-plugin-downloadonly noarch 1.1.30-14.el6 base 20 k

Transaction Summary
Install 2 Package(s)

Total download size: 59 k
Installed size: 48 k
Is this ok [y/N]: y
Downloading Packages:
(1/2): yum-cron-3.2.29-40.el6.centos.noarch.rpm | 39 kB 00:00
(2/2): yum-plugin-downloadonly-1.1.30-14.el6.noarch.rpm | 20 kB 00:00
Total 43 kB/s | 59 kB 00:01
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
Installing : yum-plugin-downloadonly-1.1.30-14.el6.noarch 1/2
Installing : yum-cron-3.2.29-40.el6.centos.noarch 2/2
Verifying : yum-cron-3.2.29-40.el6.centos.noarch 1/2
Verifying : yum-plugin-downloadonly-1.1.30-14.el6.noarch 2/2

yum-cron.noarch 0:3.2.29-40.el6.centos

Dependency Installed:
yum-plugin-downloadonly.noarch 0:1.1.30-14.el6


[root@localhost /]# find / | grep yum-cron

Then do the following to make sure that yum-cron is started. Note that I did not have yum-updatesd installed but the commands were called for on other sites that I found.

[root@localhost init.d]# chkconfig yum-cron on
[root@localhost init.d]# chkconfig yum-updatesd off
error reading information on service yum-updatesd: No such file or directory
[root@localhost init.d]# service yum-cron start
Enabling nightly yum update: [ OK ]

[root@localhost init.d]# service yum-updatesd stop

Finally run Yum Update to get the system up to date:

[root@localhost init.d]# yum update

I will report back if I find any other issue.


Post Reply