---
title: "CentOS6.0 (x86) 下面安装 虚拟机 Xen 4.1.1的方法"
author: "siwind"
date: "2011-10-09T20:51:42Z"
tags: []
categories: ["操作系统"]
slug: "centos6-0-x86-xen-4-1-1"
draft: false
lastmod: "2011-10-10T22:23:40Z"
id: 1188053
url: "https://siwind.iteye.com/blog/1188053"
---

参考来网络上的一些内容，并自己解决了安装中的一些错误。

<span style="color:blue">1) 安装需要的软件包</span>
    //开发工具
    
```java
#sudo yum groupinstall "Development Tools"

```

     
     //需要的软件


```java
#yum install hmaccalc ncurses-devel zlib-devel openssl-devel python-devel \

bridge-utils libtool-ltdl iasl xorg-x11-drv-evdev xorg-x11-drv-fbdev \

xorg-x11-drv-i810-devel xorg-x11-drv-via-devel xorg-x11-proto-devel \

xorg-x11-server-sdk xorg-x11-xtrans-devel 

```



<span style="color:blue">2) 安装 Xen hypervisor</span>

 
```java
 #make help          //看看有哪些编译选项!!

    #make               //make world比较费时间

  #sudo make install

  #sudo make install-docs  //安装文档

```

  

<span style="color:blue">3) 安装支持xen的linux内核(使用 ： linux-3.0.4.tar.bz2)</span>

  #tar zjvf linux-3.0.4.tar.bz2

  #cd linux-3.0.4

  #make help

  #make menuconfig

  
  Device Drivers --->

      Xen driver support --->

        下面都选*不要M！！




```java
  $ make

$ make modules

# make modules_install

# make install

# /sbin/depmod 3.0.4

```


<span style="color:red">如果出现 i2c_core的错误，运行: modprobe i2c-core即可。 (注意下划线和折线的区别)</span>


<span style="color:blue">4) 更新grub</span>
$ cat /boot/grub/grub.conf 


```java
default=0
timeout=3
color=green/black light-gray/blue
#splashimage=(hd0,8)/grub/splash.xpm.gz
#hiddenmenu
# section to load CentOS6.0
title CentOS6.0
	root (hd0,8)
	kernel /vmlinuz-2.6.32-71.el6.i686 root=/dev/sda10 ro
	initrd /initramfs-2.6.32-71.el6.i686.img

title CentOS6.0( kernel-3.0.4 )
	root (hd0,8)
	kernel /vmlinuz-3.0.4 root=/dev/sda10 ro
	initrd /initramfs-3.0.4.img

title CentOS6.0 (kernel-3.0.4 with Xen)
	root (hd0,8)
	kernel /xen-4.1.1.gz
	module /vmlinuz-3.0.4 ro root=/dev/sda10
	module /initramfs-3.0.4.img
```



<span style="color:blue">5) 重启系统, 确认xen安装成功</span>
```java
# /sbin/chkconfig --add xencommons
# /sbin/chkconfig --add xend
# /sbin/chkconfig --add xendomains
# /sbin/chkconfig --level 35 xend on
# /sbin/chkconfig --level 35 xendomains on
# /sbin/chkconfig --level 35 xencommons on
#service xencommons start
#service xend start
#service xendomains start

```

验证：

```java
#xm list
Name                                        ID   Mem VCPUs      State   Time(s)
Domain-0                                     0  1886     2     r-----     79.6

```



  

  

===================================

过程中遇到的错误及解决方法

如果中程在提示错误缺东西，就用 "<span style="color:blue">yum list *关键词* </span>" 看看缺少哪个包，然后把它装上。  


<span style="color:red">错误0:  错误：SDL.h：没有那个文件或目录</span>
   #sudo yum install SDL-devel


<span style="color:red">错误1：missing uuid headers (package uuid-dev)</span>

解决办法：yum install libuuid-devel


<span style="color:red">错误2：提示需要安装软件包：dev86</span>


解决办法：http://www.debath.co.uk/dev86/下载并按装 Dev86src-0.16.18.tar.gz

    #tar xzvf Dev86src-0.16.18.tar.gz

    #sudo make install



<span style="color:red">错误3： 缺少 ACPI ASL compiler (iasl)</span>



下载源代码包http://acpica.org/downloads/： acpica-unix2-20110922.tar.gz

    #tar xzvf acpica-unix2-20110922.tar.gz

    #cd compiler

    #make

    #make install   /* install the binary to /usr/bin */


<span style="color:red">错误4：`makeinfo' is missing on your system</span>

yum install texinfo



<span style="color:darkred">警告1：缺少 latex</span>

  #yum install gnuplot-latex

<span style="color:darkred">警告2： 缺少fig2dev</span>

  #yum install xfig

    
============================================
<span style="color:darkblue">手动安装grub，并从windowXP/win7中加载的方法</span>
1. 在linux的非MBR分区中安装grub，然后将所安装的grub所在分区(例如：/dev/sda3)引导扇区导出到文件 "linux.bin" 中。
  #sudo grub-install  /dev/sda3
  #sudo dd if=/dev/sda3 of=linux.bin bs=512 count=1
2.WinXP中：
拷贝linux.bin到C:\下面，然后在boot.ini中加入：
c:\linux.bin="启动 CentOS6.0"

3.在win7下面：
拷贝linux.bin到C:\下面，然后

```java
C:\Windows\system32>bcdedit /create /application BOOTSECTOR /D "CentOS 6.0"

项 {24574a00-5cf2-11e0-b939-fb55e363b036} 成功创建。

C:\Windows\system32>bcdedit /set {24574a00-5cf2-11e0-b939-fb55e363b036} DEVICE BOOT

操作成功完成。

C:\Windows\system32>bcdedit /set {24574a00-5cf2-11e0-b939-fb55e363b036} PATH \linux.bin

操作成功完成。

C:\Windows\system32>bcdedit /displayorder {24574a00-5cf2-11e0-b939-fb55e363b036} /addlast

操作成功完成。

C:\Windows\system32>bcdedit /timeout 10
```