CentOS 5.1 with Xen Virtualization
At a start, install CentOS minimal installation
Update OS using yum
yum -y update
Install NTP for time sync (Xen HOST only)
yum -y install ntp
sed -i -e 's/^restrict -6/#restrict -6/' /etc/ntp.conf
ntpdate pool.ntp.org
hwclock --systohc
/etc/rc.d/init.d/ntpd start
chkconfig ntpd on
Reboot with lastest patches
reboot
Install Xen and Xen Kernel
yum -y install xen kernel-xen
Enable booting Xen Kernel
sed -i -e 's/^default=1/default=0/' /boot/grub/grub.conf
Reboot for new XEN kernel
reboot
Commands for LVM creation
pvcreate /dev/sdax
vgcreate vg0 /dev/sdax
lvcreate -n vm01 --size 6g vg0
lvcreate -n vm02 --size 6g vg0
Sample config for VM01 to be save to: /etc/xen/vm01
name = "vm01"
disk = [ "phy:/dev/vg0/vm01,xvda,w" ]
maxmem = 512
memory = 512
vcpus = 2
bootloader = "/usr/bin/pygrub"
vif = [ "bridge=xenbr0" ]
Populate the Xen VM partition with minimal OS
fdisk /dev/vg0/vm01
kpartx -v -a /dev/vg0/vm01
mkswap -L SWAP-xvda1 /dev/mapper/vm01p1
mkfs.ext3 /dev/mapper/vm01p2
e2label /dev/mapper/vm01p2 /
mkdir /foo
mount /dev/mapper/vm01p2 /foo
tar -C /foo --numeric-owner -zxpf /tmp/xen-guest-centos5-minimal.tgz
umount /foo
rmdir /foo
kpartx -v -d /dev/vg0/vm01
Start /etc/xen/vm01 and attach to console of vm01
xm create vm01 -c
Comments
Post a Comment