Centos-3 on Xen

From ConShell
Jump to navigation Jump to search

Important.gif This page contains outdated content. YMMV. Use at your own risk


Here are the commands I used to bootstrap a basic centos3 system. It is important to realize this bootstrapping was done on a centos3 system, so things like yum, rpm and so on worked as expected. I initially tried the same procedure on a debian box and it did not go so well.

In any case, the "it takes one to know one" cliche held true.

mkdir -p /tmp/buildroot
cd /tmp/buildroot
dd if=/dev/zero of=diskimage bs=1024k count=750
mkfs.ext3 diskimage
 diskimage is not a block special device.
 Proceed anyway? (y,n) y
mkdir -p /mnt/disk
mount -o loop diskimage /mnt/disk

Now we have a fresh, blank disk image (inside a file called diskimage), time to bootstrap the operating system into it.

wget ftp://ftp.osuosl.org/pub/centos/3.7/os/i386/RedHat/RPMS/centos-release-3-7.1.i386.rpm
rpm --root /mnt/disk/ --initdb
rpm --root /mnt/disk/ -ivh --nodeps centos-release-3-7.1.i386.rpm

The correct GPG keys must be installed - the "takes one to know one" rule applies here!

rpm --root /mnt/disk/ --import /usr/share/doc/centos-release-3/RPM-GPG-KEY
rpm --root /mnt/disk/ --import /usr/share/doc/centos-release-3/RPM-GPG-KEY-CentOS-3

Install the "Base" group of RPM packages using yum. This assumes your yum repo(s) are setup correctly.

 yum --installroot=/mnt/disk/ -y groupinstall Base
 ...
 (filesystem, basesystem and setup are installed, then 267 addl. packages)
 ...
 Transaction(s) Complete

Make necessary devices

 /dev/MAKEDEV -d /mnt/disk/dev console 
 /dev/MAKEDEV -d /mnt/disk/dev null
 /dev/MAKEDEV -d /mnt/disk/dev zero
 /dev/MAKEDEV -d /mnt/disk/dev random

Setup /mnt/disk/etc/fstab as shown

 /dev/sdb1     /     ext3     errors=remount-ro     0     1
 /dev/sdb2     none  swap     sw                    0     0
 proc          /proc proc     defaults              0     0
 none                    /dev/pts                devpts  gid=5,mode=620  0 0

Cleanup /lib/tls

mv /mnt/disk/lib/tls /mnt/disk/lib/tls.disabled

Unmount and finish

 umount /mnt/disk

Now diskimage is ready to use!

Actual space used= 528344