Archive

Archive for May, 2009

pssh – Running command in parallel on multiple servers

When the number of server you are administrating is getting higher, you need to find a way to get the job done easier. This is when “pssh” come in handy. In this article, I will demonstrate by example, the utilization of the “pssh” tools. I will on purpose, not cover the “prsync” and the “pnuke” command, in an effort to keep this article interesting and not to lenghtly.

To begin with, we need to automate your ssh login session to your servers from one management server. This is require before using “pssh” to it full extend. If you do not know how to automate ssh login there is an excellent article available at “The Geek Stuff” site, that explain how to do it.

First, let’s install the package

# rpm -ivh pssh-1.2.2-1.i386.rpm
Preparing...                ########################################### [100%]
   1:pssh                   ########################################### [100%]
#

After installing the package, there are several parallel commands that are available to us. We have the ‘pssh’ that allow us to run the same command on multiple servers, the “pscp” to copy file(s) to multiple servers and finally “pslurp” used to get directories or files from multiples host and copy them to the local server.

Read more…

Categories: Tools

yum tips and tricks

The “yum” is a powerful and useful command. We will present here some options of this command. Hopefully, you will find these tips helpful and that you learn something.

Applying only security update

To be able to apply only security update on your server, we first need to install a plugin for this purpose. You can install it with this command:

yum install yum-security

After that, we can use this plugin to update your computer to the latest security fixes :

yum update --security

Applying all update except the kernel update

On some system, you may want to apply all update, except the one concerning the kernel.  To put this exception , add the following line to the file /etc/yum.conf ;

echo 'exclude=kernel*' >> /etc/yum.conf

Applying all update except the kernel update

In order to enable the automatic update system run following commands:

chkconfig --add yum-autoupdate
service yum-autoupdate start

In order to disable the system run:

service yum-autoupdate stop
chkconfig --del yum-autoupdate
Categories: Tips & Tricks

What script is run when a package is install ?

Today, we will look at what script is run when you install a rpm. In our example we will look at the script that is run when we perform a kernel installation.  First, let’s look what kernel version is installed on our system, with the this command :

# rpm -qa | grep -i kernel
kernel-2.6.18-92.1.22.el5
kernel-2.6.18-92.1.18.el5
kernel-2.6.18-128.1.6.el5
kernel-headers-2.6.18-128.1.6.el5
#

Let’s view the script that is run when the kernel 2.6.18-128.1.6 is install ;

# rpm -q --scripts kernel-2.6.18-128.1.6.el5
postinstall scriptlet (using /bin/sh):
if [ `uname -i` == "x86_64" -o `uname -i` == "i386" ]; then
   if [ -f /etc/sysconfig/kernel ]; then
      /bin/sed -i -e 's/^DEFAULTKERNEL=kernel-smp$/DEFAULTKERNEL=kernel/' /etc/sysconfig/kernel || exit $?
   fi
fi
/sbin/new-kernel-pkg --package kernel --mkinitrd --depmod --install 2.6.18-128.1.6.el5 || exit $?
if [ -x /sbin/weak-modules ]
   then
   /sbin/weak-modules --add-kernel 2.6.18-128.1.6.el5 || exit $?
fi
preuninstall scriptlet (using /bin/sh):
/sbin/new-kernel-pkg --rminitrd --rmmoddep --remove 2.6.18-128.1.6.el5 || exit $?
if [ -x /sbin/weak-modules ]
   then
   /sbin/weak-modules --remove-kernel 2.6.18-128.1.6.el5 || exit $?
fi
#
Categories: Admin