Automatic Updates to OS Using YUM

General support questions
Post Reply
Showflash
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
2.6.32-220.el6.x86_64


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:
http://www.centos.org/docs/5/html/yum/sn-updating-your-system.html

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.

Thanks!

Showflash
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
2.6.32-358.11.1.el6.x86_64

User avatar
TrevorH
Forum Moderator
Posts: 25557
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.

Showflash
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!

Sincerely,
Tommy

Showflash
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 -
Password:
[root@localhost ~]# yum install yum-cron
Loaded plugins: fastestmirror, security
Determining fastest mirrors
* base: mirror.beyondhosting.net
* extras: mirrors.gigenet.com
* updates: centos.mirror.nac.net
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
==============================================================================================================
Installing:
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

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

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

Complete!
----------


[root@localhost /]# find / | grep yum-cron
/var/lib/yum/yumdb/y/3401c7701c6e1b95a90133f0e7885530e803d281-yum-cron-3.2.29-40.el6.centos-noarch
/var/lib/yum/yumdb/y/3401c7701c6e1b95a90133f0e7885530e803d281-yum-cron-3.2.29-40.el6.centos-noarch/from_repo_revision
/var/lib/yum/yumdb/y/3401c7701c6e1b95a90133f0e7885530e803d281-yum-cron-3.2.29-40.el6.centos-noarch/releasever
/var/lib/yum/yumdb/y/3401c7701c6e1b95a90133f0e7885530e803d281-yum-cron-3.2.29-40.el6.centos-noarch/checksum_data
/var/lib/yum/yumdb/y/3401c7701c6e1b95a90133f0e7885530e803d281-yum-cron-3.2.29-40.el6.centos-noarch/command_line
/var/lib/yum/yumdb/y/3401c7701c6e1b95a90133f0e7885530e803d281-yum-cron-3.2.29-40.el6.centos-noarch/reason
/var/lib/yum/yumdb/y/3401c7701c6e1b95a90133f0e7885530e803d281-yum-cron-3.2.29-40.el6.centos-noarch/installed_by
/var/lib/yum/yumdb/y/3401c7701c6e1b95a90133f0e7885530e803d281-yum-cron-3.2.29-40.el6.centos-noarch/from_repo_timestamp
/var/lib/yum/yumdb/y/3401c7701c6e1b95a90133f0e7885530e803d281-yum-cron-3.2.29-40.el6.centos-noarch/checksum_type
/var/lib/yum/yumdb/y/3401c7701c6e1b95a90133f0e7885530e803d281-yum-cron-3.2.29-40.el6.centos-noarch/from_repo
/etc/rc.d/rc4.d/K01yum-cron
/etc/rc.d/init.d/yum-cron
/etc/rc.d/rc2.d/K01yum-cron
/etc/rc.d/rc0.d/K01yum-cron
/etc/rc.d/rc1.d/K01yum-cron
/etc/rc.d/rc5.d/K01yum-cron
/etc/rc.d/rc3.d/K01yum-cron
/etc/rc.d/rc6.d/K01yum-cron
/etc/sysconfig/yum-cron
/usr/share/man/man8/yum-cron.8.gz
/usr/share/doc/yum-cron-3.2.29
/usr/share/doc/yum-cron-3.2.29/COPYING


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.


Sincerely,
Tommy

Post Reply