特殊:Badtitle/NS100:VServer

来自Ubuntu中文
Wikibot留言 | 贡献2009年5月12日 (二) 19:32的版本
跳到导航跳到搜索

{{#ifexist: :VServer/zh | | {{#ifexist: VServer/zh | | {{#ifeq: {{#titleparts:VServer|1|-1|}} | zh | | }} }} }} {{#ifeq: {{#titleparts:VServer|1|-1|}} | zh | | }}

What are VServers

The Linux VServer Project provides multiple Linux environments running inside a single Linux kernel. You can think of it as a bit like running a new system inside a chroot, but with a different host name and IP address, a de-fanged `root` user, and configurable resource management. This is a similar feature to jails on FreeBSD and containers on Solaris 10+. VServers are a different approach to the popular XEN Hypervisor; with XEN you end up with a kernel for each virtual server; VServers do not. So, with VServer you have less (virtually no) overhead, on the other hand you also have fewer features - it is currently impossible to have a VServer with a different time set to the host system, for instance. However it is possible to run a different time zone, as that is a purely user-space feature. The design of UNIX in general mean that for the vast majority of applications, this virtualisation technique is perfectly adequate. Note that Xen and VServer are orthogonal approaches - that is, it is perfectly possible and sometimes even sensible to run Xen virtual machines on a Linux system, then Linux VServers within those Xen machines.

Jaunty, Intrepid and Hardy

For Jaunty, Intrepid and Hardy there are binary kernel images available. Please take a look at Installation on Ubuntu at the Linux VServer wiki.

Installation (u32)

This describes how to install the VServer-enabled kernel packages built on top of Edgy's stock kernel (source is in http://git.u32.net/). If you want to verify the packages, you can add the package key to apt's keyring (this is optional). As of now packages are only available for x86 and amd64, hopefully more architectures will be supported soon. No kernel pre-built for feisty currently exists for Ubuntu. You'll have to use the Edgy 2.6.17 for now. Also, be careful to install the VServer tools using the Edgy repository, or versions won't match and you'll get segmentation faults.

$ wget -O - http://bronson.rinspin.com/u32-package-key.gpg | sudo apt-key add -

Now add the following repositories to your /etc/apt/sources.list. Read this page for instructions on how to add repositories.

deb http://dpkg.u32.net/ubuntu edgy vserver
deb-src http://dpkg.u32.net/ubuntu edgy vserver

Now, install the software packages and the kernel. Instead of vserver-generic, you can also supply any Ubuntu-supported flavor (vserver-i386, vserver-server, etc). Run 'cat /proc/version' to see what flavor kernel you're running now.

$ sudo apt-get install util-vserver vserver-debiantools
$ sudo apt-get install linux-vserver-image-2.6.17-11-vserver-generic

And reboot into your new, VServer-enabled kernel. This 2.6.17 Edgy kernel runs just fine on Dapper as well. Occasionally dpkg may stop claiming "error in postinst." This is just a bad interaction between older and newer kernel tools and, other than preventing the install from completing, it's harmless. Just purge and reinstall and it should work. You may want to run run ln -sf /vservers /etc/vservers/.defaults/vdirbase to specify where your vservers should reside (this puts them in /vservers). By default they are stored in /var/lib/vservers. The git tree for the patched kernel can be downloaded from http://git.u32.net.

Create a new guest

/etc/vservers/newvserver-vars (man newvserver(1) for options): DIST='dapper' MIRROR="http://us.archive.ubuntu.com/ubuntu" This command creates a new Ubuntu Dapper image. You can change "dapper" to "edgy" or whatever you want above. You can run virtually any Linux distribution as a guest (for instance, Gentoo). newvserver -v --hostname NAME --domain EXAMPLE.COM --interface ETHX --ip IPADDRESS See this page for some tweaks to make your Dapper guest a little more vserver-friendly. Run 'vserver NAME start' to start your new guest image, then 'vserver NAME enter' to use it.

Installation (Uniklu)

Installation is quite simple - you need:

  • Kernel with VServer patch
  • util-vserver
  • vserver-debiantools

You can install these packages if you add the following lines to your sources.list:

  • dapper

deb http://ubuntu.uni-klu.ac.at/ubuntu.uniklu/ dapper uniklu-vserver

  1. deb-src http://ubuntu.uni-klu.ac.at/ubuntu.uniklu/ dapper uniklu-vserver
  • edgy (not needed, already in universe)

The uniklu archives are signed - if you want get rid of apt-get warnings:

$ wget -nv http://ubuntu.uni-klu.ac.at/uniklu-debuild.pub -O - | sudo apt-key add -

To install the VServer Kernel and utils enter:

  • dapper
  1. apt-get install linux-image-2.6.15-(dapper_abi+1)-686
  2. apt-get install util-vserver vserver-debiantools
  • edgy
  1. apt-get install kernel-patch-vserver
  2. apt-get install util-vserver

You should get the following revisions

  • dapper
kernel -(dapper_abi+1)-2.6.15-(dapper_abi+1).(dapper_release)vs
util-vserver >= 0.30.210-0uk
vserver-debiantools >= 0.2.6
  • edgy
kernel-patch-vserver 2:2.0.1-4
util-vserver 0.30.210-10
vserver-debiantools 0.2.6

At the moment the kernel is one revision behind the offical Ubuntu Kernel - will be fixed soon ! Make sure you install the kernel from the uniklu-vserver archive. You may want to remove linux-image-<arch>-<kernel_type> and linux-<arch>-<kernel_type>. Also, you may create /etc/apt/preferences file with content:

Package: *
Pin: release v=6.04*,a=dapper,c=uniklu-vserver,o=UniversityKlagenfurt,l=uniklu
Pin-Priority: 1001

The vserver-debiantools do not work 100% but should help you setting your first vserver quickly - see Uniklu VServer Info The Kernel is the standard Ubuntu Kernel with the Vserver patch applied.

  • dapper: Vserver patch >= 2.0.2-rc13 for kernel-2.6.15
  • edgy: patch from universe should be up2date

The Kernel and binaries are available for i386 and amd64 It is possible and supported to run 32bit i386 VServers on an amd64 VServer Kernel.

Distributed Remote Block Device (DRBD)

DRBD can be used with VServer to build simple, robust and cheap High Availability (HA) solutions with disaster failover capabilty to a remote location. Simply put your VServers on a DRBD and let a heartbeat in another building take over the DRBD and start your VServers. DRBD utilities and kernel modules for the VServer enabled kernels are available in the above archive:

apt-get install drbd0.7-module-2.6.15-(dapper_abi+1)-arch drbd0.7-utils 

Build Yourself

I've created a tgz of the diffs and build script I'm using for building the kernel debs.

$ wget http://ubuntu.uni-klu.ac.at/ubuntu.uniklu/dists/dapper/uniklu-vserver/vserver-image-build.tgz
$ tar -xzf vserver-image-build.tgz
$ cd linux-vserver-2.6.15
$ ./kbuild.sh 

Links