Ref: Xen4 CentOS6 QuickStart & Xen4 Libvirt for CentOS 6.
Build Xen Server
The IP address of the Xen server (a Dell PC) is 10.32.1.112. First install CentOS 6.4 via Minimal CD (or LiveDVD) and install Xen on the new OS;
yum update
yum groupinstall Virtualization
yum install centos-release-xen // unnecessary if install OS with LiveDVD
yum install xen bridge-utils
/usr/bin/grub-bootxen.sh
reboot
yum install libvirt python-virtinst libvirt-daemon-xen
yum install rsync wget vim-enhanced openssh-clients // unnecessary if install OS with LiveDVD
reboot
uname -r // the kernel should be 3.x
xm info
useradd -m chad
groupadd remote-libvirt
usermod -G remote-libvirt chad
cat > /etc/polkit-1/localauthority/50-local.d/50-libvirt-remote-access.pkla <<EOF
[Remote libvirt SSH access]
Identity=unix-group:remote-libvirt
Action=org.libvirt.unix.manage
ResultAny=yes
ResultInactive=yes
ResultActive=yes
EOF
Config network
Modify dom0 host file /etc/xen/xend-config.sxp:
Comment out "(network-script /bin/true)" to "(network-script 'network-bridge bridge=virbr0 netdev=eth0')".
Build Xen Client
We usually do not work on a Xen dom0 server. So here we install xen client on a Mint OS, and control Xen server with it:
GUI Client
First install with sudo aptitude install virt-manager
, then run it with virt-manager
. The "Virtual Machine Manager" window appears.
[File -> Add Connection]: Hypervisor: Xen, check "Connect to remote host", Method: SSH, Username: root, Hostname: 10.32.1.112, click "Connect".
[Edit -> Connect Details -> Storage], Location: /var/lib/libvirt/images. So copy an OS image file (here it's CentOS-6.5-x86_64-minimal.iso) to this folder, and press the refresh button after "Volumns", the ISO file appears.
Click "New" on toolbar, Name: Cloud21, check "Local install media" -> Use ISO image: /var/lib/libvirt/images/CentOS-6.5-x86_64-minimal.iso, OS type: Linux, Version: Red Hat Enterprise Linux 6 -> Memory: 1024 MB, CPUs: 1 -> Create a disk image ...: 8.0 GB.
Now install CentOS with Minimal ISO file.
Console Client
sudo aptitude install libvirt-bin
virsh -c xen+ssh://chad@10.32.1.112