Xen Quick Start
This quick start guide is aim a people who would like to get a virtual machine running with out caring too much about the details. For more detailed information please read the official
Xen Documentation
Preparing the Host on SL4
Disable kudzu:
service kudzu stop
chkconfig --del kudzu
Configure NTP and ensure ntpd is running
lcm --configure ntpd
chkconfig ntpd on
service ntpd restart
Disable SELinux
Edit /etc/sysconfig/selinux and ensure
SELINUX=disabled
Install yum config for SLC4/i386 dom0/domU:
rpm -ivh http://linuxsoft.cern.ch/cern/xen/slc4X/i386/RPMS/yum-xen-conf-4X-1.slc4.cern.noarch.rpm
Or for x86_64:
rpm -ivh http://linuxsoft.cern.ch/cern/xen/slc4X/x86_64/RPMS/yum-xen-conf-4X-1.slc4.cern.noarch.rpm
Install xen/kernel-xen:
yum install xen kernel-xen
Configure the Xen daemon to start automatically:
chkconfig --add xend
service xend start
chkconfig --add xendomains
service xendomains start
Ensure that check that /boot/grub/grub.conf will boot the Xen kernel by default.
Reboot the system to load the xen kernel
shutdown -r now
Enabling a NAT for the VNs
Edit the configuration file
/etc/xen/xend-config.sxp , comment out all the bridge networking settings and add the following
(network-script network-nat)
(vif-script vif-nat)
Preparing the Guest - tarball method
Create the required partitions
lvcreate --size 10G --name node-01-root vg1
lvcreate --size 500M --name node-01-swap vg1
mkfs.ext3 /dev/vg1/node-01-root
mkswap /dev/vg1/node-01-swap
Create the root filesystem from the tarball
mount /dev/vg1/node-01-root /mnt/
tar zxvf SLC-4-x86.tar.gz -C /mnt/
umount /mnt/
Create the guest configuration file /etc/xen/node-01 - Using NAT
name = "node-01"
memory = 512
disk = [ 'phy:/dev/vg1/node-01-root,xvda1,w','phy:/dev/vg1/node-01-swap,xvda2,w' ]
root = "/dev/xvda1 ro"
vif = [ 'ip=10.0.0.1' ]
bootloader="/usr/bin/pygrub"
on_reboot = 'restart'
on_crash = 'restart'
on_poweroff = 'destroy'
Add the IP and hostname to the /etc/hosts on Dom0
10.0.0.1 node-01.cern.ch node-01
Start the VM
xm create node-01
Connect to the VM to set up networking.
xm console node-01
ifconfig eth0 10.0.0.1 up
route add default gw 10.0.0.254
Using Xen
Initialize the guest VM
xm create node-01
List running VMs
xm list
Stop a VM
xm destroy node-01
To exit from the console
ctr-]
--
LaurenceField - 23 Jun 2008