参考文章:
http://www.beyondlinux.com/2011/11/02/install-xen-4-1-and-setup-your-cloud-os-on-ubuntu-11-10/
http://bderzhavets.wordpress.com/2011/07/23/build-xen-4-1-1-on-ubuntu-11-10 (GFWed)
ubuntu从11.10开始内核版本号到3了,也从这个版本内核开始重新支持xen了,不必重新编译内核了.
1:准备工作
32位下:因为xen需要开启pae,默认是没有开启的,所以32位ubuntu首先得执行下面这个命令(64位无需此步):
# sudo apt-get install linux-image-server
2:安装xen hypervisor
# sudo apt-get install xen-hypervisor-4.1-i386 xen-utils-4.1 xenwatch xen-tools xen-utils-common xenstore-utils
也可用新力得(synaptic)找xen-hypervisor安装,直接处理相关软件
# vim /boot/grub/grub.cfg
就会看到启动列表里面就会有xen的启动项了
3:安装virt-manager
# sudo apt-get install virtinst virt-viewer virt-manager
重启,选择xen内核,检查xen的安装情况
# xm info
# brctl show
4:配置xend
# vim ~/.bashrc
在最后添加
export VIRSH_DEFAULT_CONNECT_URI=”xen:///”
#sudo vim /etc/xen/xend-config.sxp
去掉(xend-unix-server no)的注释,并改为
(xend-unix-server yes)
5:再次重启,选择xen内核,验证libvirt安装
# virsh version
Compiled against library: libvir 0.8.3
Using library: libvir 0.8.3
Using API: Xen 3.0.1
Running hypervisor: Xen 4.1.1
安装成功
1.创建一个磁盘镜像文件:
# dd if=/dev/zero of=test.img bs=1 count=1 seek=10G
2.格式化磁盘:
# mkfs.ext3 test.img
3.挂载刚刚创建的磁盘镜像文件:
# mount -o loop test.img /mnt
4.用virt-install安装
virt-install –connect xen:/// -n OneiricPV \
–nographics \
-p -r 2048 –vcpus=2 -f /dev/sdb6 \
-l http://ca.archive.ubuntu.com/ubuntu/dists/oneiric/main/installer-amd64/