组件版本:
kernel-xen、kernel-xen-firmware————4.9.71-2.el6xen
xen46-hypervisor、libvirt-deamon-xen、libvirt-deamon-driver-xen、libvirt-deamon—-3.2.1-402.el6
xen46-libs、xen46-licenses、xen46-ocaml、xen46-runtime——4.6.6-12.el6
OS版本:
centos6.9
Step 1
Download and install your base OS. I personally use Scientific Linux 7. After downloading and burning the DVD, perform a minimal install adding packages you require.
Step 2
Install the bridge-utils package.
# yum install bridge-utils
Step 3
Enable my Xen Repo for x86_64
For SL6, CentOS 6 and RHEL 6:
# yum install http://au1.mirror.crc.id.au/repo/kernel-xen-release-el6-latest.noarch.rpm
For SL7, CentOS 7 and RHEL 7:
# yum install http://au1.mirror.crc.id.au/repo/kernel-xen-release-el7-latest.noarch.rpm
Step 4
Choose your Xen version:
Xen 4.5
# yum install xen45
# ls -l /boot/xen.gz
lrwxrwxrwx 1 root root 12 Sep 10 02:54 /boot/xen.gz -> xen-4.5.0.gz
Xen 4.6
# yum install xen46
# ls -l /boot/xen.gz
lrwxrwxrwx 1 root root 12 Sep 10 02:54 /boot/xen.gz -> xen-4.6.0.gz
Xen 4.7
# yum install xen47
# ls -l /boot/xen.gz
lrwxrwxrwx 1 root root 12 Sep 10 02:54 /boot/xen.gz -> xen-4.7.0.gz
Xen 4.9
# yum install xen49
# ls -l /boot/xen.gz
lrwxrwxrwx 1 root root 12 Sep 10 02:54 /boot/xen.gz -> xen-4.9.0.gz
Step 5
Install the kernel-xen package. NOTE: It is important to do this AFTER installing Xen and in a separate yum command. If you combine the two, the kernel-xen package may be installed before the xen package. This will result in the required grub.conf entries not being set up.
# yum install kernel-xen
Step 6
Disable SELinux. While selinux is a great idea, it really screws with Xen. If there is anyone out there who wants to wade through what should be set for selinux to be enabled and still have Xen working, please email me! In the mean time, disable it by editing the following file /etc/sysconfig/selinux.
# This file controls the state of SELinux on the system.
# SELINUX= can take one of these three values:
# enforcing – SELinux security policy is enforced.
# permissive – SELinux prints warnings instead of enforcing.
# disabled – No SELinux policy is loaded.
SELINUX=disabled
# SELINUXTYPE= can take one of these two values:
# targeted – Targeted processes are protected,
# mls – Multi Level Security protection.
SELINUXTYPE=targeted
Step 7
Reboot into your new Xen kernel and test:
# xm info
host : xenhost.lan.crc.id.au
release : 3.8.3-1.el6xen.x86_64
version : #1 SMP Sat Mar 16 15:16:57 EST 2013
machine : x86_64
nr_cpus : 4
nr_nodes : 1
cores_per_socket : 4
threads_per_core : 1
cpu_mhz : 3303
hw_caps : bfebfbff:28100800:00000000:00003f40:179ae3bf:00000000:00000001:00000000
virt_caps : hvm
total_memory : 8116
free_memory : 322
free_cpus : 0
xen_major : 4
xen_minor : 2
xen_extra : .1
xen_caps : xen-3.0-x86_64 xen-3.0-x86_32p hvm-3.0-x86_32 hvm-3.0-x86_32p hvm-3.0-x86_64
xen_scheduler : credit
xen_pagesize : 4096
platform_params : virt_start=0xffff800000000000
xen_changeset : unavailable
xen_commandline : dom0_mem=2048M cpufreq=xen dom0_max_vcpus=2 dom0_vcpus_pin
cc_compiler : gcc (GCC) 4.4.6 20120305 (Red Hat 4.4.6-4)
cc_compile_by : mockbuild
cc_compile_domain : crc.id.au
cc_compile_date : Sat Feb 16 19:16:38 EST 2013
xend_config_format : 4
step 8
配置网卡以及桥接
为xenbr0创建配置文件/etc/sysconfig/network-scripts/ifcfg-xenbr0,其内容类似下面所示。需要注间的是TYPE属性的值Bridge一定要大写首字母。
DEVICE=”xenbr0″
BOOTPROTO=”static”
NM_CONTROLLED=”no”
IPADDR=10.0.0.2
NETMASK=255.255.255.0
GATEWAY=10.0.0.1
DNS1=10.0.0.1
ONBOOT=”yes”
TYPE=” Bridge”
DELAY=0
~
将eth0的配置文件/etc/sysconfig/network-scripts/ifcfg-eth0的内容修改为:
DEVICE=”eth0″
BOOTPROTO=”static”
NM_CONTROLLED=”no”
ONBOOT=”yes”
TYPE=”Ethernet”
BRIDGE=xenbr0
# service network restart
step 9
安装virt-manager
# yum -y install centos-release-xen
# yum -y install libvirt libvirt-deamon-xen libvirt-deamon-driver-xen libvirt-deamon
# service libvirtd start
# yum install virt-manager xorg-x11-xauth dejavu-lgc-sans-fonts
# virt-manager