Centos6下源代码安装Xen4.1.2

Centos6.0开始不再支持xen,因此如果是Centos6的话安装xen的话就不再像以前那样几个命令就能搞定了。总体来说需要如下几个步骤

1、  编译xen4.1.2

2、  编译支持xenlinux内核

3、  重新编译libvirtd,因为Centos6上默认的libvirtd不支持xen

4、  升级iptables以及bridge-util

 

首先,我们来看如何编译xen4.1.2

我安装的版本缺少了如下package(其实如果出错了,缺啥就安装啥就行了,无非是时间长了点儿)

uuid-dev

yum install -y uuid-devel.x86_64 libuuid-devel.x86_64

 

dev86

yum install -y dev86.x86_64

 

iasl

yum install -y iasl.x86_64

 

texinfo

yum install –y texinfo.x86_64

 

wget http://bits.xensource.com/oss-xen/release/4.1.2/xen-4.1.2.tar.gz

tar xzf xen-4.1.2.tar.gz

cd xen-4.1.2

make world

make install

 

修改/etc/xen/xend-config.sxp

(xend-http-server yes)

(xend-unix-server yes)

 

/etc/sysconfig/module下放入如下文件

#!/bin/sh

 

test -d /proc/xen                               || exit 0

test -f /proc/xen/capabilities                  || mount -t xenfs xen /proc/xen

test -f /proc/xen/capabilities                  || exit 0

grep -q "control_d" /proc/xen/capabilities      || exit 0

 

for module in xen-evtchn evtchn xen-gntdev gntdev xen-blkback xen-netback blkbk netbk blktap; do

        modprobe ${module} >/dev/null 2>&1

done

 

接下来看一下如何编译libvirtd

我系统上需要如下package

 

device-mapper-devel

yum install –y device-mapper-devel.x86_64

 

libnl-devel

yum install -y libnl-devel.x86_64

 

wget http://libvirt.org/sources/libvirt-0.9.11.3.tar.gz

tar –xzf libvirt-0.9.11.3.tar.gz

./configure --prefix=/usr --localstatedir=/var --sysconfdir=/etc --with-xen --with-xen-inotify  --with-libxl

make

make install

 

安装完之后利用service libvirtd start结果发现报错,这是因为原来的libvirtd版本太低导致的,应该把原来的卸载

 

编译支持xenlinux内核

git clone git://git.kernel.org/pub/scm/linux/kernel/git/jeremy/xen.git linux-2.6-xen

cd linux-2.6-xen

git checkout -b xen/next-2.6.32 origin/xen/next-2.6.32

wget -O .config http://pasik.reaktio.net/xen/kernel-config/config-2.6.32.25-pvops-dom0-xen-stable-x86_64

make oldconfig

make -j4 bzImage && make -j4 modules && make modules_install

depmod -a 2.6.32.57

cp -a arch/x86/boot/bzImage /boot/vmlinuz-2.6.32.57

cp -a System.map /boot/System.map-2.6.32.57

cp -a .config /boot/config-2.6.32.57

dracut initramfs-2.6.32.57.img 2.6.32.57

 

接下来是修改/etc/grub.conf

增加如下行

title CentOS with Xen (2.6.32.57.x86_64)

        root (hd0,0)

        kernel /xen.gz

        module /vmlinuz-2.6.32.57 ro root=UUID=63b4f94b-abc7-4736-b87e-884a048d0c58 rd_NO_LUKS rd_NO_LVM rd_NO_MD rd_NO_DM LANG=

zh_CN.UTF-8 KEYBOARDTYPE=pc KEYTABLE=us nomodeset crashkernel=128M rhgb quiet

        module /initramfs-2.6.32.57.img

 

编译bridge-utils相对比较容易

git clone git://git.kernel.org/pub/scm/linux/kernel/git/shemminger/bridge-utils.git

autoconf

./configure --prefix=/usr

make

make install

 

你可能感兴趣的:(centos,Module,git,service,xen,linux内核)