Please refer to
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.
Hardware:
Table of Contents
Dom0 hardware platform:
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
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:
Fedora 12 x86_64, updated to Apr. 10, 2010.
No xen and libvirt installed:
# rpm -qa | grep xen # rpm -qa | grep virt
And SELinux is diabled.
Packages:
linux-2.6.29-xen-r4-aka-suse-xenified-2.6.29-62.1: Download here.
download these packages and unzip them.
Build and install Xen
Uncompress xen and put all the source code files of xen to “/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:
# make -j16 dist-xen dist-tools dist-docs
You may need to install some packages that are required and listed.
Install xen:
# cd dist # sh ./install.sh
Build and install Linux kernel
The .config file I used can be downloaded from here:
https://drive.google.com/file/d/0B1qt7fnWrEczQTZkc2JfOFRHXzQ/view
My .config file can be used directly.
Or please use menuconfig to create one:
# make menuconfig
When using “make menuconfig“, some options require special attention:
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:
# make -j16 # make modules_install install
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.
Configure services
Add xend and xendomains to services that automatically start when system boot.
# 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.
# chkconfig ksmtuned off
Reboot now
# reboot
After booting the system in the xen environment. the xm command can be used:
[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.
[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