xen安装


二、在CentOS5.8_x64位系统上安装Xen虚拟机


1.查看CPU是否支持完全虚拟化和半虚拟化



view sourceprint?

1.

[root@Vmware5 ~]# cat /proc/cpuinfo | grep flags

2.

flags           : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts mmx fxsr sse sse2 ss syscall nx rdtscp lm constant_tsc up nonstop_tsc arat pni ssse3 cx16 sse4_1 sse4_2 popcnt lahf_lm

注意:确保CPU支持xen虚拟化。半虚拟化需要pae,全虚拟化需要intel VT或者AMD PT的支持、包含pae,那么就支持半虚拟化。如果包含vmx(intel)或者svm(AMD),那么就支持全虚拟化。


2.查看系统和内核版本信息



view sourceprint?

1.

[root@Vmware5 ~]# uname -a

2.

<a href="http://www.it165.net/os/oslin/" target="_blank" class="keylink">Linux</a> Vmware5 2.6.18-308.el5 #1 SMP Tue Feb 21 20:06:06 EST 2012 x86_64 x86_64 x86_64 GNU/Linux

3.

[root@Vmware5 ~]# lsb_release -a

4.

LSB Version:    :core-4.0-amd64:core-4.0-ia32:core-4.0-noarch:graphics-4.0-amd64:graphics-4.0-ia32:graphics-4.0-noarch:printing-4.0-amd64:printing-4.0-ia32:printing-4.0-noarch

5.

Distributor ID: CentOS

6.

Description:    CentOS release 5.8 (Final)

7.

Release:        5.8

8.

Codename:       Final

view sourceprint?

1.

3.查看下是否已经安装xen软件包

2.

[root@Vmware5 ~]# rpm -qa | grep xen

3.

[root@Vmware5 ~]#

4.安装xen kernel-xen两个包,查看下是否安装成功

 


view sourceprint?

1.

[root@Vmware5 ~]# yum install -y xen kernel-xen

2.

[root@Vmware5 ~]# rpm -qa | grep xen

3.

xen-libs-3.0.3-142.el5_9.3

4.

kernel-xen-2.6.18-348.18.1.el5

5.

xen-3.0.3-142.el5_9.3

此时,再查看下boot目录下生成了几个带xen的文件

 


view sourceprint?

01.

[root@Vmware5 ~]# ls /boot/

02.

config-2.6.18-308.el5              symvers-2.6.18-348.18.1.el5xen.gz

03.

config-2.6.18-348.18.1.el5xen      System.map-2.6.18-308.el5

04.

grub                               System.map-2.6.18-348.18.1.el5xen

05.

initrd-2.6.18-308.el5.img          vmlinuz-2.6.18-308.el5

06.

initrd-2.6.18-348.18.1.el5xen.img  vmlinuz-2.6.18-348.18.1.el5xen

07.

lost+found                         xen.gz-2.6.18-348.18.1.el5

08.

message                            xen-syms-2.6.18-348.18.1.el5

09.

symvers-2.6.18-308.el5.gz

5.修改XENlinux的GRUB配置

 


view sourceprint?

01.

(1)修改GRUB引导文件

02.

[root@Vmware5 ~]# more /boot/grub/grub.conf

03.

# grub.conf generated by anaconda

04.

#

05.

# Note that you do not have to rerun grub after making changes to this file

06.

# NOTICE:  You have a /boot partition.  This means that

07.

#          all kernel and initrd paths are relative to /boot/, eg.

08.

#          root (hd0,0)

09.

#          kernel /vmlinuz-version ro root=/dev/sda5

10.

#          initrd /initrd-version.img

11.

#boot=/dev/sda

12.

default=0

13.

timeout=5

14.

splashimage=(hd0,0)/grub/splash.xpm.gz

15.

hiddenmenu

16.

pass<a href="http://www.it165.net/edu/ebg/" target="_blank" class="keylink">word</a> --md5 $1$NGwpqBcK$qw1kGlKiVS2XXgwiIWW/C0

17.

title CentOS (2.6.18-348.18.1.el5xen)

18.

root (hd0,0)

19.

kernel /xen.gz-2.6.18-348.18.1.el5

20.

module /vmlinuz-2.6.18-348.18.1.el5xen ro root=LABEL=/ rhgb quiet

21.

module /initrd-2.6.18-348.18.1.el5xen.img

22.

title CentOS (2.6.18-308.el5)

23.

root (hd0,0)

24.

kernel /vmlinuz-2.6.18-308.el5 ro root=LABEL=/ rhgb quiet

