1.安装内核软件包
[root@nc81 logs]# yum install xen
[root@nc81 logs]# chkconfig --list|grep xen
xend 0:关闭 1:关闭 2:启用 3:启用 4:启用 5:启用 6:关闭
xendomains 0:关闭 1:关闭 2:关闭 3:启用 4:启用 5:启用 6:关闭若服务在3(文本模式)和5(图形模式)下未自动运行,则执行如下命令:
[root@nc81 logs]# chkconfig --level 35 xend on
[root@nc81 logs]# chkconfig --level 35 xendomains on[root@nc81 logs]# chkconfig --list |grep xen
xend 0:关闭 1:关闭 2:关闭 3:启用 4:关闭 5:启用 6:关闭
xendomains 0:关闭 1:关闭 2:关闭 3:启用 4:关闭 5:启用 6:关闭
2.修改配置文件,以Xen内核启动服务器.
[root@nc81 ~]# cat /etc/grub.conf
# 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/cciss/c0d0p3
# initrd /initrd-version.img
#boot=/dev/cciss/c0d0
default=1
timeout=5
splashimage=(hd0,0)/grub/splash.xpm.gz
hiddenmenu
title CentOS (2.6.18-348.6.1.el5xen)
root (hd0,0)
kernel /xen.gz-2.6.18-348.6.1.el5
module /vmlinuz-2.6.18-348.6.1.el5xen ro root=LABEL=/ rhgb quiet
module /initrd-2.6.18-348.6.1.el5xen.img
title CentOS (2.6.18-164.el5)
root (hd0,0)
kernel /vmlinuz-2.6.18-164.el5 ro root=LABEL=/ rhgb quiet
initrd /initrd-2.6.18-164.el5.img将default=1修改为default=0,默认已虚拟内核启动.
3.linux Xen服务的启动和停止方法:
虽然配置了开机自动启动Xen服务,但当Xen服务出问题时或碰到其他情况时,则需要对该服务进行管理:
停止Xen服务
[root@nc81 ~]# /etc/init.d/xend stop
停止 xend: [确定]启动Xen服务
[root@nc81 ~]# /etc/init.d/xend start
启动 xend: [确定]重启Xen服务
[root@nc81 ~]# /etc/init.d/xend restart
restart xend: [确定]查看Xen服务状态
[root@nc81 ~]# service xend status
xend is running
[root@nc81 ~]# xm list
Name ID Mem(MiB) VCPUs State Time(s)
Domain-0 0 11637 16 r----- 114.2
4. 安装虚拟机控制台:
[root@nc81 ~]# rpm -qa|grep virt-manager
[root@nc81 ~]# yum install virt-manager
Running Transaction
Installing : gnome-python2-gnomekeyring 1/4
Installing : gtk-vnc 2/4
Installing : gtk-vnc-python 3/4
Installing : virt-manager 4/4Installed:
virt-manager.x86_64 0:0.6.1-16.el5Dependency Installed:
gnome-python2-gnomekeyring.x86_64 0:2.16.0-3.el5 gtk-vnc.x86_64 0:0.3.8-3.el5 gtk-vnc-python.x86_64 0:0.3.8-3.el5Complete!
[root@nc81 ~]# virt-manager
在控制台操作界面完成虚拟机的创建.
来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/26442672/viewspace-762036/ ,如需转载,请注明出处,否则将追究法律责任。