Centos上源码安装xen-4.8.0
来源:互联网 发布:小蜜蜂抢购软件 编辑:程序博客网 时间:2024/05/20 05:05
安装dom0内核
wget https://cdn.kernel.org/pub/linux/kernel/v4.x/linux-4.10.1.tar.xz
tar zxf linux-4.10.1.tar.xz
cd linux-3.18.18
make menuconfig
参考:https://wiki.xen.org/wiki/Mainline_Linux_Kernel_Configs
Configuring the Kernel for domU Support
- If building x86 32 bit kernel make sure you have CONFIG_X86_PAE enabled (which is set by selecting CONFIG_HIGHMEM64G)
- non-PAE mode doesn't work in 2.6.25, and has been dropped altogether from 2.6.26 and newer kernel versions.
- For x86 , enable these core options (Processor type and features| Paravirtualized guest support]
- CONFIG_HYPERVISOR_GUEST=y (3.10+ only)
- CONFIG_PARAVIRT=y
- CONFIG_XEN=y
- CONFIG_PARAVIRT_GUEST=y
- CONFIG_PARAVIRT_SPINLOCKS=y
- For ARM, enable these core options (Kernel Features)
- CONFIG_XEN=y
- CONFIG_PARAVIRT=y
- And Xen pv console device support (Device Drivers|Character devices
- CONFIG_HVC_DRIVER=y
- CONFIG_HVC_XEN=y
- And Xen disk and network support (Device Drivers|Block devices and Device Drivers|Network device support)
- CONFIG_XEN_FBDEV_FRONTEND=y
- CONFIG_XEN_BLKDEV_FRONTEND=y
- CONFIG_XEN_NETDEV_FRONTEND=y
- And the rest (Device Drivers|Xen driver support)
- CONFIG_XEN_PCIDEV_FRONTEND=y
- CONFIG_INPUT_XEN_KBDDEV_FRONTEND=y
- CONFIG_XEN_FBDEV_FRONTEND=y
- CONFIG_XEN_XENBUS_FRONTEND=y
- CONFIG_XEN_SAVE_RESTORE=y
- CONFIG_XEN_GRANT_DEV_ALLOC=m
- And for tmem support (x86 only):
- CONFIG_XEN_TMEM=y
- CONFIG_CLEANCACHE=y
- CONFIG_FRONTSWAP=y
- CONFIG_XEN_SELFBALLOONING=y
Configuring the Kernel for dom0 Support
NOTE: Xen dom0 support depends on ACPI support. Make sure you enable ACPI support or you won't see Dom0 options at all.
In addition to the config options above you also need to enable:
- CONFIG_XEN_DOM0=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_BALLOON=y
- CONFIG_XEN_SCRUB_PAGES=y
For x86, you will also need to enable:
- CONFIG_X86_IO_APIC=y
- CONFIG_ACPI=y
- CONFIG_ACPI_PROCFS=y (optional)
- CONFIG_PCI_XEN=y
- CONFIG_XEN_PCIDEV_BACKEND=m
If you're using RHEL5 or CentOS5 as a dom0 (ie. you have old udev version), make sure you enable the following options as well:
- CONFIG_SYSFS_DEPRECATED=y
- CONFIG_SYSFS_DEPRECATED_V2=y
For more current Xen related config options check the example .config files from the troubleshooting section, and check the 2.6.18-to-2.6.31-and-higher wiki page.
$ make all -j <2*number_of_cores>安装需要的软件包
yum install -y gcc gcc-c++ git patch texinfo python-devel acpica-tools libuuid-devel ncurses-devel glib2 glib2-devel libaio-devel openssl-devel yajl-devel glibc-devel glibc-devel.i686 pixman-devel bc
rpm -ivh http://mirror.centos.org/centos/6/os/x86_64/Packages/dev86-0.16.17-15.1.el6.x86_64.rpm
安装Xen
git clone git://xenbits.xen.org/xen.git
cd xen/# ./configure
# make world
# make install
配置 GRUB
grub2-mkconfig -o /etc/grub2.cfg
#查看grub2.cfg相关配置
cat /etc/grub2.cfg
#静态文件系统信息,定义了存储设备和分区整合到整个系统的方式
cat /etc/fstab
#复制grub2.cfg里第一个引导配置到下面的文件,添加一行 multiboot /xen.gz,linux16、initrd16修改为module
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 the
# menu entries you want to add after this comment. Be careful not to change
# the 'exec tail' line above.
menuentry 'CentOS Linux 7 (Core), with Linux 3.18.18 Xen' --class centos --class gnu-linux --class gnu --class os --unrestricted $menuentry_id_option 'gnulinux-3.18.18-advanced-dfad9c15-962d-492d-b83a-31d22a5f0eec' {
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' 8089210c-1bb3-4589-b18d-cc5b2b97774e
else
search --no-floppy --fs-uuid --set=root 8089210c-1bb3-4589-b18d-cc5b2b97774e
fi
multiboot /xen.gz
module /vmlinuz-3.18.18 root=/dev/mapper/centos-root ro rd.lvm.lv=centos/root rd.lvm.lv=centos/swap crashkernel=auto rhgb quiet
module /initramfs-3.18.18.img
}
#重新生成菜单
grub2-mkconfig -o /etc/grub2.cfg
可能出现的错误和解决办法
重启后,选择 CentOS Linux, with Linux 3.15.4 Xen 进入 Xen 系统,使用 xl info 命令发现有错,这是因为 Xen 相关的软件库被安装到了 /usr/local/lib 目录,系统找不到。所以做一些链接就可以了:
xl infoxl: 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
再次运行 xl info 发现如下问题:
xl info
xc: error: Could 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
是因为没有挂载 xenfs 的缘故,挂载一下就可以了:
modprobe xenfs
mount -t xenfs xenfs /proc/xen
ls /proc/xen/
capabilities privcmd xenbus xsd_kva xsd_port
# 一劳永逸的办法修改fstab文件
vim /etc/fstab
#追加如下一行
none /proc/xen xenfs defaults 0 0
xl info
记得启动 xencommons:
/etc/init.d/xencommons start
#开机启动xencommons
/sbin/chkconfig --add xencommons
/sbin/chkconfig --add xendomains
/sbin/chkconfig xendomains on
/sbin/chkconfig xencommons on
xl list
Name ID Mem VCPUs State Time(s)
Domain-0 0 7870 2 r----- 213.0
Xen 从 4.1 版本开始引入了新版工具集 xl/libxl,并在后续的版本中逐步替代旧的 xm/xend,在 4.5 版本中已经完全删除了 xm/xend.
每次启动菜单有很多选项,进去把除当前版本以外的删除掉
# !!! 保留vmlinuz-3.18.18、initramfs-3.18.18.imgcd /boot/
rm -fr
vmlinuz-*
initramfs-*.img
#重新生成菜单
grub2-mkconfig -o /etc/grub2.cfg
参考:http://chenbaocheng.com/2015/07/16/%E5%9C%A8CentOS-7-x%E4%B8%8A%E6%BA%90%E7%A0%81%E5%AE%89%E8%A3%85Xen-4-5/
- Centos上源码安装xen-4.8.0
- CentOS 5.3源码安装xen-3.2.0
- 在 CentOS 7.0 上源码安装 Xen 4.5
- 在 CentOS 7.0 上源码安装 Xen 4.5
- CentOS 6.3 源码安装Xen
- CentOS Xen 源码安装实验
- CentOS上安装Xen虚拟机
- Fedora8上Xen源码安装
- centos 5 源码安装 xen 3.4.2
- CentOS上安装和配置 Xen
- CentOS 上安装和配置 Xen
- 在 Ubuntu 上源码安装 Xen
- CentOS上源码安装GCC 4.8.2
- centos 5源码编译安装xen实验笔记
- 在CentOS下源码安装 Xen并搭建Windows虚拟机
- Centos 7 安装 Xen
- centos 6.4 x86_64 yum上安装xen 4.2.2
- 在 CentOS 6.5 上安装和配置 Xen
- 像使用Linux一样打开Win Bash
- android service HttpURLConnection下载网络数据
- 【数据结构_队列_Queue_0965】循环队列
- Java调优—Btrace监控Java线程/方法执行参数、执行时间(Windows)
- 奇异值分解(SVD)
- Centos上源码安装xen-4.8.0
- apache-maven笔记(一) windows环境下的安装
- HDU3047 Zjnu Stadium(带权并查集)
- hibernate一对多单向、双向关联
- 全排列 dfs
- R语言-数据预处理
- 面试题3.0
- SVM参数设定
- cuda profiler使用