且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

XEN 虚拟机安装

更新时间:2022-09-03 16:18:14


VT安装准备:

#vim server.repo

[base]

name=Red Hat Enterprise Linux 5Server - i386 - base

baseurl=ftp://192.168.0.254/pub/RHEL5U3/Server

enabled=1

gpgcheck=1

gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release

[VT]

name=Red Hat Enterprise Linux 5Server - i386 - VT

baseurl=ftp://192.168.0.254/pub/RHEL5U3/VT

enabled=1

gpgcheck=1

gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release

~                                                          

#yum clean all

#yum update

#yum grouplist

#yum groupinstall Virtualiation

# vim /etc/xen/xend-config.sxp 

(dom0-min-mem 128)

#service xend restart

文本方式安装虚拟域方法如下:

# virt-install

system1

512            xen最小化安装,虚拟机内存不可低于256

/var/lib/xen/images/system1.image      如果开启selinux必须安装在此目录

6

no

nfs:192.168.0.254:/var/ftp/pub/RHEL5U4

#ctrl ]      中途退出

#xm console system1    登录系统

#xm create -c system1  启动系统

#virt-manager     启动虚拟机管理器


图形安装虚拟域方法如下:

#virt-install

system1

512            xen最小化安装,虚拟机内存不可低于256

/var/lib/xen/images/system1.image      如果开启selinux必须安装在此目录

6

yes

>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

拷贝生成新的系统:

#poweroff

#cd /var/lib/xen/images

#cp system1.img system2.img

#cd /etc/xen

#cp system1 system2

#vim system2                 修改name/uuid/disk/vif参数


增加虚拟网卡:

#vim /etc/xen/system2

vif = [ "mac=00:17:3e:09:8f:df,bridge=xenbr0","mac=00:18:3e:09:8f:df,bridge=xenbr0" ]


增加disk设备:

#cd /var/lib/xen/

#dd if=/dev/zero of=./bigfile.img bs=512 count=1 seek=400000

#vim /etc/xen/system2

disk = [ "tap:aio:/var/lib/xen/images/system2.img,xvda,w",

"tap:aio:/var/lib/xen/images/bigfile.img,sda,w" ]


>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

系统启动自动启动虚拟机:

#cd /etc/xen

#ln -sv /etc/xen/system1 ./auto/system1



图形化安装系统没有console接口,需要手动添加:

修改grub.conf

 kernel /vmlinuz-2.6.18-164.el5xen ro root=/dev/VolGroup00/LogVol00  console=xvc0

修改inittab:

co:2345:respawn:/sbin/agetty xvc0 9600 vt100-nav



文本化安装系统没有vnc图形化连接,设置:

#vim /etc/xen/system1

vfb = [ "type=vnc,vncunused=1"  ]



本文转自 xxl714 51CTO博客,原文链接:http://blog.51cto.com/dreamgirl1314/1606121,如需转载请自行联系原作者