Fedora 20源码安装Xen4.3.0
1.环境介绍
Linux: Fedora 20 X86_64
Xen: Xen 4.3.0
2.安装Fedora
3.安装所需要的工具包
执行命令时都是在root权限下的。
3.1更新yum
# yum update
3.2开发包
# yum groupinstall "Development Tools" # yum install hmaccalc ncurses-devel zlib-devel openssl-devel python-devel # yum install bridge-utils libtool-ltdl xorg-x11-drv-evdev xorg-x11-drv-fbdev # yum install xorg-x11-drv-i810-devel xorg-x11-drv-via-devel xorg-x11-proto-devel # yum install xorg-x11-server-sdk xorg-x11-xtrans-devel libuuid-devel # yum install readline-devel gcc gcc-gfortran gcc-c++ flex pcre-devel # yum install blas-devel lapack-devel curl-devel bison gperf gnuplot # yum install texinfo-tex tetex-dvips
注:
1. 在执行上面的命令时,xorg-x11-drv-i810-devel和xorg-x11-server-sdk没有,我也没有单独去下,发现后面也不影响。后面编译会要求用到这两个包:(我直接按照教程上装了,不知道不装会不会有影响)
2. 后面安装Xen配置时提示:没有as86。那是是因为在这一步没有安装gcc-c++
3.3 dev86
给出网址:http://rpmfind.net/linux/rpm2html/search.php?query=dev86
下载:dev86-0.16.19-3.fc19.x86_64.rpm
安装:
# rpm -ivh dev86-0.16.19-3.fc19.x86_64.rpm
3.4 Intel ACPI CA
到主页下载:http://acpica.org/downloads
下载源代码,解压,并安装:
# tar zxvf acpica-unix-20150204.tar.gz # cd acpica-unix-20150204 # make # make install
4.安装Xen 4.3.0
官网下载地址:http://www.xenproject.org/downloads/xen-archives/supported-xen-43-series/xen-430.html
4.1编译安装
# tar zxvf xen-4.3.0.tar.gz # cd xen-4.3.0 # make clean # ./configure # make xen tools stubdom # make install-xen install-tools install-stubdom
注:
我的Xen是直接官网下载然后安装的,运行这些命令时几乎没有出现什么问题。有同学拷贝了别人现成的Xen源码,然后安装遇到了一些问题主要是在make环节出现的,下面把有可能遇到的问题贴出来:
1.出现比较多的一个问题是权限不够,这是由于xen-4.3.0是拷贝过来,一些权限发生了变化。例如:
错误:make[3]: execvp: /home/chenchao/xen-4.3.0/tools/include/../../tools/cross-install: 权限不够
解决方法:进入到相应的目录,修改相应文件的权限即可。2.编译参数不被识别
错误:cc: 错误:unrecognized command line option ‘-combine’
解决方法:/home/chenchao/xen-4.3.0/tools/firmware/seabios-dir-remote/Makefile中去掉编译参数-combine3.编译出错
错误:Traceback (most recent call last):
File “./tools/layoutrom.py”, line 630, in
main()
File “./tools/layoutrom.py”, line 607, in main
info16 = parseObjDump(infile16, ‘16’)
File “./tools/layoutrom.py”, line 538, in parseObjDump
relocsection = sectionmap[sectionname]
KeyError: ‘.text.asm.out/../src/smp.c.77’
解决方法:加LC_ALL=C make编译,上网查到的原因是:语言设置为UTF-8。4.缺少头文件库
错误:/usr/include/gnu/stubs.h:7:27: fatal error: gnu/stubs-32.h: No such file or directory
# include < gnu/stubs-32.h>
解决方法:64bit系统编译32bit程序,遇到的问题,终端执行
sudo yum install glibc-devel.i686
sudo yum install libgcc.i6865.编译命令not find
错误:/bin/sh: line 1: patch: command not found
解决方法:sudo yum install patch.x86_646.缺少lib库
错误:glib-2.12 required to compile QEMU
解决方法:sudo yum install glib2-devel.x86_647.没有该文件
错误:/tmp/qemu-conf-5475-3115-17647.c:1:17: fatal error: SDL.h: No such file or directory
#include < SDL.h>
解决方法:sudo yum install SDL-devel.x86_648.ERROR: pixman not present. Your options:
(1) Prefered: Install the pixman devel package (any recent
distro should have packages as Xorg needs pixman too).
(2) Fetch the pixman submodule, using:
git submodule update –init pixman
libxl_json.h:18:27: fatal error: yajl/yajl_gen.h: No such file or directory
#include < yajl/yajl_gen.h>
解决方法: sudo yum install yajl-devel.x86_64./configure时错误:
No package ‘glib-2.0’ found
解决办法:
sudo yum install libgnomeui-devel
4.2添加启动项
# /sbin/chkconfig --add xend # /sbin/chkconfig --add xencommons # /sbin/chkconfig --add xendomains # /sbin/chkconfig xend on # /sbin/chkconfig xendomains on # /sbin/chkconfig xencommons on
5.更新Grub
更新Grub,使用Xen来引导,终端执行以下命令:
# grub2-mkconfig -o /boot/grub2/grub.cfg
重启,用Xen引导进入Fedora,进入root权限,验证Xen:
# xm list
一堆错误:
错误:
Traceback (most recent call last):
File “/usr/local/sbin/xm”, line 5, in from xen.xm import main
ImportError: No module named xen.xm
解决办法:
# sudo yum install xen-devel.x86_64 仍报上述错误
# sudo yum install xen-devel.i686 仍报上述错误
# sudo yum install xen.x86_64
这里又报错:
Error: Unable to connect to xend: No such file or directory. Is xend running?
执行:
# xend start
错误:
xc: error: Could not obtain handle on privileged command interface (2 = No such file or directory): Internal error xend/image.py: Error connecting to hypervisor
进入xen根目录下执行:
# make clean
错误:
FATAL BUILD ERROR:Xen requires at least gcc-4.1
安装gcc:缺少gcc
# yum install gcc
再次执行:
# make clean
# ./configure
# make xen tools stubdom
错误:
/usr/include/gnu/stubs.h:7:27: fatal error: gnu/stubs-32.h: No such file or directory
# include < gnu/stubs-32.h>
解决方法:64bit系统编译32bit程序,遇到的问题,终端执行
# sudo yum install glibc-devel.i686
# sudo yum install libgcc.i686
再次执行:
# make xen tools stubdom # make install-xen install-tools install-stubdom
然后再次添加启动项,其中xen和xendomains提示需要开启相应的服务,按照提示开启就OK了
更新grub
重启,用Xen引导进入Fedora,进入root权限,验证Xen:
# xm list
成功了: