It seems that this CentOS has not released the Minimal installation version, the following compilation and installation steps are completed on the LiveCD installation version (CentOS-7.0-1406-x86_64-livecd.iso.
Install required software packages
After CentOS 7.0 is installed, the first thing is to start SSH for access from another machine. The new CentOS version introduces the controversial systemd process manager to replace the traditional Unix init system. Run the systemctl command to enable the service:
# Systemctl start sshd
# Systemctl enable sshd
Update the system and install the compilers, tools, and software libraries required for compiling Xen:
# Yum update
# Yum groupinstall "Development Tools"
# Yum install-y gcc-c ++ git patch texinfo
# Yum install-y python-devel acpica-tools libuuid-devel ncurses-devel glib2 glib2-devel libaio-devel openssl-devel yajl-devel glibc-devel glibc-devel.i686 pixman-devel
# Wget http://mirror.centos.org/centos/6/ OS /x86_64/Packages/dev86-0.16.17-15.1.el6.x86_64.rpm
# Rpm-ivh dev86-0.16.17-15.1.el6.x86_64.rpm
Install Xen
Download the latest xen Source Code, compile, and install the latest xen 4.5-unstable code:
# Git clone git: // xenbits.xen.org/xen.git
# Cd xen/
#./Configure
# Make dist
# Make install
Install the dom0 kernel
Download the latest Linux kernel source code, configure the dom0 kernel, compile, and install. Note that the following kernel options must be selected for the dom0 kernel:
# Wget https://www.kernel.org/pub/linux/kernel/v3.x/linux-3.15.4.tar.xz
# Tar xf linux-3.15.4.tar.xz
# Cd linux-3.15.4/
# Make menuconfig
# Vi. config
...
CONFIG_X86_IO_APIC = y
CONFIG_ACPI = y
CONFIG_ACPI_PROCFS = y (optional)
CONFIG_XEN_DOM0 = y
CONFIG_PCI_XEN = y
CONFIG_XEN_DEV_EVTCHN = y
CONFIG_XENFS = y
CONFIG_XEN_COMPAT_XENFS = y
CONFIG_XEN_SYS_HYPERVISOR = y
CONFIG_XEN_GNTDEV = y
CONFIG_XEN_BACKEND = y
CONFIG_XEN_NETDEV_BACKEND = m
CONFIG_XEN_BLKDEV_BACKEND = m
CONFIG_XEN_PCIDEV_BACKEND = m
CONFIG_XEN_BALLOON = y
CONFIG_XEN_SCRUB_PAGES = y
...
# Make
# Make modules
# Make modules_install
# Make install
Configure Grub
Configure grub2 and add the Linux dom0 kernel with Xen:
# Grub2-mkconfig-o/etc/grub2.cfg
# Vi/etc/grub2.cfg
# Vi/etc/grub. d/40_custom
#! /Bin/sh
Exec tail-n + 3 $0
# This file provides an easy way to add custom menu entries. Simply type
# Menu entries you want to add after this comment. Be careful not to change
# The 'exec tail' line above.
Menuentry 'centos Linux, with Linux 3.15.4 xen' -- class CentOS -- class gnu-linux -- class gnu -- class OS -- unrestricted $ menuentry_id_option 'gnulinux-3.15.4-advanced-aa64a6a3-518e-4a7c-9e88-2f3f33c8c700 '{
Load_video
Insmod gzio
Insmod part_msdos
Insmod xfs
Set root = 'hd0, msdos1'
If [x $ feature_platform_search_hint = xy]; then
Search -- no-floppy -- fs-uuid -- set = root -- hint-bios = hd0, msdos1 -- hint-efi = hd0, msdos1 -- hint-baremetal = ahci0, msdos1 -- hint = 'hd0, msdos1 '6bc61a5c-12e3-4711-9532-617601_e0dc
Else
Search -- no-floppy -- fs-uuid -- set = root 6bc61a5c-12e3-4711-9532-617601_e0dc
Fi
Multiboot/xen.gz
Module/vmlinuz-3.15.4 root = UUID = aa64a6a3-518e-4a7c-9e88-2f3f33c8c700 ro rd. lvm. lv = cl/root vconsole. font = latarcyrheb-sun16 crashkernel = auto vconsole. keymap = us rd. lvm. lv = cl/swap rhgb quiet
Module/initramfs-3.15.4.img
}
# Grub2-mkconfig-o/etc/grub2.cfg
Possible errors and solutions
After the restart, select CentOS Linux, with Linux 3.15.4 Xen to enter the Xen system, and use the xl info command to find the error. This is because the Xen-related software library is installed in the/usr/local/lib directory, the system cannot be found. So you can do some links:
# Xl info
Xl: error while loading shared libraries: libxlutil. so.4.3: cannot open shared object file: No such file or directory
# Cd/usr/lib/
# Ln-s/usr/local/lib/libxlutil. so.4.3.0 libxlutil. so.4.3
# Ln-s/usr/local/lib/libxlutil. so.4.3.0 libxlutil. so
# Ln-s/usr/local/lib/libxenlight. so.4.5.0 libxenlight. so.4.5
# Ln-s/usr/local/lib/libxenlight. so.4.5.0 libxenlight. so
# Ln-s/usr/local/lib/libxenctrl. so.4.5.0 libxenctrl. so.4.5
# Ln-s/usr/local/lib/libxenguest. so.4.5.0 libxenguest. so.4.5
# Ln-s/usr/local/lib/libxenguest. so.4.5.0 libxenguest. so
# Ln-s/usr/local/lib/libxenstat. so.0.0 libxenstat. so.0
# Ln-s/usr/local/lib/libxenstat. so.0.0 libxenstat. so
# Ln-s/usr/local/lib/libxenstore. so.3.0.3 libxenstore. so.3.0
# Ln-s/usr/local/lib/libxenstore. so.3.0.3 libxenstore. so
# Ln-s/usr/local/lib/libxenvchan. so.1.0.0 libxenvchan. so.1.0
# Ln-s/usr/local/lib/libxenvchan. so.1.0.0 libxenvchan. so
# Ln-s/usr/local/lib/libblktapctl. so.1.0.0 libblktapctl. so.1.0
# Ln-s/usr/local/lib/libblktapctl. so.1.0.0 libblktapctl. so
# Ldconfig
Run xl info again and find the following problems:
# Xl info
Xc: error: cocould not obtain handle on privileged command interface (2 = No such file or directory): Internal error
Libxl: error: libxl. c: 99: libxl_ctx_alloc: cannot open libxc handle: No such file or directory
Cannot init xl context
Because xenfs is not mounted, you can mount it as follows:
# Modprobe xenfs
# Mount-t xenfs/proc/xen
# Ls/proc/xen/
Capabilities privcmd xenbus xsd_kva xsd_port
# Xl info
Host: localhost. localdomain
Release: 3.15.4
Version: #1 SMP Fri Jul 11 09:37:12 sast2014
Machine: x86_64
Nr_cpus: 4
Max_cpu_id: 3
Nr_nodes: 1
Cores_per_socket: 2
Threads_per_core: 2
Cpu_mhz: 2195
Hw_caps: bfebfbff: 28100800: 00000000: 20173f00: 15bae3bf: 00000000: 00000001: 00000000
Pai_caps: hvm
Total_memory: 3959
Free_memory: 127
Sharing_freed_memory: 0
Sharing_used_memory: 0
Outstanding_claims: 0
Free_cpus: 0
Xen_major: 4
Xen_minor: 5
Xen_extra:-unstable
Xen_version: 4.5-unstable
Xen_caps: xen-3.0-x86_64 xen-3.0-x86_32p hvm-3.0-x86_32 hvm-3.0-x86_32p
Xen_scheduler: credit
Xen_pagesize: 4096
Platform_params: pai_start = 0xffff800000000000
Xen_changeset: Wed Jul 9 13:30:54 2014 + 0100 git: 7579169-dirty
Xen_commandline:
Cc_compiler: gcc (GCC) 4.8.2 20140120 (Red Hat 4.8.2-16)
Cc_compile_by: root
Cc_compile_domain: localdomain
Cc_compile_date: Fri Jul 11 08:49:06 sast2014
Xend_config_format: 4
Remember to start xencommons. The old version of xend has been replaced by xencommons:
#/Etc/init. d/xencommons start
Starting C xenstored...
Setting domain 0 name and domid...
Starting xendeskled...
Starting QEMU as disk backend for dom0
# Xl list
Name ID Mem VCPUs State Time (s)
Domain-0 0 3779 4 r ----- 105.5
Xen introduced the new tool set xl/libxl from version 4.1 and gradually replaced the old xm/xend in later versions. In version 4.5, Xen has completely deleted xm/xend.