个人工具

UbuntuHelp:XenVirtualMachine

来自Ubuntu中文

Oneleaf讨论 | 贡献2007年5月13日 (日) 11:31的版本 (New page: {{From|https://help.ubuntu.com/community/XenVirtualMachine}} {{Languages|php5}} Xen virtualization allows you to run other Operating Systems inside Ubuntu. These may be either specially ...)

(差异) ←上一版本 | 最后版本 (差异) | 下一版本→ (差异)
跳转至: 导航, 搜索


Xen virtualization allows you to run other Operating Systems inside Ubuntu. These may be either specially modifed guest OSs (like Ubuntu or other Linux distros), or if your CPU has hardware support for virtualization it, unmodifed Operating Systems (like Windows).

Xen began as a research project at the University of Cambridge. XenSource is a spinoff that's attempting to improve and market Xen to commercial users. They also host a lot of useful documentation, much of it in the Xen Wiki.

Installing Xen on Ubuntu

Since release 6.10 (Edgy Eft), Ubuntu contains packages for the xen virtualization technology. The packages can be found within the universe repository, a tutorial is available in /XenOnUbuntuEdgy

Earlier Ubuntu releases required you to install Xen by other means. Most often this would be from binary packages of Xen kernels and utilities made available by the Xen project. There are two wiki pages: XenOnUbuntuBinaryInstall and UbuntuHelp:/XenOnUbuntuBreezy.

Other interesting writeups about Xen on Ubuntu or other Linuxes:

Xen 3.03 on Feisty

Go to XenVirtualMachine/XenOnUbuntuFeisty


Xen 3.03 on Edgy

Go to XenVirtualMachine/XenOnUbuntuEdgy

Xen 3.03 on Dapper

My rationale is simple: I'm setting this sucker up using Dapper because it's a server, and I prefer the longer term of support (and stability) over having the lastest versions of things. So even though Edgy makes it easier, Xen on Dapper seems to me to be a pretty sensible server setup. Ideally I'll not be updating this until I'm changing the hardware again...

For the most part the Xen installation was guided by the writeup from Hoto Forge, referenced above. A rough manual diff while it's fresh:

  • used the 6.06.1-server-install-i386 for base install; added a few tools (openssh-server, eg.)
  • install was on a 3ware mirror pair, and I used a single 3G root (sda1) plus LVM - this changes names, which is trivial, and is IMHO far better than using looped files as in the base document
  • used Xen 3.03 tarball instead of 3.01: unpacks to a directory named dist
  • iproute already installed; python ditto *or* was pulled in as a dep of twisted
  • instead of symlinking libcrypto (as in XenOnUbuntuBinaryInstall), I installed libssl0.9.7
  • used update-rc.d xend defaults 30 31 and update-rc.d xendomains defaults 31 30 - I took the use of defaults from one (rather than unnecessary magic number lists), and avoiding an already busy number area from the other. At least on this install, 30 was free space...
  • with 3.03, the hacks to create directories in /var/run seem not to be necessary.
  • fixing the LOCKFILE path in xend's init script still seemed like a good idea; did it.

...and that brings us up to the point in the process where I'm ssh'd in and getting ready to setup a guest domain (again - this was the "do it right and take better notes" reinstall). LATER: had to leave this for a while; came back, noticed 3.0.4 tarballs were online, gave that a try. WARNING: 3.0.4's xend (or was it xendomain?) REQUIRES TLS. Yep, the same thing that Xen itself doesn't like (using Dapper's glibc). I am now, somewhat reluctantly, giving Edgy a spin, though having a shorter support lifetime for the Dom0 is really, really backwards from what I'd hoped for. But with Xen's move to requiring TLS for its infrastructure, that seems better than supporting my own libc spin with nonegseg on Dapper. Maybe by the time Edgy loses support KVM will be ready for production...

Creating Guest Systems and Running Them

there are notes on this in the various Xen documents, each of which seems to include something that others omit. A thorough cleanup could pull this (mostly Ubuntu version independent?) into one better version. If things go well, I'll be doing some work on that as I get a server consolidation project going here... gotta learn the questions first so I can answer them :-)

One thing I want to record before I lose track of it again is the section from the Sarge installation guide titled Installing Debian GNU/Linux from a Unix/Linux System. I had been trying to remember where I saw the neat trick of chrooting into the semi-installed system image to complete its setup - this is it.

Running Windows inside Xen

See /XenOnUbuntuEdgy for a tutorial howto setup xen on VT HArdware to run Windows. For ubuntu versions prior to 6.10 (Edgy Eft), the following document http://www.iku-ag.de/opensource/xen-on-sles.jsp for SuSE should also be adaptable to Ubuntu.

Older documentation and Discussion

MarkChang: As of 10.03.2005, I can't get to the Clarkson mirror to get any of the debs for Xen. [they changed the name of the file, go up a directory ;) ] However, I have met with great success with a mostly-manual install. Documented in /XenOnUbuntuHoary

MarkChang: Feb 26, 2006. In general, a Xen 3 on Breezy works fine. Basically the same as /XenOnUbuntuHoary. No need to build a new kernel if you don't really want to. Get the tarball install from the Xen site, and unpack it and follow the instructions. Some notes:

    • In some versions of the tarball, the instructions for the grub kernel are wrong. Here is what I use:

title Xen 3.0 / XenLinux 2.6.12 root (hd0,0) kernel /boot/xen.gz dom0_mem=65536 module /boot/vmlinuz-2.6.12.6-xen0 root=/dev/sda1 ro savedefault boot </code>

        • You can probably use /boot/vmlinuz-2.6-xen0, as it is symlinked in the right place

KynanCheng: May 6, 2006. Xen3.0 on Dapper Beta 2 works well using the manual install method. The only difference is that the current tarball uses one universal -xen kernel instead of the -xen0/U kernels. In order to get the system to boot, you will have to create an initrd file and add one more line to the Xen grub stanza <code>module /boot/initrd.img-xen-2.6 </code> (NOTE: it's a module line not an initrd line) See http://wiki.xensource.com/xenwiki/InstallationNotes?highlight=%28grub%29 and http://wiki.xensource.com/xenwiki/GettingStarted?highlight=%28initrd%29 for more information.

    • In some versions of the tarball, the Xen folks packed it with weird UIDs. Make '''certain''' that before you execute the install script you chown everything to root, ie. "<code>chown -R root: *</code>" from the place you unpacked the install tarball.

JasonSmithThailand: I am working on a Xen-on-Breezy document in /XenOnUbuntuBreezy. ----

I have packages mocked up right now, and they're nearly usable, although I have to fix the dependencies on them. I'll upload them somewhere to my website soon

I have confirmed that Ubuntu Hoary still uses devfs for dev entries in their initrds, so if you the default Xen kernel configs don't work for you, you may want to use an initrd and be sure you compile devfs in.

----

From redjar Wed Mar 30 22:35:37 +0100 2005 From: redjar Date: Wed, 30 Mar 2005 22:35:37 +0100 Subject: ubuntu/xen install howto Message-ID: <20050330223537+0100@https://www.ubuntulinux.org>

Came across this page: http://cosi.clarkson.edu/knowledge/workshops/sp05/installingxen/xen-tutorial.html

I have tested it, it works fine, but the files names have changed.

----

MartinManey: I'm starting out to try this on a fresh "server" install of Hoary. Of the packages they list as needed, I found bridge-utils, gcc, python-twisted, and the libcurl2-* packages were not already installed. At least without universe there don't appear to be any lubcurl2 packages, so my first attempt will be with libcurl3. ''Probably didn't need libcurl-dev or gcc to use the install kit. Worked well as far as getting Xen0 running. Getting the (expected) tls warning, but no visible problems so far. Lost eth0 config; patched in by adding "auto eth0" in /etc/network/interfaces for now.'' Had to create directories /var/lib/xen/xend-db/domain and .../vnet by hand before xend would run. I've since gotten a Fedora Core 3 image, built using the rpmstrap tool, to boot, but have been busy with other work since getting to that point.

----

JimKleckner: It would be good to have a brief discussion here (or if too big, a separate page) of whether it makes sense to eventually have Xen an option as part of a standard version of Ubuntu or not. What are the barriers?

----

JasonSmithThailand: I would very much like it if Xen were a standard part of Ubuntu. Virtualization is one of those things that you cannot live without, once you play with it. I think if Xen were known to run on the majory of Linux systems, there would be good opportunities for new kinds of cool software or tools. The reason I stopped halfway through documenting /XenOnUbuntuBreezy is becuase the kernel patches seemed mutually exclusive at the time, so it was not possible to augment an otherwise stock Ubuntu kernel with Xen. The only solution is doing a lot of work but still having a (slightly) incompatible kernel (mostly removing some drivers, IIRC) as other Ubuntu users.

----

chris.steelMontreal: Xen is really important and powerful. Para-virtualization totally rocks. Too bad I had to go back to a Hoary server in order to use it. The Ubuntu xen3 install page had some good clues but that mountain was too high! Perhaps a few 'history > xen3onbreezy.txt' links and a good Ubuntu kernel patch doc and the edited .h files might have got me through but my head was spinning and I caved. Hopefully Dapper will have a nice xen3 kernel selection and an initrd with at least LVM support and the other basic I/O etc. Any more breadcrumbs would be helpful ; )

JackWasey: Xen 3.0 merged with unstable debian: http://www.debian-administration.org/articles/396

--- Cartel: I have had success with Xen 3.0.2 under Dapper and have published unnofficial packages for it. See here: https://wiki.ubuntu.com/XenVirtualMachine/XenOnUbuntuDapper. Basically everything works except some uncommon hardware.


CategoryDocumentation CategoryCleanup

[[category:UbuntuHelp]]