25.

initrd /initrd-2.6.18-308.el5.img

26.

把原始文件的default=1修改成default=0

27.

然后reboot重启服务器

重启完毕后,再查看下系统版本

 


view sourceprint?

1.

[root@Vmware5 ~]# uname -a

2.

Linux Vmware5 2.6.18-348.18.1.el5xen #1 SMP Thu Sep 26 15:42:15 EDT 2013 x86_64 x86_64 x86_64 GNU/Linux

从显示的版本中可以看出,内核版本中出现了xen字样


6.安装图形管理工具和图形终端的两个软件包:virt-manager和virt-viewer



view sourceprint?

1.

[root@Vmware5 ~]# yum install -y virt-manager

2.

[root@Vmware5 ~]# yum install -y virt-viewer

7.创建Xen虚拟系统安装树


Xen虚拟机半虚拟环境中安装Linux虚拟系统时需要使用系统的安装树。安装树是一个包含所有系统安装文件及相关程序的目录,这个目录可以是FTP、httpd或者是NFS等方式提供给Xen虚拟机用于系统的安装


这里为了方便,就用httpd,安装apache服务。



view sourceprint?

1.

[root@Vmware5 ~]# yum install -y httpd

8.在apache的默认网站根目录下,创建centos目录

 


view sourceprint?

1.

[root@Vmware5 ~]# mkdir /var/www/html/centos

9.mount挂载5.8的镜像


 


view sourceprint?

01.

[root@Vmware5 ~]# mount -o loop /dev/cdrom /var/www/html/centos

02.

[root@Vmware5 ~]# df -h

03.

Filesystem            Size  Used Avail Use% Mounted on

04.

/dev/sda5             7.4G  3.1G  3.9G  44% /

05.

/dev/sda2             2.0G   36M  1.9G   2% /home

06.

/dev/sda1             190M   20M  161M  11% /boot

07.

tmpfs                 432M     0  432M   0% /dev/shm

08.

none                  432M  104K  432M   1% /var/lib/xenstored

09.

/dev/hdc              4.3G  4.3G     0 100% /var/www/html/centos

10.关闭iptables和selinux,并且启动httpd服务。

 


view sourceprint?

01.

[root@Vmware5 ~]# /etc/init.d/iptables stop

02.

Flushing firewall rules:                                   [  OK  ]

03.

Setting chains to policy ACCEPT: nat filter                [  OK  ]

04.

Unloading iptables modules:                                [  OK  ]

05.

[root@Vmware5 ~]# setenforce 0

06.

setenforce: SELinux is disabled

07.

[root@Vmware5 ~]# /etc/init.d/httpd start

08.

Starting httpd: httpd: Could not reliably determine the server's fully qualified domain name, using 127.0.0.1 for ServerName

09.

[  OK  ]

11.安装VNC-server服务,设置VNC-server密码。


 


view sourceprint?

1.

[root@Vmware5 ~]# rpm -qa | grep vnc-server

2.

vnc-server-4.1.2-14.el5_6.6

3.

[root@Vmware5 ~]# vncpasswd

4.

Pass<a href="http://www.it165.net/edu/ebg/" target="_blank" class="keylink">word</a>:

5.

Verify:

6.

配置VNCserver密码为123.com

12.修改下VNCserver的账号和端口,以及分辨率大小。

 


view sourceprint?

1.

[root@Vmware5 ~]# tail -2 /etc/sysconfig/vncservers

2.

VNCSERVERS="2:root"

3.

VNCSERVERARGS[2]="-geometry 1280x720 -alwaysshared -depth 24".

13.重启VNCserver.

 


view sourceprint?

1.

[root@Vmware5 ~]# /etc/init.d/vncserver start

2.

Starting VNC server: 2:root xauth:  creating new authority file /root/.Xauthority

3.

New 'Vmware5:2 (root)' desktop is Vmware5:2

4.

Creating default startup script /root/.vnc/xstartup

5.

Starting applications specified in /root/.vnc/xstartup

6.

Log file is /root/.vnc/Vmware5:2.log

7.

[  OK  ]

14.为了避免VNCserver链接的时候,窗口出现灰色,需要取消~/.vnc/xstartup这个文件的两行注释。

 


view sourceprint?

1.

[root@Vmware5 ~]# vim ~/.vnc/xstartup

2.

unset SESSION_MANAGER

3.

exec /etc/X11/xinit/xinitrc

4.

这两行的注释去掉,保存退出。

重启VNCserver即可连接,安装Xen啦。



你可能感兴趣的:(xen安装)