You're a fan of [Fedora Linux]? You want to play around with Linux-VServer's or use them in production? But you are new to this and want an easy way to (quickly) start wi |
You're a fan of [Fedora Linux]? You want to play around with Linux-VServer's or use them in production? But you are new to this and want an easy way to (quickly) start with a running system?
Note: If you didn't want a VServer installation guide to Fedora Core 4, maybe you were searching for a guide like this: [The Perfect Setup - Fedora Core 4] This guide is aimed to assist you in a plain and basic installation "from scratch" to a running VServer enabled host system with also one installed basic guest system. It is assumed that you have basic knowledge of Linux administration and Fedora 4. ----- == [[Anchor Page_Index]] Page Index / Contents == * [1. installing the host system] * [2. Installing a vserver enabled kernel] ** [2.A Installing the kernel from source] ** [2.A Alternative: Installing the kernel from Experimental source] ** [2.B Installing the host kernel from rpm] * [3. Installing the vserver utilities on the host system] ** [3.A Installing the vserver utilities from source] ** [3.A Alternative: Installing the vserver utilities from Experimental source] ** [3.B Installing the vserver utilities from rpm] * [4. Final host configuration] * [5. Build your first guest system] * [6. Things you might want to consider / remember] IMPORTANT! * [7. Configure your (first) guest system] ----- === [[Anchor pre-requisites]] What you need: === * The Fedora Core installation CDs (you can get a list of mirrors from the [fedora website]) * a bit of clue in server administration (to avoid another bot system in the net) * working internet access (of course) to download remaining stuff * enough time to work through this guide (and probably enough coffee and pizza ;-) ) === What you don't need: === * Money (this guide is based on free available soures; [donations] to the developers are appreciated though) * paid support tickets (they won't assist you - better look on the [Mailing List] or on the IRC channel) ----- == Okay, let's start: == === [[Anchor g1]] 1. installing the host system === * boot from the FC4 CD and install a basic system (e.g. custom and "minimal" plus development tools; main services should always run on the guest system) ** Hint: It usually makes sense to create a '/vservers' partition to contain the guest systems - if you need more space, you can easily move that partition to a new, larger disc and prevent long downtimes * IMPORTANT: SElinux must be deactivated (unless you know exactly what you're doing!) **/etc/selinux/config <code> SELINUX=disabled </code> * log into the installed system and upgrade it to the latest updates ** Hint: You may want to exclude kernel updates in your update repo to prevent unnecessary download of kernels as shown in [Step 2] below. <code> yum -y upgrade </code> ----- === [[Anchor g2]] 2. Installing a vserver enabled kernel === * IMPORTANT: There are two methods of installing a vserver kernel on Fedora Core 4: [from source] and [from precompiled RPM]. Use one or the other. Do not use both. Recommended variant is [from RPM], this is proven, stable and contains latest tested releases. * You should make sure that Fedora Core kernels don't take precedence over the vserver kernels, do this by adding exclude=kernel to /etc/yum.repos.d/fedora-updates.repo. It might look something like this when you're done: ** /etc/yum.repos.d/fedora-updates.repo: <code> [updates-released] name=Fedora Core $releasever - $basearch - Released Updates #baseurl=http://download.fedora.redhat.com/pub/fedora/linux/core/updates/$releasever/$basearch/ mirrorlist=http://fedora.redhat.com/download/mirrors/updates-released-fc$releasever enabled=1 gpgcheck=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-fedora exclude=kernel kernel-smp </code> ----- ==== [[Anchor g2A]] A. Installing the kernel from source ==== * download the relevant ['vanilla' kernel source] used by the recent [stable release] ** example (use your preferred mirror instead): <code> cd /usr/src wget ftp://ftp.probe-networks.lkams.kernel.org/pub/linux/kernel/v2.6/linux-2.6.14.3.tar.bz2 tar xjf linux-2.6.14.3.tar.bz2 </code> * download the kernel-patch from the latest [stable release] and apply it: <code> cd /usr/src wget http://www.13thfloor.at/vserver/s_rel26/v2.01/patch-2.6.14.3-vs2.01.diff.bz2 bzip2 -d patch-2.6.14.3-vs2.01.diff.bz2 cd linux-2.6.14.3 patch -p1 < ../patch-2.6.14.3-vs2.01.diff </code> * copy the latest config from your /boot directory to the kernel source tree and configure your VServer options: ** example: <code> cd /usr/src/linux-2.6.14.3 cp /boot/config-`uname -r`.config .config make menuconfig </code> *** Enable the Legacy Kernel API option in the kernel config (Section "Linux VServer") *** If you are using an x86_64 system do not forget to enable the IA32 emulation (Section "Executable file formats / Emulations") if you want to use 32bit guests on your system! *** exit and save configuration * build your new kernel and install it ** example (IMPORTANT: you have to use your relating boot loader/boot manager installation!): <code> make bzImage && make modules && make modules_install && make install </code> ** (you may want to take a cup of coffee and/or a pizza while this is running, depending on your hardware) ** important note: You may want to activate your VServer kernel in /boot/grub/grub.conf as your default kernel so that it's loaded on reboot by default. To do this, just change the default=N to point to your VServer entry (starting with first entry beeing default=0; just count down then) * reboot your system and continue with [step 3]. ----- ==== [[Anchor g2Aexp]] A. Alternative: Installing the kernel from Experimental source ==== * you may use a later kernel with [Experimental release candidates] (still considered to be stable) as well, as often recommended by Herbert Poetzl on the mailing list ** alternative steps for [above] (also use your preferred mirror instead): <code> cd /usr/src wget ftp://ftp.probe-networks.lkams.kernel.org/pub/linux/kernel/v2.6/linux-2.6.16.20.tar.bz2 tar xjf linux-2.6.16.20.tar.bz2 wget http://vserver.13thfloor.at/Experimental/patch-2.6.16.20-vs2.0.2-rc22.diff cd linux-2.6.16.20 patch -p1 < ../patch-2.6.16.20-vs2.0.2-rc22.diff cp /boot/config-`uname -r`.config .config make menuconfig </code> ** configure and install your kernel as [above] ----- ==== [[Anchor g2B]] B. Installing the host kernel from rpm ==== * Daniel Hokka Zakrisson has provided rpms for both the vserver-kernel and util-vserver software. To activate his repository of software add the following file to your /etc/yum.repos.d/ directory: ** dhozac.repo: <code> [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 </code> *Once the repository is added issue the following command to install the vserver kernel. **For Single processor systems <code> yum install kernel </code> **Or for SMP systems <code> yum install kernel-smp </code> *reboot your system and continue with [step 3]. ----- === [[Anchor g3]] 3. Installing the vserver utilities on the host system === *IMPORTANT: Like the vserver kernel, util-vserver can be installed either [from source] or [from precompiled RPM]. The use of both *will* result in problems, so choose only one or the other! ----- ==== [[Anchor g3A]] A. Installing the vserver utilities from source ==== * download the latest util-vserver alpha release and (if applicable) also the latest patch from the latest [stable release] and apply the patch (if applicable) ** example: <code> cd /usr/src wget http://www.13thfloor.at/vserver/s_rel26/v2.01/util-vserver-0.30.209.tar.bz2 tar xjf util-vserver-0.30.209.tar.bz2 </code> ** IMPORTANT: At this point, make sure you have installed dietlibc and beecrypt/-devel by using: <code> yum install -y dietlibc beecrypt-devel </code> * build and install the util-vserver tools ** example (installing tools in /lib and /sbin and also /etc/init.d): <code> cd /usr/src/util-vserver-0.30.209 ./configure make && make install && make install-distribution </code> Now continue with [step 4] ----- ==== [[Anchor g3Aexp]] A. Alternative: Installing the vserver utilities from Experimental source ==== * Same as with the kernel, from time to time there are [releases of new utilities] still considered beeing stable, but not yet linked to the "official" release. ** alternative steps for [above]: <code> cd /usr/src wget http://www.13thfloor.at/~ensc/util-vserver/files/alpha/util-vserver-0.30.210.tar.bz2 tar xjf util-vserver-0.30.210.tar.bz2 </code> ** IMPORTANT: At this point, make sure you have installed dietlibc and beecrypt/-devel by using: <code> yum install -y dietlibc beecrypt-devel </code> * build and install the util-vserver tools ** example (installing tools in /lib and /sbin and also /etc/init.d): <code> cd /usr/src/util-vserver-0.30.210 ./configure make && make install && make install-distribution </code> Now continue with [step 4] ----- ==== [[Anchor g3B]] B. Installing the vserver utilities system from rpm ==== * Issue the following command to install the vserver utils (assuming you have enabled Daniel Hokka Zakrisson's repo as mentioned [above]). <code> yum install util-vserver* </code> Now continue with [step 4] ----- === [[Anchor g4]] 4. Final host configuration === * Note: This section is not necessary if you used the RPMs above. In that case continue with [step 5] * You now have the VServer kernel and utils installed, you are almost ready to create your first VServer, but first we must prepare the host. * test the installed kernel to see if it is operational ** Note: we used the [testme.sh] script from Herbert to test the system ** example: <code> cd /usr/src wget http://vserver.13thfloor.at/Stuff/SCRIPT/testme.sh chmod 700 testme.sh;./testme.sh </code> ** Hint: If the above test fails, first check that /sbin/ is in your path - it probably won't be if you did change to root using su rather than su - ! * replace the FC4 yum with a patched version ** FC4's yum does not work with chroot system correctly, so we must replace it. I [1] have applied the patch to the actual 2.4.1-1 rpm package and linked this for public use in the FC4 patched rpm's section. ** Installation example: <code> rpm -U http://muh.at/rpm/yum-2.4.1-1.chroot.fc4.noarch.rpm </code> * Start /etc/init.d/vprocunhide and add it to boot scripts: ** Read Proc-Security for more information about this issue <code> /etc/init.d/vprocunhide start chkconfig --add vprocunhide chkconfig vprocunhide on </code> * Note: if you installed the util-vserver support programs from sources without using "prefix=" (no path), you will need to copy the vprocunhide script from <prefix>/etc/init.d to /etc/init.d so that it can be started by the Fedora boot process (if <prefix> is not set, it defaults to /usr/local). * Set the "barrier" attribute to the "/vservers" directory: **Further information can be found on the alpha util-vserver page at "2.4 to 2.6 transition" <code> setattr --barrier /vservers </code> Copy the PGP keys to the distribution directory of the utils (otherwise they will not be found on guest build time) * Hint: If you used another prefix for utils, add accordingly to the path <code> mkdir /lib/util-vserver/distributions/fc4/pubkeys/ cp /etc/pki/rpm-gpg/* /lib/util-vserver/distributions/fc4/pubkeys/ </code> Now your FC4-vs2.0 host is ready to go. ----- === [[Anchor g5]] 5. Build your first guest system === * IMPORTANT: It is wise to prepare your vserver build command "on paper" before rushing ahead as a rebuild will take several minutes. For a list and description of all vserver build options read the output of vserver XXX build --help * Set up your vserver using your prepared command. It should look similar to the following. ** example: <code> vserver gast build -m yum </code> * To install further packages to the guest from the host use vyum <vservername> -- install <package> if you chose not to internalize package management. If you are using internal package management you must use yum install <package> from within the guest system (see [step 6]). ----- === [[Anchor g6]] 6. Things you might want to consider / remember === * IMPORTANT: Before you can use the yum (or the apt) command from within a guest you must activate internal package management as shown below. If you only want a managed guest, do not install yum on the guest and do not activate internal package management! <code> # to enable unmanaged guest vyum gast -- install yum vserver gast pkgmgmt internalize </code> * Probably helpful and/or necessary rpm packages to install into each guest: ** yum (if you want internal package management / unmanaged guests) ** openssh-server (if you want to have remote shell access) ** rootfiles (always good if you want to use "root" usage) ** vim-minimal (or any other editor you might like to edit any text file, e.g. joe, nano) ** passwd (otherwise you will not be able to change your passwords) ** system-config-date (if you want to easily set a timezone for the guest) ** which (always helpful) ** vixie-cron, crontabs (to have a working crond/crontabs) ** sendmail or postfix (to have a mailsystem as well, you may use any preferred mailer) ** xinetd (if you want rpc services) ** pure-ftpd (if you want to run a ftp-server which may take user's from a database; look into FC4 patched rpm's page for a working guest version) * Caution: On FC4 Guests, due to the "audit" package, pam authentication (also used with openssh) enables "pam_loginuid.so" in the /etc/pam.d/* files. Comment those out as they are not necessary and will not load within a guest anyway. This probably is also necessary on updates later on, if the configs get changed. You therefore may add the following command line to a cronjob file or your software update script: <code> /bin/sed --in-place -e "s/^session.*required.*pam_loginuid.so/# session\trequired\tpam_loginuid.so/g" /etc/pam.d/* </code> * After you've installed and configured your services within the guest OS it's always a good idea (i.e it is necessary!) to ensure that each server instance binds only to its relating ip(s) to avoid annoying IP conflict. * If you want your new guest to start on host bootup, add a one-line tag to /etc/vservers/<vserver-name>/apps/init/mark. All marked vservers will be activated with a corresponding a /etc/init.d/vservers-<tag> script (usually just a copied and renamed /etc/init.d/vservers-default) ** example: <code> echo default >/etc/vservers/gast/apps/init/mark chkconfig add vservers-default chkconfig vservers-default on </code> * If you want to save a huge amount of space on not needed packages within a guest (e.g. kernel) it is recommended to replace them with the following fake packages: ** Note: If you used the RPM version of util-vserver, this is already the default. Continue with [step 7] ** Those three packages save around 50 MB of space on a fresh built FC4 guest - and even more on a fully configured one, as relating sub-dependancies are not required any more as well! ** Credits for those packages go to [The CRU APT Repository] ** Important: Download to and install the following three packages from the host system only! Therefore use external package management for this step! <code> wget http://naturidentisch.de/packages/fc4-vps/vps-dev/vps-dev-3.999-3.cru.noarch.rpm wget http://naturidentisch.de/packages/fc4-vps/vps-fakekernel/vps-fakekernel-2.6.999-2.cru.noarch.rpm wget http://naturidentisch.de/packages/fc4-vps/vps-fakepackages/vps-fakepackages-1.0-5.cru.noarch.rpm vrpm gast -- -Uhv vps-{dev,fakekernel,fakepackages}-* </code> *** [The CRU APT Repository] also supplies a repo for those three, as well as an vps-sysv and a vps-pam package. Those have not yet been tested - if you did, replace this line with your experiences and drop a note to the mailing list! ----- === [[Anchor g7]] 7. Configure your (first) guest system === * You can now "boot" into the system. ** example: <code> vserver gast start vserver gast enter </code> *You are now booted into your brand new VServer. A few things need to be set up before you can get going however *Create a shadow file within the guest and check it for errors: <code> pwconv pwck </code> *Set a root password. <code> passwd root </code> * Add a valid nameserver into /etc/resolv.conf so that the guest can use one ** example: /etc/resolv.conf: <code> nameserver 192.168.0.1 </code> ----- If you want some special procedure described on this page (which should be of public interest), either add yourself (you're welcome) or [mail to the autor]. Please do NOT mail the author for any support purposes, use the mailing list or IRC channel instead! For further issues like more fine-grained configuration etc. please read through the further documentation on this site. |