Please refer to Xen Solutions for the latest stable Xen Dom0 solution.
有关最新的稳定Xen Dom0解决方案 ,请参考Xen Solutions 。
In this post, the detailed tutorial for setting up Xen 3.4.1 dom0 on top of Fedora 12 with kernel 2.6.29 will be introduced.
在这篇文章中,将介绍在内核为2.6.29的Fedora 12上设置Xen 3.4.1 dom0的详细教程 。
硬件: (Hardware:)
Dom0 hardware platform:
Dom0硬件平台:
Motherboard: INTEL S5500BC S5500 Quad Core Xeon Server Board
CPU: 2 x Intel Quad Core Xeon E5520 2.26G (5.86GT/sec,8M,Socket 1366)
Memory: 4 x Kingston DDR-3 1333MHz 4GB ECC REG. CL9 DIMM w/Parity & Thermal Sensor
HD: 4 x WD WD10EARS 1 TB, SATA II 3Gb/s, 64 MB Cache
主板:INTEL S5500BC S5500四核Xeon服务器主板
CPU :2个Intel Quad Core Xeon E5520 2.26G(5.86GT / sec,8M,Socket 1366)
内存:4 x金士顿DDR-3 1333MHz 4GB ECC REG。 带奇偶校验和热传感器的CL9 DIMM
高清:4 x WD WD10EARS 1 TB,SATA II 3Gb / s,64 MB缓存
Disk Partitions:
磁盘分区:
[root@localhost vm0]# df -hT
Filesystem Type Size Used Avail Use% Mounted on
/dev/mapper/VolGroup-LogVol_root
ext4 50G 12G 38G 23% /
tmpfs tmpfs 7.9G 0 7.9G 0% /dev/shm
/dev/sda1 ext3 504M 110M 369M 23% /boot
/dev/mapper/VolGroup-LogVol_lhome
ext4 858G 21G 794G 3% /lhome
Linux : (Linux:)
Fedora 12 x86_64, updated to Apr. 10, 2010.
Fedora 12 x86_64,更新至2010年4月10日。
No xen and libvirt installed:
没有安装xen和libvirt:
# rpm -qa | grep xen
# rpm -qa | grep virt
And SELinux is diabled.
并且SELinux是可行的。
包装方式: (Packages:)
linux-2.6.29-xen-r4-aka-suse-xenified-2.6.29-62.1: Download here.
linux -2.6.29-xen-r4-aka-suse-xenified-2.6.29-62.1: 在此处下载 。
download these packages and unzip them.
下载这些软件包并解压缩。
生成并安装Xen (Build and install Xen)
Uncompress xen and put all the source code files of xen to “/usr/src/xen/xen-3.4.1/”:
解压缩Xen和投入的XEN为“/usr/src/xen/xen-3.4.1/”的所有源代码文件:
# mkdir -p /usr/src/xen/
# tar -xf xen-3.4.1.tar.gz -C /usr/src/xen/
# cd /usr/src/xen/xen-3.4.1
Build xen, tools and docs:
构建Xen,工具和文档:
# make -j16 dist-xen dist-tools dist-docs
You may need to install some packages that are required and listed.
您可能需要安装一些必需和列出的软件包。
Install xen:
安装Xen:
# cd dist
# sh ./install.sh
构建并安装Linux内核 (Build and install Linux kernel)
The .config file I used can be downloaded from here:
我使用的.config文件可以从这里下载:
https://drive.google.com/file/d/0B1qt7fnWrEczQTZkc2JfOFRHXzQ/view
https://drive.google.com/file/d/0B1qt7fnWrEczQTZkc2JfOFRHXzQ/view
My .config file can be used directly.
我的.config文件可以直接使用。
Or please use menuconfig to create one:
或者,请使用menuconfig创建一个:
# make menuconfig
When using “make menuconfig“, some options require special attention:
使用“ make menuconfig ”时,某些选项需要特别注意:
Subarchitecture Type (Enable Xen compatible kernel)
( ) PC-compatible
(X) Enable Xen compatible kernel
( ) Support for ScaleMP vSMP
Device Drivers --->
XEN --->
[*] Privileged Guest (domain 0)
<*>Backend driver support
<*>Block-device backend driver
<*>Block-device tap backend driver
<*> Network-device backend driver
After configuration, build and install this Linux kernel:
配置后,构建并安装此Linux内核:
# make -j16
# make modules_install install
创建一个grub条目 (Create a grub entry)
# vim /boot/grub/grub.conf
Then add this entry:
然后添加以下条目:
title Fedora (xen 3.4.1 - 2.6.29-xen-r4)
root (hd0,0)
kernel /xen-3.4.1.gz console=vga vga=ask noreboot
module /vmlinuz-2.6.29-xen-r4 ro root=/dev/mapper/VolGroup-LogVol_root noiswmd LANG=en_US.UTF-8 SYSFONT=latarcyrheb-sun16 KEYBOARDTYPE=pc KEYTABLE=us
module /initramfs-2.6.29-xen-r4.img
The “root=” and other options will be different depending on the partitions of the system.
“ root = ”和其他选项将根据系统分区的不同而有所不同。
配置服务 (Configure services)
Add xend and xendomains to services that automatically start when system boot.
将xend和xendomains添加到在系统引导时自动启动的服务。
# chkconfig --add xend
# chkconfig --add xendomains
# chkconfig xend on
# chkconfig xendomains on
# chkconfig --list | grep xend
xend 0:off 1:off 2:on 3:on 4:on 5:on 6:off
xendomains 0:off 1:off 2:on 3:on 4:on 5:on 6:off
Disable ksmtuned service.
禁用ksmtuned服务。
# chkconfig ksmtuned off
马上重启 (Reboot now)
# reboot
After booting the system in the xen environment. the xm command can be used:
在xen环境中引导系统后。 可以使用xm命令:
[root@localhost ~]# xm info
host : localhost.localdomain
release : 2.6.29-xen-r4
version : #1 SMP Mon Apr 12 00:41:42 HKT 2010
machine : x86_64
nr_cpus : 16
nr_nodes : 1
cores_per_socket : 4
threads_per_core : 2
cpu_mhz : 2266
hw_caps : bfebfbff:28100800:00000000:00000340:009ce3bd:00000000:00000001:00000000
virt_caps : hvm
total_memory : 16321
free_memory : 4
node_to_cpu : node0:0-15
node_to_memory : node0:4
xen_major : 3
xen_minor : 4
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
cc_compiler : gcc version 4.4.3 20100127 (Red Hat 4.4.3-4) (GCC)
cc_compile_by : root
cc_compile_domain : localdomain
cc_compile_date : Mon Apr 12 01:53:45 HKT 2010
xend_config_format : 4
Then xm can be used to create and manage virtual machines on the server.
然后,可以使用xm在服务器上创建和管理虚拟机。
[root@localhost ~]# xm list
Name ID Mem VCPUs State Time(s)
Domain-0 0 15093 16 r----- 228.2
vm0 1 1024 2 -b---- 4.4