Sunday, 24 June 2007

RHEL package management

Compilation of most common commands dealing with package management.

up2date

Install
up2date -i package

Show packages groups
up2date --show-groups

Install a package group
up2date -i @GROUP_NAME (e.g. : up2date -i @GNOME Desktop Environment)

up2date sources specified under /etc/sysconfig/rhn/sources

yum

Install
yum install package

Get info
yum info package

Remove
yum erase package

Check if update available

yum check-update

Find package providing the file
yum whatprovides /some/file

Clean all yum caches
yum clean all

Yum sources specified under /etc/yum.repos.d/

rpm

Install
rpm -ihv package.rpm

Reinstall an already installed package
rpm -ihv replacepkgs package.rpm

Update
rpm -Uhv package.rpm

Remove (–nodeps will break dependencies)
rpm -e package (--nodeps)

Find dependencies or find which package a file belongs to
rpm -q --redhatprovices missing-dep-file.so.2

Find which package owns a file
rpm -qf /usb/bin/vim

Get info. use -qip if getting info from a rpm package
rpm -qi(p) package(.rpm)

List packages installed
rpm -qa

Sort rpms by installation date
rpm -qa --las

Thursday, 21 June 2007

Install & configure the ipfm & MRTG

IPMF INSTALL
============
http://www.generationip.com/docs/0001/network_IPFM-IP-Flow-METER-Documentation.html
================================================================
./configure --exec-prefix=/usr --prefix= --sysconfdir=/usr/local/etc/ --mandir=/usr/local/man
make
make install
===============
/usr/sbin/ipfm -c /usr/local/ipfm/ipfm.conf -p /usr/local/ipfm/pid/ipfm.pid
cd ..
cp ipacc /etc/init.d/
cd /etc/init.d
chkconfig --level 235 ipacc on
/usr/local/sbin/ipfm -c /usr/local/etc/ipfm.conf -p /usr/local/var/run/ipfm.pid
===================
*****copy the folder etc to linux etc







=========================================
MRTG INSTALL RPM or TAR

If you do not have zlib installed:
wget http://www.gzip.org/zlib/zlib-1.1.4.tar.gz
gunzip -c zlib-*.tar.gz tar xf -
rm zlib-*.tar.gz
mv zlib-* zlib
cd zlib
./configure
make
cd ..


======
If you don't have libpng installed
wget http://public.planetmirror.com/pub/sourceforge/l/li/libpng/libpng-1.0.15.tar.gz
gunzip -c libpng-*.tar.gz tar xf -
rm libpng-*.tar.gz
mv libpng-* libpng
cd libpng
make -f scripts/makefile.std CC=gcc ZLIBLIB=../zlib ZLIBINC=../zlib
rm *.so.* *.so
cd ..


=============
For versions up to 1.8.4, try:
wget http://www.boutell.com/gd/http/gd-1.8.4.tar.gz
gunzip -c gd-*.tar.gz tar xf -
rm gd-*.tar.gz
mv gd-* gd
cd gd
perl -i~ -p -e s/gd_jpeg.o//g Makefile
make INCLUDEDIRS="-I. -I../zlib -I../libpng" LIBDIRS="-L../zlib -L. -L../libpng" LIBS="-lgd -lpng -lz -lm" CFLAGS="-O -DHAVE_LIBPNG"
cd ..For version starting around 2.0.11, try:

