How to find the version history of a rpm in Linux?
Here is an example :
[root@linux-cloud ~]# rpm -q --changelog gzip
* Thu May 29 2008 Karanbir Singh <> 1.3.5-10.el5.centos
- Roll in CentOS Branding
* Wed Jan 16 2008 Ivana Varekova <> 1.3.5-10.el5
- Resolves: #247269
gzip munges directory mtime with "-r"
* Fri Dec 15 2006 Ivana Varekova <> - 1.3.5-9.el5
- fix regression in unpack algorithm
Resolves: #219539
* Mon Oct 02 2006 Jesse Keating <> - 1.3.5-9
- rebuilt for unwind info generation, broken in gcc-4.1.1-21
* Thu Sep 21 2006 Ivana Varekova <> 1.3.5-8
- fix bug 204676 (patches by Tavis Ormandy)
- cve-2006-4334 - null dereference problem
- cve-2006-4335 - buffer overflow problem
- cve-2006-4336 - buffer underflow problem
- cve-2006-4338 - infinite loop problem
- cve-2006-4337 - buffer overflow problem
* Sat Jul 15 2006 Karsten Hopp <> 1.3.5-7
- buildrequire texinfo, otherwise gzip.info will be empty
* Thu Jul 13 2006 Jesse Keating <> - 1.3.5-6.2.2
- rebuild
...
File Synchronization tool : Unison
Read more about Unison @ http://www.ubuntugeek.com/unison-file-synchronization-tool.html
How to mount a ISO file
[root@linux-cloud images]# mount -o loop boot.iso /mnt
[root@linux-cloud images]#
[root@linux-cloud images]# df /mnt
Filesystem 1K-blocks Used Available Use% Mounted on
/media/fedora/images/boot.iso
131708 131708 0 100% /mnt
[root@linux-cloud images]# ls /mnt
images isolinux
[root@linux-cloud images]# mount | grep /mnt
/media/fedora/images/boot.iso on /mnt type iso9660 (ro,loop=/dev/loop0)
[root@linux-cloud images]#
Linux : yum package manager
[root@apple ~]# cat /etc/yum.conf
[main]
cachedir=/var/cache/yum
keepcache=0
debuglevel=2
logfile=/var/log/yum.log
distroverpkg=redhat-release
tolerant=1
exactarch=1
obsoletes=1
gpgcheck=1
plugins=1
[root@apple ~]#
Yum will look for remote repository information on the files stored in /etc/yum.repos.d/ . A sample file here.
[base]
name=CentOS-$releasever - Base
mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=os
#baseurl=http://mirror.centos.org/centos/$releasever/os/$basearch/
gpgcheck=1
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-5
Yum commands:
Yum has wide range of commands to install, update, check-update, list packages etc. Here let us see some important ones.
1) yum check-update : This returns list of packages that requires update on your machine.q
[root@apple ~]# yum check-update
Loading "fastestmirror" plugin
Loading mirror speeds from cached hostfile
* rpmforge: ftp-stud.fht-esslingen.de
agg.x86_64 2.5-1.el5.rf rpmforge
cadaver.x86_64 0.22.5-1.el5.rf rpmforge
firefox.x86_64 3.0.5-1.el5.centos updates
firefox.i386 3.0.5-1.el5.centos updates
iso-codes.noarch 1.0a-1.el5.rf rpmforge
lftp.x86_64 3.7.6-1.el5.rf rpmforge
libwpd.x86_64 0.8.14-1.el5.rf rpmforge
mtr.x86_64 2:0.75-1.el5.rf rpmforge
nmap.x86_64 2:4.20-1.el5.rf rpmforge
2) yum list : List all packages installed on your machine as well as the packages available in your repository.
[root@apple ~]# yum list
Loading "fastestmirror" plugin
Loading mirror speeds from cached hostfile
* rpmforge: fr2.rpmfind.net
Installed Packages
Deployment_Guide-en-US.noarch 5.2-11.el5.centos installed
GConf2.i386 2.14.0-9.el5 installed
3) yum update : This updates the whole machine or a package on the system. To update a package, pass argument to yum update [ ex : yum update spamassassin ]
4) yum install : To install a package, use this command. If you use "-y" option with yum update or yum install, that supresses all user input.
[root@apple ~]# yum install tomcat5
Loading "fastestmirror" plugin
Dependencies Resolved
=============================================================================
Package Arch Version Repository Size
=============================================================================
Installing:
tomcat5 x86_64 5.5.el5_2.1 updates 358 k
Installing for dependencies:
ant x86_64 1.6.5-2jpp.2 base 2.3 M
axis x86_64 1.2.1-2jpp.6 base 3.6 M
5) yum info : This is used to list a description and summary information about installed & available packages
[root@apple ~]# yum info NetworkManager-gnome
Loading "fastestmirror" plugin
Loading mirror speeds from cached hostfile
* rpmforge: fr2.rpmfind.net
Installed Packages
Name : NetworkManager-gnome
Arch : x86_64
Epoch : 1
Version: 0.6.4
Release: 8.el5
Size : 415 k
Repo : installed
Summary: GNOME applications for use with NetworkManager
Description:
This package contains GNOME utilities and applications for use with
NetworkManager, including a panel applet for wireless networks.
Solaris Flash archive
After you install the system with all packages you need and the data you need in it, you create the Flash archive. All the files on the system are copied to the archive along with various pieces of identifying information. Command "flarcreate" is used to create the archive. The flarcreate command requires the -n name option and a file name for the archive.
Example: The -n options specifies the server name and -c option enables data compression.
# flarcreate -n mobile_server -c /export/home/mobilebackup.flar
Determining which filesystems will be included in the archive...
Determining the size of the archive...
The archive will be approximately 3.12GB.
Creating the archive...
8713899 blocks
Archive creation complete.
References : http://www.sun.com/bigadmin/content/submitted/flash_archive.jsp
MobileRack

