新手安装Xentoo(Xen+Gentoo)的极速体验1.5、修改Makefile,(根据需要修改,内核为2.6的可以跳过这一步.Xen-2.0.7目前只支持linux-2.4.30,linux-2.6.11,netbsd-2.0,freebsd-5.3) 以下是针对我的redhat9,2.4内核的修改 KERNELS ?= linux-2.6-xen0 linux-2.6-xenU 改为 KERNELS ?= linux-2.4-xen0 xen0为host os - domain 0的核心,而xenU作为guest os - domain U的核心,可以不需要任何硬件驱动程序. 这里暂时不编译xenU,主要是为了节省一些时间,在后面安装Gentoo的时候直接采用Xen二进制安装包中预编译好的内核.因为我的机器比较慢,编译一次内核要2、3个小时,各位可以根据自己的实际需要决定是否编译xenU 1.6、复制Linux内核源码(bz2格式)到xen-2.0目录内(网速快的可以跳过这一步,Xen会从自动网上下载相应的内核) 1.7、使用自己的.config文件编译内核:(下面主要是以我的2.4.30内核为例,对于2.6内核原理相同,可以根据自己实际情况进行修改) 1)、Xen内核补丁程序的bug,不修改这个,编译内核会出错:(对于2.6内核没有这个bug,可以跳过这一步) 修改 linux-2.4.30-xen-sparse/mkbuildtree 找到cd ${AD}/include/asm-xen 在下面加入: ln -sf ../asm-i386/acpi.h ln -sf ../asm-i386/cobalt.h ln -sf ../asm-i386/e820.h ln -sf ../asm-i386/edd.h ln -sf ../asm-i386/hc_sl811-hw.h ln -sf ../asm-i386/lithium.h ln -sf ../asm-i386/pci-direct.h ln -sf ../asm-i386/save_state.h ln -sf ../asm-i386/sl811-hw.h ln -sf ../asm-i386/smpboot.h 2)、让Xen自动对内核打补丁,并在补丁完毕中止程序(一定要中止程序,否则Xen会使用它默认的defconfig,这个配置是没有任何硬件驱动的) #make kernels 输入完命令后,Xen会自动下载内核源码并打补丁,打完补丁,准备make内核的时候(这时屏幕显示一大堆config信息),按Ctrl+c中止程序. 3)、复制现有内核的配置文件到 linux-2.4.30-xen0 #cp /boot/config-2.4.30 linux-2.4.30-xen0/.config #cd linux-2.4.30-xen0 #make ARCH=xen oldconfig 期间会提示新增的有关Xen的选项,全部都选y 4)、编译内核 #make ARCH=xen dep #make ARCH=xen modules #make ARCH=xen modules_install #make ARCH=xen install 5)、安装与内核版本对应的modutils(参考 linux-2.4.30-xen0/Documentation/Changes) 6)、TLS Libraries (这是Xen Users' manual 2.4.3小节中的原文,根据自己实际情况处理) Users of the XenLinux 2.6 kernel should disable Thread Local Storage (e.g. by doing a mv /lib/tls /lib/tls.disabled) before attempting to run with a XenLinux kernel2.4. You can always reenable it by restoring the directory to its original location (i.e. mv /lib/tls.disabled /lib/tls). The reason for this is that the current TLS implementation uses segmentation in a way that is not permissible under Xen. If TLS is not disabled, an emulation mode is used within Xen which reduces performance substantially. We hope that this issue can be resolved by working with Linux distribution vendors to implement a minor backward-compatible change to the TLS library. 大意是使用2.6内核的用户需要禁止TLS(执行这个命令 #mv /lib/tls /lib/tls.disabled),否则性能会下降 **对于2.6的内核,可以根据上述各项原则相应修改后自行配置编译 1.8、所有修改就绪,编译安装Xen Xen还需要用到3个软件(Twisted Matrix Framework,Python Logging package,iptables),如果机器上没有的可以用以下命令安装: #cd /tmp/xen-2.0 #make install-twisted; #make install-logging; #make install-iptables; 接下来开始编译安装(我没有latex,所以不编译doc) #make install-xen; #make install-tools; **注意,这里不要再执行make kernels或make install-kernels,因为在第7步我们已经手动配置并编译安装了被xen修改的新内核 1.9、修改启动配置 /boot/grub/grub.conf (以下是针对2.4内核和我的128M内存的机器的,Xen大概占了12M左右,若是2.6内核和更大的内存则进行相应修改,强烈推荐使用256或更多的内存) 添加: title Xen 2.0 / XenLinux 2.4 kernel /boot/xen-2.0.gz dom0_mem=53248 module /boot/vmlinuz-2.4-xen0 root=/dev/hda2 ro console=tty0 1.10、测试Xen,配置ttylinux 1)、下载并解压ttylinux (http://sf.net/projects/xen/) #cd /tmp #wget http://jaist.dl.sourceforge.net/sourceforge/xen/ttylinux-xen.bz2 #bzip2 -d ttylinux-xen.bz2 2)、创建配置文件: /etc/xen/auto/ttylinux 内容: kernel = "/boot/vmlinuz-2.6-xenU" memory = 64 name = "ttylinux" nics = 1 ip = "1.2.3.4" disk = ['file:/tmp/ttylinux-xen,sda1,w'] root = "/dev/sda1 ro" **如果/boot里面没有vmlinuz-2.6-xenU或vmlinuz-2.4-xenU,可以从Xen的二进制安装包/boot目录中得到 3)、重新启动,进入XenLinux,执行命令,创建domain(就是启动一个虚拟的ttylinux) #xend start #xm create /etc/xen/auto/ttylinux -c 查看xm的详细用法: #xm help 如果ttylinux顺利启动进入login界面,且能ping得到,证明第一阶段的安装基本成功了. 第二阶段:安装domU - Xentoo 这里是探讨怎么样把Gentoo作为domU安装到文件而不是真实分区的方法,不同于HOWTO_Xen_and_Gentoo 主要参考 <Gentoo Linux 硬盘安装参考指南>,<Gentoo Linux x86 手册>,<Xen Users' manual> - "A. Installing Xen / XenLinux on Debian" 2.1、 首先制作硬盘映像文件(root:4G,boot:32M,swap:256M),若直接安装到硬盘分区,可跳过这一步 上一篇:构建一个 SELinux 就绪的 Gentoo 系统 下一篇:Gentoo 下LAMP 的安装和配置 更多相关文章
|
推荐文章
精彩文章
|