wget http://www.boutell.com/gd/http/gd-2.0.11.tar.gz
gunzip -c gd-2.0.11.tar.gz tar xf -
mv gd-2.0.11 gd
cd gd
env CPPFLAGS="-I../zlib -I../libpng" LDFLAGS="-L../zlib -L../libpng" ./configure --disable-shared --without-freetype --without-jpeg
make
cp .libs/* .


============= MRTG
cd /usr/local/src
gunzip -c mrtg-2.12.1.tar.gz tar xvf -
cd mrtg-2.12.1If all the libraries have been preinstalled on your system you can configure mrtg by doing a simple:
./configure --prefix=/usr/local/mrtg-2Otherwise you may have to give some hints on where to find the various libraries required to compile mrtg:
./configure --prefix=/usr/local/src/mrtg-2 --with-gd=/usr/local/src/mrtg/gd --with-zlib=/usr/local/src/mrtg/zlib --with-png=/usr/local/src/mrtg/libpng
make
make install


================Confiure
cfgmaker --global 'WorkDir: /home/httpd/mrtg' \
--global 'Options[_]: bits,growright' \
--output /home/mrtg/cfg/mrtg.cfg \
community@router.abc.xyz


=============== RunAsDaemon:
Yesto your mrtg configuration file and then creating a startup script in your system startup sequence. Unfortunately, adding startup scripts differs widely amongst different unix systems. The modern ones normally have a directory called /etc/init.d or /etc/rc.d/init.d where you put scripts which starts the process you want to run when the system boots. Further you must create a symbolic link in /etc/rc3.d or /etc/rc.d/rc?.d called S65mrtg (this is just a sample name ... it is just important that it starts with S followed by a two digit number). If you are not sure about this, make sure you consult the documentation of your system to make sure you get this right.


./configure --with-apxs2=/usr/local/apache2/bin/apxs --with-mysql --with-gd=/root/gd --with-libpng=/root/libpng --with-zlib=/root/zlib --with-jpeg=/root/jpeg-6b/



Configure the ipfm

cd /usr/local/src/mrtg/
cd etc/ipfm/
vi ipfm.conf
cp ipfm.conf /usr/local/etc/ipfm.conf
cd /usr/local/etc/
vi ipfm.conf
mkdir -p /var/log/ipfm/subnet/
touch /var/log/ipfm/subnet/localan.log
chmod 777 /var/log/ipfm/subnet/localan.log
vi /var/log/ipfm/subnet/localan.log
cd /usr/local/sre/mrtg/etc/
cd ..
cp /usr/sbin/ipfm /usr/local/sbin/ipfm
cp ipacc /etc/init.d/
cd /etc/init.d/
chmod 777 /etc/init.d/ipacc
chkconfig --level 235 ipacc on
service ipacc start
cd /
cp -r mrtg /etc/
cd /etc/mrtg/
mkdir -p /var/www/html/mrtg/
vi 10.15.cfg
ls
vi 10.15.cfg
vi ipfm_acc_eth0
ls
./ipfm_acc_eth0
chmod 777 *
./ipfm_acc_eth0
vi all-ip-eth0
/usr/bin/mrtg /etc/mrtg/10.15.cfg;
locate mrtg
/usr/local/src/mrtg-2/bin/mrtg /etc/mrtg/10.15.cfg
/usr/local/src/mrtg-2/bin/mrtg /etc/mrtg/10.15.cfg
/usr/local/src/mrtg-2/bin/mrtg /etc/mrtg/10.15.cfg
ls
/usr/local/src/mrtg-2/bin/mrtg /etc/mrtg/10.15.cfg
pgrep httpd
service httpd start
/usr/local/src/mrtg-2/bin/mrtg /etc/mrtg/10.15.cfg
/usr/local/src/mrtg-2/bin/mrtg /etc/mrtg/10.15.cfg
/usr/local/src/mrtg-2/bin/mrtg /etc/mrtg/10.15.cfg
/usr/local/src/mrtg-2/bin/mrtg /etc/mrtg/10.15.cfg
ls
./ipfm_acc_eth0
ping 192.168.10.80 -t l 6550
ping 192.168.10.80 -t -l 6550
ping 192.168.10.80 -t -s 6550
ping 192.168.10.80 -s 6550
ping 192.168.10.80 -s 65500
./ipfm_acc_eth0
./ipfm_acc_eth0
./ipfm_acc_eth0
/usr/local/src/mrtg-2/bin/mrtg /etc/mrtg/10.15.cfg
/usr/local/src/mrtg-2/bin/mrtg /etc/mrtg/10.15.cfg
ls
vi all-ip-eth0
./ipfm_acc_eth0
rubelsbd@yahoo.com

Install Yum in RHEL3

Now I have a fully updated system. Following is the brief summary of the steps I took

1) Since I was behind a proxy I had to export environment variable http_proxy.

2) Downloaded yum-2.0.8-1.noarch.rpm fromhttp://linux.duke.edu/projects/yum/download/2.0/yum-2.0.8-1.noarch.rpm

3) Installed it usingrpm –i yum-2.0.8-1.noarch.rpm

4) Configured my yum.conf to look like this:

[main]
cachedir=/var/cache/yum
debuglevel=2
logfile=/var/log/yum.log
pkgpolicy=newest
distroverpkg=redhat-release
tolerant=1
exactarch=1

#base]
#name=Red Hat Linux $releasever - $basearch - Base
#aseurl=http://mirror.dulug.duke.edu/pub/yum-
repository/redhat/$releasever/$basearch/

[base]
name=CentOS-$releasever - Base
baseurl=http://mirror.centos.org/centos/3/os/i386/
gpgcheck=1

[updates]
name=Red Hat Linux $releasever - Updates
baseurl=http://mirror.centos.org/centos/3/updates/i386/
gpgcheck=1

5) Downloaded the gpg key for CentOS rpm packages fromhttp://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-3

6) Imported the key like this:rpm --import RPM-GPG-KEY-CentOS-3

7) Run “yum –y update”. Now Sit back and enjoy seeing your system being updated.

Enjoy!


Shahjahan Siraj