For more details check out Rackable systems site.
virt-install : Xen guest installation manager
virt-install is a python script that helps in installing & creating xen virtual machines. virt-install is command line based and virt-manager is GUI based one. You can get them from http://libvirt.org/. Using virt-install is very simple, you have to answer few questions about size of ram, image location etc and the virtual machine will be ready.
Interactive execution of "virt-install" :
[root@foo23 ~]# virt-install
Would you like a fully virtualized guest (yes or no)?
This will allow you to run unmodified operating systems. yes
What is the name of your virtual machine? honda
How much RAM should be allocated (in megabytes)? 1024
What would you like to use as the disk (file path)? /vmfs/cars/honda.img
How large would you like the disk (/vmfs/cars/honda.img) to be (in gigabytes)? 40
Would you like to enable graphics support? (yes or no) yes
What is the virtual CD image, CD device or install location? /repository/iso/Centos-5.2.iso
Starting install...
Creating storage file... 100% |=========================| 8.0 GB 00:00
Creating domain... 0 B 00:01
[root@foo23 ~]#
This will create the vm named "honda" and boot it up. You can check that by "xm list" or "virsh list".
[root@foo23 ~]# xm list
Name ID Mem(MiB) VCPUs State Time(s)
Domain-0 0 2048 4 r----- 23331.4
honda 1 1024 1 r----- 1.0
[root@foo23 ~]#
If you donot want interactive "virt-install", you can also pass options and arguments to it. Here is an example.
[root@foo23 ~]# virt-install -d -n toyoto -f /vmfs/cars/toyoto.img -v -c /repository/iso/Centos-5.2.iso -r 1024 --vnc
This creates the vm named "toyoto" and you can use vnc to connect to the console.
More Xen docs :
Vmware Virtual machine monitoring tools
- Solarwinds Free VM monitor
- Veeam Monitor for VMware Infrastructure
- Zenoss
- NimBUS Vmware monitoring
- VizionCore vFoglight
- PacketTrap
- Akorri BalancePoint
- Vkernel
- Hyperic
- Hyper9
Sending mail using script
-- Contents of testmail.pl ---
#!/usr/bin/perl
$mailcmd="/usr/lib/sendmail -t << EOF
To: linux-cloud\@nodomain.com
From : linux-cloud\@nodomain.com
Subject : Linux-cloud cars
I love luxury Cars, SUV
EOF";
`$mailcmd`;
# script ends
Fixing corrupted vmdk file
Solaris : Link Aggregation : dladm
Show all the data-link interfaces available :
unixfoo-solaris # dladm show-link
vsw0 type: non-vlan mtu: 1500 device: vsw0
e1000g0 type: non-vlan mtu: 1500 device: e1000g0
e1000g1 type: non-vlan mtu: 1500 device: e1000g1
e1000g2 type: non-vlan mtu: 1500 device: e1000g2
unixfoo-solaris #
Show the properties and values of data-link interfaces:
unixfoo-solaris # dladm show-linkprop
LINK PROPERTY VALUE DEFAULT POSSIBLE
vsw0 zone -- -- --
e1000g0 zone -- -- --
e1000g1 zone -- -- --
e1000g2 zone -- -- --
unixfoo-solaris #
Creating an Link Aggregation: [ http://en.wikipedia.org/wiki/Link_aggregation ]
Link aggregation, or IEEE 802.3ad, is a term which describes using multiple Ethernet network cables/ports in parallel to increase the link speed beyond the limits of any one single cable or port, and to increase the redundancy for higher availability. Here is the syntax to create aggr using dladm. You can use any number of data-link interfaces to create an aggr.
unixfoo-solaris # dladm create-aggr -l passive -d e1000g0 -d e1000g1 -d e1000g2 1
Now this creates and aggregate called "aggr1". You can plumb this, using "ifconfig plumb" and assign IP address to it. The Link aggregation must be configured on the network switch also. The policy and and aggregated interfaces must configured identically on the other end of the ethernet cables . The example creates Link Aggregation Control Protocol (LACP) in passive mode to control simultaneous transmission on multiple interfaces. Any single stream is transmitted completely on an individual interface, but multiple simultaneous streams can be active across all interfaces.
Check properties of an aggr:
unixfoo-solaris # dladm show-aggr
key: 1 (0x0001) policy: L4 address: XX:XX:XX:XX:XX (auto)
device address speed duplex link state
e1000g0 XX:XX:XX:XX:XX 0 Mbps half unknown standby
e1000g1 <unknown> 0 Mbps half unknown standby
e1000g2 <unknown> 0 Mbps half unknown standby
unixfoo-solaris #
To check statistics of aggr or data-link interfaces:
Use "-s" flag on show-aggr or show-link to see the statistics.
unixfoo-solaris # dladm show-aggr -s
key: 1 ipackets rbytes opackets obytes %ipkts %opkts
Total 0 0 0 0
e1000g0 0 0 0 0 - -
e1000g1 0 0 0 0 - -
e1000g2 0 0 0 0 - -
unixfoo-solaris #
unixfoo-solaris # dladm show-link -s
ipackets rbytes ierrors opackets obytes oerrors
vsw0 225644 94949 0 44916 29996 0
e1000g0 0 0 0 0 0 0
e1000g1 0 0 0 0 0 0
e1000g2 0 0 0 0 0 0
unixfoo-solaris #
To remove an interface from an link aggregate:
unixfoo-solaris # dladm remove-aggr -d e1000g2 1
unixfoo-solaris #
To delete an aggregate:
unixfoo-solaris # dladm delete-aggr 1
unixfoo-solaris #
Linux Logical Volume manager - basics
Logical Volume manager (LVM) creates an abstraction layer over physical storage, that allows us to create logical storage volumes. This provides much greater flexibility than using physical storage directly. A logical volume provides storage virtualization. With a logical volumes, you are not restricted to physical disk sizes. In addition, the hardware storage configuration is hidden from the software so it can be resized and moved without stopping applications.
This tutorial has info on how to create Logical volumes & snapshots using LVM commands.
LVM components: This diagram shows the components of LVM.

Initialize physical disks:
To make physical disks as part of LVM, the disks should be initialized first. "pvcreate" command is used to initialize physical disks. Let us say, you have 3 disks (/dev/sdb, /dev/sdc, /dev/sdd) and they are to be added to LVM. Use the pvcreate command as below to initialize the disks.
To list all the physical disks in LVM, you can use "pvdisplay" or "pvs" command.
Volume-group creation:
"vgcreate" command is used to create volume group out of the physical volumes. The vgcreate command creates a new volume group by name and adds at least one physical volume to it. The below command creates a volume group named "vg0" that contains physical volumes /dev/sdb, /dev/sdc and /dev/sdd.
To list all the volume groups created , use "vgdisplay" or "vgs" command.
[root@linux23 ~]# vgdisplay vg0
--- Volume group ---
VG Name vg0
System ID
Format lvm2
Metadata Areas 3
Metadata Sequence No 11
VG Access read/write
VG Status resizable
MAX LV 0
Cur LV 1
Open LV 0
Max PV 0
Cur PV 3
Act PV 3
VG Size 99.84 GB
PE Size 4.00 MB
Logical Volume creation:
To create a logical volume, use the "lvcreate"command. You can create linear volumes, striped volumes, and mirrored volumes. This unixfoo example shows you only the linear logical volumes. Say, let us create a 40G volume of name "myvol01". The command to create is ..
[root@linux23 ~]# lvcreate -L 40G -n myvol01 vg0
This creates logical volume of name "myvol01" of size "40G" on the volume group vg0. The logical volume can be accessed on device path "/dev/vg0/myvol01". You can display the properties of this logical volume using "lvdisplay" or "lvs" command. Now this volume is ready for filesystem creation - you can create ext2 or ext3 or any other linux filesystems on this using mkfs comamnd.
Snapshot of a Logical volume:
Snapshots are point-in-time or instantaneous copy of a logical volume. This is very helpful in cases like - instant backup of volume, online and accessible backup of volume, read-only copy of the volume, read-write copy of the volume. If you have a database or application that is running on the volume, the snapshot copy can be even used to debug and replicate the issues that occur on the application.
Snapshot is created using the same "lvcreate" command with "-s" flag. You have to specify the size of snapshot, the snapshot name, parent volume name and volume group. Here is how we create ..
[root@linux23 ~]# lvcreate -s -L 2GB -n myvol_snap /dev/vg0/myvol01.
This creates snapshot volume named "myvol_snap" , and the device path is /dev/vg0/myvol_snap. This is a read-write snapshot copy and you can mount it and read/write/modify the data in it. The data changed in snapshot volume or the parent volume doesnt affect one-other. You can monitor the percentage of snapshot change using "lvdisplay" and "lvs" commands.
Checkout the LVM overview presentation below
Find your network interface speed and duplex settings
Find details about the network interface card :
[root@linux-cloud ~]# ethtool eth0
Settings for eth0:
Supported ports: [ TP ]
Supported link modes: 10baseT/Half 10baseT/Full
100baseT/Half 100baseT/Full
1000baseT/Full
Supports auto-negotiation: Yes
Advertised link modes: 10baseT/Half 10baseT/Full
100baseT/Half 100baseT/Full
1000baseT/Full
Advertised auto-negotiation: Yes
Speed: 1000Mb/s <-- The network interface is capable of 1000Mbps
Duplex: Full
Port: Twisted Pair
PHYAD: 0
Transceiver: internal
Auto-negotiation: on
Supports Wake-on: d
Wake-on: d
Current message level: 0x00000007 (7)
Link detected: yes
[root@linux-cloud ~]#
Find the network link speed and duplex details :
[root@linux-cloud ~]# mii-tool -v
eth0: negotiated 100baseTx-FD, link ok <-- Shows 100Mbps & Full duplex
basic mode: autonegotiation enabled
basic status: autonegotiation complete, link ok
capabilities: 100baseTx-FD 100baseTx-HD 10baseT-FD 10baseT-HD
advertising: 100baseTx-FD 100baseTx-HD 10baseT-FD 10baseT-HD
link partner: 100baseTx-FD 100baseTx-HD 10baseT-FD 10baseT-HD
[root@linux-cloud~]#
chage: Linux account expiration details
Listing password aging for uxuser1
[root@cloud99 ~]# chage -l uxuser1
Minimum: 0
Maximum: 99999
Warning: 7
Inactive: -1
Last Change: Oct 05, 2008
Password Expires: Never
Password Inactive: Never
Account Expires: Never
Command usage :
[root@cloud99 ~]# chage
Usage: chage [options] user
Options:
-d, --lastday LAST_DAY set last password change to LAST_DAY
-E, --expiredate EXPIRE_DATE set account expiration date to EXPIRE_DATE
-h, --help display this help message and exit
-I, --inactive INACTIVE set password inactive after expiration
to INACTIVE
-l, --list show account aging information
-m, --mindays MIN_DAYS set minimum number of days before password
change to MIN_DAYS
-M, --maxdays MAX_DAYS set maximim number of days before password
change to MAX_DAYS
-W, --warndays WARN_DAYS set expiration warning days to WARN_DAYS
[root@cloud99 ~]#
Vmware 1.x server : vmware-cmd management utility
Register a Vmware vm : This command registers a VM and makes it available for startup.
[root@vmware21 ~]# vmware-cmd -s register /vm/linuxdev2/linuxdev2.vmx
[root@vmware21 ~]#
List all registered VMs.
[root@vmware21 ~]# vmware-cmd -l
/vm/linuxdev2/linuxdev2.vmx
You have to pass the vmx file as argument for all the below commands.
Poweron the VM.
[root@vmware21 ~]# vmware-cmd /vm/linuxdev2/linuxdev2.vmx start
Get current state of the VM.
[root@vmware21 ~]# vmware-cmd /vm/linuxdev2/linuxdev2.vmx getstate
getstate() = on
Gather other information on the VM.
[root@vmware21 ~]# vmware-cmd /vm/linuxdev2/linuxdev2.vmx getconnectedusers
Username IP
[root@vmware21 ~]# vmware-cmd /vm/linuxdev2/linuxdev2.vmx getuptime
getuptime() = 7498937
[root@vmware21 ~]# vmware-cmd /vm/linuxdev2/linuxdev2.vmx getremoteconnections
getremoteconnections() = 0
Power Management commands:
/usr/bin/vmware-cmd <cfg> start <powerop_mode>
/usr/bin/vmware-cmd <cfg> stop <powerop_mode>
/usr/bin/vmware-cmd <cfg> reset <powerop_mode>
For Vmware 2.0 CLI management, check out : http://unixfoo.blogspot.com/2008/11/vmware-20-cli-management-utility.html
Converting ext2 filesytem to ext3
Command for converting :
# tune2fs -j /dev/hda7
This adds journaling feature to ext2 and makes it ext3. Make sure this filesystem is not mounted. You can verify this by using tune2fs -l.
# tune2fs -l /dev/hda7 | grep features
Filesystem features: has_journal ext_attr resize_inode dir_index filetype needs_recovery sparse_super
#
AIX : Swap & Paging commands
bash-3.00# lsps -a
Page Space Physical Volume Volume Group Size %Used Active Auto Type
hd3 hdisk0 myvolvg 4000MB 77 yes yes lv
You can also see the paging details in "prtconf" command.
bash-3.00# prtconf
<cut here>
Paging Space Information
Total Paging Space: 3968MB
Percent Used: 4%
Volume Groups Information
==============================================================================
myvolvg:
PV_NAME PV STATE TOTAL PPs FREE PPs FREE DISTRIBUTION
hdisk0 active 320 68 xx..00..00..00..30
==============================================================================
Adding additional paging space : Use mkps command.
bash-3.00# mkps -a -n -s 32 myvolvg
paging00
bash-3.00#
Verify the newly added paging space:
Once added, you can see the paging space in /etc/swapspaces.
bash-3.00# cat /etc/swapspaces
* /etc/swapspaces
*
* This file lists all the paging spaces that are automatically put into
* service on each system restart (the 'swapon -a' command executed from
* /etc/rc swaps on every device listed here).
*
*
* This file is modified by the chps, mkps and rmps commands and referenced
* by the lsps and swapon commands.
hd3:
dev = /dev/hd3
paging00:
dev = /dev/paging00
Check the status using lsps command.
bash-3.00# lsps -a
Page Space Physical Volume Volume Group Size %Used Active Auto Type
paging00 hdisk0 myvolvg 4000MB 0 yes yes lv
hd3 hdisk0 myvolvg 4000MB 77 yes yes lv
bash-3.00#
Linux stress testing
Sample stress execution : A load average of four is imposed on the system by specifying two CPU-bound processes, one I/O-bound process, and one memory allocator process.
# stress --cpu 2 --io 1 --vm 1 --vm-bytes 128M --timeout 10s --verbose
stress: info: [9372] dispatching hogs: 2 cpu, 1 io, 1 vm, 0 hdd
stress: dbug: [9372] (243) using backoff sleep of 12000us
stress: dbug: [9372] (262) setting timeout to 10s
stress: dbug: [9372] (285) --> hogcpu worker 9373 forked
stress: dbug: [9372] (305) --> hogio worker 9374 forked
stress: dbug: [9372] (325) --> hogvm worker 9375 forked
stress: dbug: [9372] (243) using backoff sleep of 3000us
stress: dbug: [9372] (262) setting timeout to 10s
stress: dbug: [9372] (285) --> hogcpu worker 9376 forked
stress: dbug: [9375] (466) hogvm worker malloced 134217728 bytes
stress: dbug: [9372] (382) <-- worker 9374 signalled normally
stress: dbug: [9372] (382) <-- worker 9373 signalled normally
stress: dbug: [9372] (382) <-- worker 9375 signalled normally
stress: dbug: [9372] (382) <-- worker 9376 signalled normally
stress: info: [9372] successful run completed in 10s
Lightweight Window managers
FVWM : http://www.fvwm.org/
FVWM is the fastest, lightest and stable window manager available currently. This is designed to minimize memory consumption and provide a simple virtual desktop with basic graphics. FVWM is best suited for virtual desktops over network.
IceWM : http://www.icewm.org/
IceWM is fast, lightweight window manager. It is not a full-fledged desktop environment like KDE, GNOME, CDE or XFce. This consumes minimal memory footprint and less cpu cycles. The IceWM interface looks a lot like a simple Windows default desktop and it supports themes too. Being fairly minimalistic, it can be used simply as a environment to manage the dozens of terminal windows like xterm. IceWM is flexible and simple to customize.
Netapp hammer : Disk & Storage controller stress testing tool
Netapp nfsstat
Enable nfs per client stats.
Use "nfsstat -l" to display client statistics.
192.168.118.32 foo-sun01 NFSOPS = 14 ( 0%)
192.168.172.91 foo-ibm16 NFSOPS = 183 ( 0%)
192.168.172.92 foo-ibm17 NFSOPS = 188 ( 0%)
192.168.173.28 foo-ibm24 NFSOPS = 197 ( 0%)
192.168.129.2 lnx-xen1 NFSOPS = 21635 ( 0%)
192.168.129.106 lnx-xen2 NFSOPS = 20336 ( 0%)
192.168.168.25 lnx-xen3 NFSOPS = 1032 ( 0%)
192.168.168.49 lnx-tst1 NFSOPS = 232629 ( 1%)
192.168.168.68 lnx-tst2 NFSOPS = 27294 ( 0%)
192.168.168.70 lnx-tst3 NFSOPS = 66623 ( 0%)
192.168.168.113 lnx-dev1 NFSOPS = 794819 ( 3%)
192.168.168.116 lnx-dev2 NFSOPS = 812463 ( 4%)
192.168.168.119 lnx-dev3 NFSOPS = 4255082 ( 11%)
192.168.168.114 lnx-tmp4 NFSOPS = 13803 ( 0%)
[root@foo23 ~]#
