Tuesday, August 12, 2008

yum to update / install packages from an ISO(Linux)

yum (Yellow dog Updater Modified) is a package manager for RPM compatible Linux systems such as CentOS, Fedora core and latest Redhat Enterprise Linux.

So how do you use yum to update / install packages from an ISO of CentOS / FC / RHEL CD?

Creation of yum repositories is handled by a separate tool called createrepo, which generates the necessary XML metadata. If you have a slow internet connection or collection of all downloaded ISO images, use this hack to install rpms from iso images.

Step # 1: Mount an ISO file
Type the following command (replace iso file name with the actual iso file):
# yum install createrepo
# mkdir -p /mnt/iso/{1,2,3}
# mount -o loop /path/to/centos1.iso /mnt/iso/1
Step # 2: Create a repository
Use createrepo to generate the necessary XML metadata. Type the following commands:
# cd /mnt/iso
# createrepo .
Clean repo, enter:
# yum clean all
Step # 3: Create config file
You need to create a repo config file in /etc/yum.repos.d/ directory.
# vi /etc/yum.repos.d/iso.repo
Append following text:
[My ISO Repository]
baseurl=file:///mnt/iso
enabled=1
Save and close the changes.

Now use yum command to install packages from ISO images:
# yum install package-name

Add SWAP Space to Linux

Procedure to add a swap file
You need to use dd command to create swapfile. Next you need to use mkswap command to set up a Linux swap area on a device or in a file.

a) Login as the root user

b) Type following command to create 512MB swap file (1024 * 512MB = 524288 block size):
# dd if=/dev/zero of=/swapfile1 bs=1024 count=524288
c) Set up a Linux swap area:
# mkswap /swapfile1
d) Activate /swapfile1 swap space immediately:
# swapon /swapfile1
e) To activate /swapfile1 after Linux system reboot, add entry to /etc/fstab file. Open this file using text editor such as vi:
# vi /etc/fstab
Append following line:
/swapfile1 swap swap defaults 0 0
So next time Linux comes up after reboot, it enables the new swap file for you automatically.

g) How do I verify swap is activated or not?
Simply use free command:
$ free -m

Cycwin Installation and console access

click on setup.exe
Choose Install from Internet
Choose the defaults for this step (select Root Install Directory)
Choose the Local Package Directory (default should be the right one)
Choose Direct connection
choose http://mirrors.rcn.net
In the select packages Window ...scroll down to find +x11 and click on Default to

see package list
Choose X-start-menu-icons: Start menu icons for Cygwin/X Programs
proceed to install

============================================

run cygwin on client computer and type
startx on first popup window
type following on 2 pop up window prompt

xhost +

run following command on source servers where you want to bring display from.

export DISPLAY=172.16.134.177:0.0 (this is your client machine ip)

echo $DISPLAY

type /usr/openwin/bin/xclock this will bring up clock on client machine -- for test)