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.
splashp_w_picpath=(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啦。
轉載于:https://blog.51cto.com/6226001001/1575850
總結
- 上一篇: ubuntu下安装minicom
- 下一篇: 强将手下无弱兵