分类: LINUX
2008-08-28 10:12:14
Because of the Problematic in the Xen-tools/rmpstrap-Method I had to find another way to get CentOS 5 running underXEN on Debian etch.
Although xen-tools will create centos4 guest Xen VM’s, it did not work well. Just as a debian system can be debootstrap’d Debian Etch has a “rpmstrap” package on apt which is meant to make creating a new install easier. There were problems providing a correct Centos mirror along with other issues. There was also little information on rpmstrapping Centos on Etch. The only guide available was: and was a little outdated.
So i decided to find my own Way and had chosen the Centos5 Xen Install image-Method Either xen-tools or a manual xen domU creation (manually using rpmstrap) didn’t work. As a result, a prebuilt minimal Xen domU install image was chosen. provides Virtual filesystems for Xen and worked a treat. Note: The Xen images are file based Xen Images which are not intended for production use. The has instructions for moving a file based domU to a LVM/Disk based partition.
First download a prebuilt CentOS5-Image from . Then start a Terminal as root
# cd /home/xen/domains
# mkdir cent5
# bunzip2 /path/to/download/centos.5-0.20070424.img.tar.bz2
# tar -xvf /path/to/download/centos.5-0.20070424.img.tar
# mv /path/to/download/centos.* cent5/
# rm centos.5-0.xen2.cfg
Its only a basic config. The following config will suffice:
# vim /etc/xen/xen-cent5.cfg
name = 'cent5'
#
# Kernel + memory size
#
kernel = '/boot/vmlinuz-2.6.19-4-generic'
ramdisk = '/boot/initrd.img-2.6.19-4-generic'
memory = '128'
#
# Disk device(s).
#
root = '/dev/sda1 ro'
disk = [ 'file:/home/xen/domains/cent5/centos.5-0.img,sda1,w', 'file:/home/xen/domains/cent5/centos.swap,sda2,w' ]
#
# Networking
#
dhcp = 'dhcp'
vif = [ '' ]
#
# Behaviour
#
on_poweroff = 'destroy'
on_reboot = 'restart'
on_crash = 'restart'
# ln -s /etc/xen/domains/cent5 /etc/xen/auto/
# xm /etc/xen/cent5.cfg -c
The -c is to attach a console. Very handy for when booting for the first time.
The Cent-Guest is booting up with lots of errors because of the missing kernel-modules. So log on and shutdown.
# shutdown -h now
If this was a debian domU, we would “apt-get install linux-image-2.6-xen-686” to provide the correct kernel modules in /lib/modules/. In this case, I done:
# mount -o loop /home/xen/domains/cent5/centos.5-0.img /mnt/
# cp -r /lib/modules/2.6.19-4-generic/ /mnt/lib/modules/
# umount /mnt/
After that we can fire up our cent-domain
# xm create /etc/xen/xen-cent5.cfg -c
The default login is:
username: root
password: password
Although root is not permitted to ssh in via Centos default, the above password needs to be changed asap. Use “passwd” to change it.