centos安装xen
本文简介以yum方式在centos5.5中安装xen虚拟机以及虚拟机配置相关操作。1.关闭selinux
2.安装xen
只需要简单的命令即可:yum install xen kernel-xen
安装完成后编辑/boot/grub/menu.lst文档,修改启动项为xen
# grub.conf generated by anaconda## Note that you do not have to rerun grub after making changes to this file# NOTICE:You have a /boot partition.This means that# all kernel and initrd paths are relative to /boot/, eg.# root (hd0,0)#
kernel /vmlinuz-version ro root=/dev/VolGroup00/LogVol00# initrd /initrd-version.img#boot=/dev/sdadefault=0timeout=5splashimage=(hd0,0)/grub/splash.xpm.gzhiddenmenutitle CentOS (2.6.18-164.6.1.el5xen) root (hd0,0) kernel /xen.gz-2.6.18-164.6.1.el5
module /vmlinuz-2.6.18-164.6.1.el5xen ro root=/dev/VolGroup00/LogVol00 module /initrd-2.6.18-164.6.1.el5xen.imgtitle CentOS (2.6.18-164.el5) root (hd0,0) kernel /vmlinuz-2.6.18-164.el5 ro root=/dev/VolGroup00/LogVol00 initrd /initrd-2.6.18-164.el5.img
最后,reboot重启,进入xen
3.安装虚拟机
这里安装centos作为虚拟机
本文以ftp方式安装,也可以以其他方式。
安装ftp:yum install vsftp
启动ftp: /etc/init.d/vsftpd start
装在镜像: mount /dev/cdrom /var/ftp/pub
然后用virt-install工具安装
创建目录vm:mkdir vm, 可以在其他目录中。
virt-install --prompt,根据向导创建。
注意,这这里第一步是否全虚拟化,选择no
内存大小最小为256M
Would you like a fully virtualized guest (yes or no)? This will allow you to run unmodified operating systems. <-- no
What is the name of your virtual machine? <-- vm01
How much RAM should be allocated (in megabytes)? <-- 256
What would you like to use as the disk (file path)? <-- /vm/vm01.img
How large would you like the disk (/vm/vm01.img) to be (in gigabytes)? <-- 4
Would you like to enable graphics support? (yes or no) <-- no
What is the virtual CD image, CD device or install location? <--
ftp://x.x.x.x/pub
至此可以安装centos。
virt-install 建立了一个 vm01 的配置文件 /etc/xen/vm01
cat /etc/xen/vm01
name = "vm01"
uuid = "986d8b21-906f-8d64-bdc4-a6098e75cf23"
maxmem = 256
memory = 256
vcpus = 1
bootloader = "/usr/bin/pygrub"
on_poweroff = "destroy"
on_reboot = "restart"
on_crash = "restart"
vfb = []
disk = [ "tap:aio:/vm/vm01.img,xvda,w" ]
vif = [ "mac=00:16:3e:08:fc:38,bridge=xenbr0" ]
最后,可以通过xm命令管理虚拟机。
版权声明:本文为博主原创文章,未经博主允许不得转载。
页:
[1]