This helper assumes intermediate knowledge of yum, grub, directory structure, shell scripting, package management, networking, ssh, system V daemon startup and general linux knowledge.
This talk supplements a few vserver webpages and uses them as references. I am not a vserver expert by any means this is only a help page to show what I have learning and still do not know.
Linux-Vserver, yet another linux virtualization scheme. Allows as many Virtual Private Servers (VPS) as resources will allow on a host. Similar to Freebsd jails, Solaris Containers and OpenVZ. Virtualization is done through isolation of process, system calls, file system etc. It is a sopisticated jail mechanism (chroot) which securely partitions resources like the file system, cpu time, network addresses and memory. Uses operating system-level virtualization by using "Capabilities" (partitioning root priviledges) in the kernel. Root in a vserver guest does not have root priviledges on the host server.
Linux-Vserver is "production stable" with a 2.2 version. It has been around a few years and is a community supported project. Vserver can run inside Xen.
The exact hardware configuration depends on how many Virtual Private Servers you are going to run on the computer and what load these VPSs are going to produce.
The more Virtual Private Servers you plan to run simultaneously, the more CPUs you need.
The more memory you have, the more Virtual Private Servers you can run. The exact figure depends on the number and nature of applications you are planning to run in your Virtual Private Servers. However, on the average, at least 1 GB of RAM is recommended for every 20-30 Virtual Private Servers
Each Virtual Private Server occupies 10-500 MB of hard disk space for system files (depends on the use of Unification) in addition to the user data inside the Virtual Private Server (for example, web site content). You should consider it when planning disk partitioning and the number of Virtual Private Servers to run.
Excellent explanation of vserver on wikipeida: http://en.wikipedia.org/wiki/Linux-VServer
It is also possible add a vserver patch and compile the kernel yourself (see: http://oldwiki.linux-vserver.org/Step-by-Step+Guide+2.6).
This helper copies directly from this webpage: http://wiki.linux-vserver.org/Installation_on_Fedora
Make sure selinux is disabled (or permissive mode?).
(Unless you really know what you are doing.)
Install vserver utilities. See installed files at the bottom of the page
yum install util-vserver{-core,-lib,,-sysv,-build}
Note: the ",," above is not a typo.
Make a new repo for vserver and yum. The dhorac repo contains a yum which is patched to work with vserver.
vi /etc/yum.repos.d/dhorac-vserver.repo
[dhozac-vserver] name=Daniel Hokka Zakrisson's packages for Fedora $releasever - $basearch - vserver baseurl=http://rpm.hozac.com/dhozac/fedora/$releasever/vserver/$basearch http://muh.at/dhozac/fedora/$releasever/vserver/$basearch gpgkey=http://rpm.hozac.com/fedora/conf/keys/RPM-DHOZAC-GPG-KEY enabled=1
Modify fedora-update.repo so yum will not update the kernel and yum.
vi /etc/yum.repos.d/fedora-updates.repo
Add this line in the "[updates]" section:
exclude=kernel kernel-smp yum
Find your existing kernel.
uname -a
Remove your existing kernel.
KERNEL=kernel-`uname -r` yum remove $KERNEL
Install the vserver kernel, which will use the new dhozac repo.
yum install kernel[-smp]
Reboot
/sbin/init 6
When your machine reboots check to make sure the kernel loaded.
uname -a
You should see something like: 2.6.18-1.2255.fc5.vs2.0.2.2.0.rc9.
The important bit is "fc5.vs2"
Install chroot Yum
yum update yum
Check your yum log that the download packages are there
tail /var/log/yum.log
For more on all the build options.
vserver build build --help
Here is a bash script you can use to create a vserver. By default vserver installs guests into /vservers.
#!/bin/bash HOSTNAME="leap" VSERVER=$HOSTNAME IP="eth0:192.168.3.210/24" INTERFACE="leap0" CONTEXT="43" DIST="fc5" PM="yum" #Context possibly has something to do with unique UIDs in the kernel. #This will use defaults: #/vservers for rootdir #/vservers/.pkg for pkbase #use --rootdir directory --pkgbase directory to change them #/vservers directory is made when vserver is installed #To test, echo the output first /usr/sbin/vserver $VSERVER build -m $PM --context $CONTEXT \ --hostname=$HOSTNAME --interface $INTERFACE=$IP -- -d $DIST #EOF
Yum will download packages for the guest vserver.
When yum finishes it may outputs a warning, possibly the script is broken, but the install seems successful
/usr/lib/util-vserver/distributions/fc6/initpost: line 105: 3587 Killed $_VSERVER "$vserver" exec bash -c ': >/tmp/startwait' >&/dev/null
vserver leap start vserver leap status vserver leap enter
Once inside the leap vserver guest "Ctrl + D" will exit the guest.
vserver leap status vserver leap stop
Use vyum (a chroot yum) for "Managed Guest" package management. The base server will update the guest (vserver). Unless enabled the guest will not be able to use yum for package management. If the only access a client has to the guest is by way of ssh then the client will not be able to install software.
The web page this helper references says "the vserver should be stopped for these vyum steps". I would guess because there may be activity happening on the guest. I was able to install using vyum without turning the vserver guest off. Prudence says turn the vserver guest off (better safe than sorry).
vyum leap -- install openssh-server vyum leap -- install passwd vyum leap -- install vim-minimal
Now setup your shadow passwd file, check its integrity and set root passwd.
pwconv pwck passwd root
Set the nameserver by modifying resolv.conf
echo "nameserver 192.168.3.1" >> /etc/resolv.conf ping www.leap-cf.org
Set the timezone file.
ln -sf /usr/share/zoneinfo/EST /etc/localtime
Set sshd to listen to its ip.
vi /etc/ssh/sshd_config ListenAddress the.vserver.guest.ip
Start sshd on the vserver guest
/etc/init.d/sshd start
Turn on Vserver daemon. Make sure you are in the host and not the guest.
chkconfig --level 2345 vservers-default on
Have the vserver guest start at host boot up
echo "default" > /etc/vservers/leap/apps/init/mark
Set sshd on host to listen only to its ip address. If not sshd on the host will intercept all sshd communication.
vi /etc/ssh/sshd_config ListenAddress the.vserver.host.ip /etc/init.d/sshd restart
See if you can ssh into the guest vserver. If you have problems check your filewall.
/sbin/iptables -L
Set up the guest for "Unmanaged Guest" package management. Here the guest will be able to use yum for package management.
vyum leap -- install yum vserver leap running && vserver leap stop vserver leap pkgmgmt internalize
When doing "vyum leap -- install yum" I got this error "/bin/chown: cannot access `/var/lib/rpm/[A-Z]*': No such file or directory" but did not seem to affect the installation.
See if yum works for the guest
vserver leap start vserver leap enter yum list
It is also possible to clone a vserver. Either from a local guest or a remote one. This is one of the very powerful features of virtualization. I have done it local to local with a wrapper script which that now does not exist on the Internet from where I got it from. I have been told the way to do it is with the vserver command.
vserver ... build --help
Another important feature, which I have not implimented (figured out) yet, is unification where files are hard linked between vservers. Thus only requiring one copy of the file. Separation between guests is still maintained. If a file changes on the source of the hard link then a new copy is made on the source and the hard link is severed. If I understand it right. This off course can save greatly on disk space.
One reason I find Linux-Vserver very interesting is it accomlishes much of what it does through regular and clever use of the standard Linux tool kit: chroot, rsync, cp, ln, yum, rpm, apt-get, scp, networking tools and more I am sure. Possibly Xen and other virtual emulators are simpler to use because much of this magic is hidden away by the more sophisticated emulating technology. I think with Linux-Vserver you get more of what Linux is so good at, or bad, depending on your view. There are many ways to do something.
Vserver has a mailing list and irc channel. Both of which you can find on its main site by clicking on the "support" link at the left. Both are active. Just this week the lastest vserver kernel would not compile on a new computer for me and on the irc channel Herbert Pötzl, the Vserver maintainer, found the problem and built a new vserver kernel that fixed the problem, within hours.
For many years our high load webserver has run on Vserver with our hosting company. They are very happy with it. Vserver has been around for a few years. It is up to a stable 2.2 version. Like many community projets, I think Vserver suffers for lack of documentation. To use its more advanced features I think you need to be very experienced in Linux and scripting. Though it has not stopped me from wanting to use it.
Home page for Linux-Vserver http://linux-vserver.org/Welcome_to_Linux-VServer.org
Vserver FAQ http://linux-vserver.org/Frequently_Asked_Questions
Documentation wiki: Installation on various distros, guides, configuration. Half way finished. http://linux-vserver.org/Documentation
Explains /etc/vservers configuration http://linux-vserver.org/util-vserver:Documentation
VServer Control Daemon (ACD) defines an API accessible by any caller capable of both the HTTP and the XMLRPC protocol. I do not know if there is a wrapper for the VCD which does not seem mature.http://linux-vserver.org/vcd:Introduction
Vserver is maintained by Herbert Pötzl at (you can download it from here) http://www.13thfloor.at/vserver/project/
Here is a 2004 white paper on Linux-Vserver http://www.13thfloor.at/vserver/papers/PAPER.txt
Install Linux-Vserver on Ubuntu http://www.linux.com/article.pl?sid=06/12/19/0456207. I got the feeling that Ubuntu and Debian seem to have good support for Vserver if not better than Fedora.
Vserver tips page here.
rpm -ql util-vserver-lib
/usr/lib/libvserver.so.0 /usr/lib/libvserver.so.0.0.0
rpm -ql util-vserver-sysv
/etc/rc.d/init.d/vprocunhide /etc/rc.d/init.d/vservers-default /usr/lib/util-vserver/vserver-wrapper /usr/lib/util-vserver/vsysvwrapper
rpm -ql util-vserver
/etc/vservers /etc/vservers/.defaults /etc/vservers/.defaults/apps /etc/vservers/.defaults/files /sbin/vshelper /usr/lib/util-vserver/capchroot /usr/lib/util-vserver/chain-echo /usr/lib/util-vserver/check-unixfile /usr/lib/util-vserver/chroot-sh /usr/lib/util-vserver/defaults /usr/lib/util-vserver/defaults/environment /usr/lib/util-vserver/defaults/mtab /usr/lib/util-vserver/defaults/vprocunhide-files /usr/lib/util-vserver/exec-ulimit /usr/lib/util-vserver/fakerunlevel /usr/lib/util-vserver/filetime /usr/lib/util-vserver/functions /usr/lib/util-vserver/keep-ctx-alive /usr/lib/util-vserver/lockfile /usr/lib/util-vserver/mask2prefix /usr/lib/util-vserver/readlink /usr/lib/util-vserver/save_ctxinfo /usr/lib/util-vserver/secure-mount /usr/lib/util-vserver/sigexec /usr/lib/util-vserver/start-vservers /usr/lib/util-vserver/vprocunhide /usr/lib/util-vserver/vserver.delete /usr/lib/util-vserver/vserver.functions /usr/lib/util-vserver/vserver.start /usr/lib/util-vserver/vserver.start.bin /usr/lib/util-vserver/vserver.stop /usr/lib/util-vserver/vserver.suexec /usr/lib/util-vserver/vservers.grabinfo.sh /usr/lib/util-vserver/vshelper /usr/lib/util-vserver/vshelper-sync /usr/sbin/exec-cd /usr/sbin/vdu /usr/sbin/vps /usr/sbin/vpstree /usr/sbin/vserver /usr/sbin/vserver-stat /usr/sbin/vsomething /usr/sbin/vtop /usr/share/doc/util-vserver-0.30.212 /usr/share/doc/util-vserver-0.30.212/AUTHORS /usr/share/doc/util-vserver-0.30.212/COPYING /usr/share/doc/util-vserver-0.30.212/ChangeLog /usr/share/doc/util-vserver-0.30.212/NEWS /usr/share/doc/util-vserver-0.30.212/README /usr/share/doc/util-vserver-0.30.212/THANKS /usr/share/doc/util-vserver-0.30.212/compatibility.html /usr/share/doc/util-vserver-0.30.212/configuration.css /usr/share/doc/util-vserver-0.30.212/configuration.html /usr/share/man/man8/vpstree.8.gz /usr/share/man/man8/vserver-stat.8.gz /usr/share/man/man8/vserver.8.gz /usr/share/man/man8/vtop.8.gz /var/cache/vservers /var/run/vservers /var/run/vservers.rev /var/run/vshelper
rpm -ql util-vserver-core
/usr/lib/util-vserver /usr/lib/util-vserver/FEATURES.txt /usr/lib/util-vserver/chbind-compat /usr/lib/util-vserver/chcontext-compat /usr/lib/util-vserver/util-vserver-vars /usr/sbin/chbind /usr/sbin/chcontext /usr/sbin/chxid /usr/sbin/lsxid /usr/sbin/naddress /usr/sbin/nattribute /usr/sbin/ncontext /usr/sbin/reducecap /usr/sbin/setattr /usr/sbin/showattr /usr/sbin/vattribute /usr/sbin/vcontext /usr/sbin/vdlimit /usr/sbin/vkill /usr/sbin/vlimit /usr/sbin/vnamespace /usr/sbin/vrsetup /usr/sbin/vsched /usr/sbin/vserver-info /usr/sbin/vuname /usr/sbin/vwait /usr/share/man/man8/chbind.8.gz /usr/share/man/man8/chcontext.8.gz /usr/share/man/man8/reducecap.8.gz