- Download the CentOS 5.1 image from jailtime. http://jailtime.org/download:centos:v5.1
- Untar the image:
- Create directories under /mnt to mount image your downloaded from jailtime and in our case lvm parition.
- Mount jailtime image and lvm partition image.
- Copy the image files to our VM image i.e on lvm parition.
- Configure IP for domU. I don’t think I need to explain this step.
- Configure domU hostname.
- For me the xm console never worked until I have used this line in /mnt/vm/etc/inittab, I hope you know where to put following line in /mnt/vm/etc/inittab, other wise learn about inittab first please.
- root logins are not allowed on default jailtime image, so if you need them you can enable them too, or if you change your SSH port to something unusual you can do that too in /mnt/vm/etc/ssh/sshd_config change following:
- Unmount both images.
- Create initrd image for your domU
- Create a xen config file, as I was using LVM partition so my config file will look bit different.
- Start your domU
- You will see a nice login prompt like following:
- Login as root, default root password for jailtime image is “password”
- Change your root password first
- Enter nameservers in /etc/resolv.conf
- Now this small CentOS 5.1 image likes many usefult softwares, few of which I really like and need I will install here. If you don’t find your favourite software you know how to install it right?
- Now your VM is ready to be used.
At the time of writing this howto the current image file name is: centos.5-1.20080125.img.tar.bz2
# tar -xjf centos.5-1.20080125.img.tar.bz2
# mkdir /mnt/img
# mkdir /mnt/vm
# mount -o loop centos.5-1.img /mnt/img
# mount /dev/vg/ComC /mnt/vm
# cp -a /mnt/img/* /mnt/vm/
cat /mnt/vm/etc/sysconfig/network-scripts/ifcfg-eth0
TYPE=Ethernet
DEVICE=eth0
ONBOOT=yes
BOOTPROTO=static
IPADDR=192.168.1.10
NETMASK=255.255.255.0
GATEWAY=192.168.1.254
[root@aag ~]# cat /mnt/vm/etc/sysconfig/network
NETWORKING=yes
HOSTNAME=complay
1:2345:respawn:/sbin/mingetty console
Port 2023
PermitRootLogin yes
# umount /mnt/img /mnt/vm
# mkinitrd /boot/xen-guest-initrd `uname -r` --with xenblk --with xennet --preload xenblk --preload xennet
My domU config file looks like following:
[root@aag xen]# cat complay.cfg
kernel = “/boot/xen-vm-kernel”
ramdisk = “/boot/xen-guest-initrd”
name = “complay”
memory = “128″
disk = [ 'phy:vg/ComC-swap,sda2,w', 'phy:vg/ComC,sda1,w' ]
vif = [ 'mac=00:14:d1:3e:F9:f1', ]
root = “/dev/sda1 rw”
vcpus=1
on_reboot = ‘restart’
on_crash = ‘destroy’
# xm create -c /etc/xen/complay.cfg
CentOS release 5 (Final)
Kernel 2.6.18-8.1.14.el5xen on an i686complay login:
# yum -y install logwatch postfix vim-enhancd iptables anacron
Possible Errors
If you get following Error:
Error: destroyDevice() takes exactly 3 arguments (2 given)
Make sure you have unmounted your image: umount /mnt/vm