热门关键字:  ubuntu  分区  函数  Fedora  linux系统进程

当前位置 :| 主页>Linux发行版>Gentoo>

新手安装Xentoo(Xen+Gentoo)的极速体验

来源: 作者: 时间:2008-06-26 Tag: 点击:


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),若直接安装到硬盘分区,可跳过这一步

#dd if=/dev/zero of=xentoo-root.image bs=1024k count=4000
#dd if=/dev/zero of=xentoo-swap.image bs=1024k count=256

2.2、格式化文件系统(若直接安装到硬盘分区,则把image文件名改为相应的设备名)

#mkfs.ext3 xentoo-root.image
#mkswap xentoo-swap.image

2.3、挂装分区到新建的目录(若直接安装到硬盘分区,则把image文件名改为相应的设备名,并且mount命令不许要loop参数)

#mkdir /mnt/gentoo
#mount -o loop xentoo-root.image /mnt/gentoo

2.4、下载并解压stage3(http://mirror.gentoo.gr.jp/releases/x86/2005.1/stages/)放到gentoo的根也就是/mnt/gentoo (根据自己的CPU下载相应的包)
#cd /mnt/gentoo
#wget http://mirror.gentoo.gr.jp/releases/x86/2005.1/stages/i686/stage3-i686-2005.1.tar.bz2
#tar -xvjpf stage3-i686-2005.1.tar.bz2

2.5、设置系统环境
#chroot /mnt/gentoo /bin/bash

添加DNS:
echo "nameserver 202.96.128.86" >> /etc/resolv.conf
echo "domain xenlinux" >> /etc/resolv.conf

修改root密码
#passwd root

修改/etc/fstab

/dev/sda1 / ext3 errors=remount-ro 0 1
/dev/sda2 none swap sw 0 0
proc /proc proc defaults 0 0
shm /dev/shm tmpfs nodev,nosuid,noexec 0 0

退出
#exit
#umount /mnt/gentoo

2.6、创建xen配置文件/etc/xen/auto/xentoo (推荐使用256或更多的内存)

kernel = "/boot/vmlinuz-2.6-xenU"
memory = 64
name = "xentoo"
nics = 1
ip = "192.168.0.3"
gateway = "192.168.0.1"
disk = ['file:/mnt/xentoo/xentoo-root-image,sda1,w','file:/mnt/xentoo/xentoo-swap-image,sda2,w']
root = "/dev/sda1 ro"

**若直接安装到硬盘分区,则disk那一行改为:
disk = ['phy:hdaX,sda1,w','phy:hdaY,sda2,w']

hdaX,hdaY对应你分给Xentoo的root分区和swap分区
最新评论共有 0 位网友发表了评论
发表评论
评论内容:不能超过250字,需审核,请自觉遵守互联网相关政策法规。
用户名: 密码:
匿名?
注册