主要参考下面两旁文章,先贴过来,以后再整理。

http://oceanobservatories.org/spaces/display/CIDev/Xen+on+Ubuntu+9.04+(Jaunty)

http://linux.com/community/blogs/Xen-Create-a-Jaunty-DomU-using-xen-create-image.html

安装xen

Xen on Ubuntu 9.04 (Jaunty)

Added by Thomas Im , last edited by Thomas Im on Jun 11, 2009  (view change) Labels:  (None) Following applies to Ubuntu 9.04 Jaunty 64-bit installation.  Notes taken from rebuild of ‘amoeba’ development system. Installation

sudo apt-get install ubuntu-xen-server # Jaunty Xen package does not include the dom0 Xen kernel so these must be installed separately  wget http://security.debian.org/debian-security/pool/updates/main/l/linux-2.6/linux-modules-2.6.26-2-xen-amd64_2.6.26-15lenny3_amd64.deb wget http://security.debian.org/debian-security/pool/updates/main/l/linux-2.6/linux-image-2.6.26-2-xen-amd64_2.6.26-15lenny3_amd64.deb  sudo dpkg -i linux-modules-2.6.26-2-xen-amd64_2.6.26-15lenny3_amd64.deb linux-image-2.6.26-2-xen-amd64_2.6.26-15lenny3_amd64.deb  sudo apt-get install python2.5 shutdown -r now   sudo vim /etc/network/interfaces .. auto eth0 iface eth0 inet static   address xxx.xxx.xxx.xxx   gateway xxx.xxx.xxx.xxx   netmask 255.255.255.0   sudo vim /etc/resolv.conf … domain ucsd.edu search ucsd.edu  nameserver xxx.xxx.xxx.xxx nameserver xxx.xxx.xxx.xxx   sudo /etc/init.d/networking restart  
Create Jaunty DomU (Guest) [http://linux.com/community/blogs/Xen-Create-a-Jaunty-DomU-using-xen-create-image.html]
References: https://help.ubuntu.com/community/Xen
http://www.infohit.net/blog/adate/053109/archive/1.html
http://www.chrisk.de/blog/2008/12/how-to-run-xen-in-ubuntu-intrepid-without-compiling-a-kernel-by-yourself/

安装guest系统 These are instructions for creating an Ubuntu Jaunty DomU on Debian Lenny Dom0 using Xen 3.2.1 that comes with Lenny.  I’m installing into an LVM rather than using a file image.  See this HowtoForge article for background of my particular setup.  This tutorial assumes you’re working from a similar setup with an iscsi target and LVM-based VMs. The reason I’m posting this is because I had such a hard time finding some combination of tools that worked correctly to do this.  I tried a few options but had little success:

  • debootstrap - Didn’t seem to work with Jaunty at all.  It would just crash
  • vm-install - Doesn’t support LVM-based VMs by default, but there is a procedure for converting the qcow image to an LVM
What I found is that I could find no way of creating the LVM-based VM in Lenny.  I actually had to create a sid instance first and then install my open-iscsi and xen-utils into the sid VM, then use SID to populate the VM. 
Perform the following actions in your SID vm or workstation
Note:  You’ll need your /etc/xen-tools/xen-tools.conf setup like the instructions in the HowtoForge article (things like gateway, netmask, broadcast, passwd, fs type, install-method, etc).
Whenever I would try to build the vm with the default partitions, it would always fail.  For some reason the resulting vm would have an fstab that shows something like sda1 and sda2 instead of xvda1 and xvda2.  I had to create my own partition scheme before anything would work right.  Here’s mine: $ sudo cat /etc/xen-tools/partitions.d/with-data
[root]
size=4G
type=ext3
mountpoint=/
options=sync,errors=remount-ro
[swap]
size=512M
type=swap
[data]
size=4G
type=ext3
mountpoint=/data
options=nodev You will need to create a symlink for jaunty so that the option is recognized at the command-line.  $ cd /usr/lib/xen-tools $ sudo ln -s edgy.d jaunty.d  Now, finally, you can create the image.  This step may take some time $ xen-create-image –hostname=myserver –dhcp –lvm=vg_xen –dist=jaunty –mirror=http://archive.ubuntu.com/ubuntu –size=4Gb –memory=512Mb –swap=512MB –arch=i386 –partitions=with-data Since you’re building the LVM on a different machine than it will eventually run on, you’ll need to  copy the resulting xen config to the correct server: $ scp /etc/xen/myserver.cfg root@realhost:/etc/xen/ That should be all you need to get this working.