yumdownloader --source libvirt
rpm -i libvirt-0.8.1-27.el6_0.6.src.rpm # 版本可能不同
cd ~/rpmbuild/SPECS/
vi libvirt.spec # 按下面的patch修改
rpmbuild -bb libvirt.spec
cd ~/rpmbuild/RPMS/x86_64/
rpm -Uvh libvirt-*0.8.1*.rpm
Patch:
--- libvirt.spec.orig 2010-08-18 15:02:53.000000000 +0300
+++ libvirt.spec 2010-11-15 14:17:36.388996162 +0200
@@ -104,7 +104,7 @@
%ifnarch x86_64
%define with_qemu 0
%endif
-%define with_xen 0
+%define with_xen 1
%endif
# If Xen isn't turned on, we shouldn't build the xen proxy either
6. 安装python-virtinst,旧的版本不支持的参数太多了
# 从redhat网站下载srpm
wget http://ftp.redhat.com/redhat/linux/enterprise/6Server/en/os/SRPMS/python-virtinst-0.500.5-3.el6.src.rpm
rpm -i python-virtinst-0.500.5-3.el6.src.rpm
cd ~/rpmbuild/SPECS/
rpmbuild -bb python-virtinst.spec
cd ~/rpmbuild/RPMS/noarch/
rpm -Uvh --force python-virtinst-*.rpm
7. 编译安装内核
# 从github下载内核
wget https://github.com/jsgf/linux-xen/tarball/xen-2.6.32.46 -O kernel-xen-2.6.32.46.tar.gz
# 下载config
wget http://pasik.reaktio.net/xen/kernel-config/config-2.6.32.43-pvops-dom0-xen-stable-x86_64
# 可以先修改config里面的CONFIG_LOCALVERSION项, 给这个内核起个别名, 比如-dom0-xen, 以下为没有修改的情况
tar xzf kernel-xen-2.6.32.46.tar.gz
cp config-2.6.32.43-pvops-dom0-xen-stable-x86_64 jsgf-linux-xen-1c3f03c/.config
cd jsgf-linux-xen-1c3f03c
make oldconfig
make -j4 bzImage
make -j4 modules
make modules_install
depmod -a 2.6.32.46
cp -a arch/x86/boot/bzImage /boot/vmlinuz-2.6.32.46
cp -a System.map /boot/System.map-2.6.32.46
cp -a .config /boot/config-2.6.32.46
cd /boot/
dracut --force initramfs-2.6.32.46.img 2.6.32.46
# 关闭ksm, 跟xen不兼容
chkconfig ksm off
chkconfig ksmtuned off
8. 编辑/boot/grub/menu.lst, 添加
title Xen 4.0 with Linux 2.6.32.46
root (hd0,0)
kernel /xen.gz dom0_mem=2048M loglvl=all guest_loglvl=all
module /vmlinuz-2.6.32.46 ro root=/dev/sda2 rd_NO_LUKS rd_NO_LVM rd_NO_MD rd_NO_DM KEYBO
ARDTYPE=pc KEYTABLE=us SYSFONT=latarcyrheb-sun16 LANG=en_US.UTF-8 nomodeset
module /initramfs-2.6.32.46.img