Archive

Posts Tagged ‘Admin’

Yum Revisited (Part 2)

September 20th, 2009 No comments

YUM - Yellowdog Updater Modified Here is the second article dedicated to the “yum” command. We will demonstrate some useful option of the command and how-to recover in some problematic situation. Keeping your system up to date is important, knowing how to do it and how to correct some issue related to rpm are also important. So let’s see if everyone can find something new about the “yum” command and see if we can apply it in our daily system admin job. You can also consult the “yum” website or the “yum” wiki to obtain more information. As always, I will try to make this article as useful as it can be, so we  can all come back to it and use it as a reference to the “yum” command.

Checking if update are available

Let’s say you want to be advise when new update are available and want to be emailed with the list of packages included in the update.  When we run the “yum” command with the “check-update” parameter, it actually go and check if any update are available at the repository you have defined in your “/etc/yum.repos.d” directory. If any update are available, they will be listed and the program exit code returned will be 100. If no update are available then the exit code will be 0.

# yum check-update ; echo $?
Loaded plugins: changelog, fastestmirror, priorities
Loading mirror speeds from cached hostfile
* base: mirrors.portafixe.com
* updates: mirrors.portafixe.com
* addons: mirrors.portafixe.com
* extras: mirrors.portafixe.com
cman.i386                                2.0.98-1.el5_3.7       updates
ksh.i386                                 20080202-2.el5_3.1     updates
openais.i386                             0.80.3-22.el5_3.9      updates
rgmanager.i386                           2.0.46-1.el5.centos.4  updates
tzdata.noarch                            2009k-1.el5            updates
100
#

We can easily make a little script that we can put in our system crontab file, that will check if any update are available. If there are any, then a list of the updated package will be send to you by email

#!/bin/sh
/usr/bin/yum check-update > /tmp/cu$$ 2>&1
RET=$?
if [ $RET -eq 100 ]; then
   cat /tmp/cu$$ | mail -s "System Update Available" yourname@gmail.com
fi
rm /tmp/cu$$ > /dev/null 2>&1

Read more…

Categories: Admin

Yum Revisited (Part 1)

September 4th, 2009 3 comments

YumThis is a first of a series of two articles dedicated to the “yum” program. In this first article, we will mainly look at the configuration files. In the next article, we will look at some advance usage, that will help us in administrating our servers.  As always, will build our article, in a way that we can come back to it and use it as a reference if we need some information about “yum”. We will concentrate on the command line version of “yum”, but I would like mention that there is a graphical version called “yumex” that I would recommend. It is not the fastest one, but it is simple to use and it work.  Visit the  “yumex” home page, you can aloso download the RedHat/Centos 5 rpm from here.

Main configuration file (/etc/yum.conf)

We can say that “yum” configuration break in two parts, the main configuration file yum.conf  located in the /etc directory and the /etc/yum.repos.d directory that contains separated files for each repository that “yum” can connect to, for updating/installing our system. Below is a modified version of the yum.conf file that include comment for every option line, so we could use it as a reference. I think all options, along  with the comments included are self explanatory .

# The Main section must exist for yum to do anything
[main]

# Directory where packages are downloaded
cachedir=/var/cache/yum

# 0=Remove packages & headers after they are install/update
# 1=Keep downloaded packages after update
keepcache=0

# Debug Level. Valid numbers are 0-10, default is 2
debuglevel=2

# Where yum log file is located
logfile=/var/log/yum.log

# Distribution Package Name (Fedora=fedora-release, RedHat/Centos=redhat-release)
distroverpkg=redhat-release

# 1=Complaint when package aleady install is installed, 0=not tolerant
# For example, if you request to install foo, bar and baz and baz is installed;
# yum won't error out complaining that baz is already installedt
tolerant=1

# 1=Only update the architectures of packages that is installed, 0=Override Check
exactarch=1

# Let yum determine if package is obsolete during update (1=Activate 0=Deactivate)
obsoletes=1

# Confirms that all packages are cryptographically verified
gpgcheck=1

# 1=Enabling yum plugins, 0=Disable yum plugins
# Once plugins are enabled in yum.conf, you may install yum plugins and use them.
plugins=1

# Determine when repositories metedata expire after it is received.
# Note: yum-RHN-plugin doesn't honor this.
metadata_expire=1h

# Some package (like kernel) can only be install and not updated
# So here we would keep 5 versions of the kernel.
# When the sixth one is installed, the oldest one will get deleted.
installonly_limit = 5

# List of packages to exclude from updates or installs.
# Uncomment below if you want to autoupdate also the kernel rpms
# Reboot is necessary to use the new kernel, once installed.
# exclude=kernel*

# PUT YOUR REPOS HERE OR IN separate files named file.repo
# in /etc/yum.repos.d
#

Read more…

Categories: Admin