Installation on Fedora
From Linux-VServer
Author: C Campbell OS: Fedora Core 6 Project: Vserver Installation
This wiki entry was tested on Fedora Core 6, but should work for any Fedora. Hardware is a pizza box 1U server single proc:
Intel(R) Pentium(R) 4 CPU 2.40GHz stepping 04 1 GB Memory Intel i845 Chipset It is possible to install everything needed using yum. First consider that Vserver requires a customer kernel provided by Daniel Hokka Zakrisson's packages for Fedora Of course, YOU can build your own Vserver kernel from source.
Cannot recommend this guide for production level.
Much of this information was ripped from this wiki entry: http://oldwiki.linux-vserver.org/VServer+installation+Fedora+Core+5 The base FC 6 is a minimal custom install from CD 1 - 2. All additional packages and updates were installed using yum. Disk considerations When creating the base system, if possible, partition only needed space and leave free space available for things like apache content, or vservers. Its recommended that vservers have a partition of there own, but if possible create a partition for EACH vserver. Disable SELinux As instructed by the FC 5 Vserver wiki, the following steps were taken to disable SELinux. Would love to know more about SELinux and leave it enabled on the base system. sudo vi /etc/selinux/config
SELINUX=disabled sudo yum -y upgrade At this point I rebooted to make sure SELinux disabled, but you can wait until later. Install util-vserver sudo yum install util-vserver Install the custom kernel Create a new yum repository file. sudo vi /etc/yum.repos.d/dhorac-vserver.repo Paste this: [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 your existing Fedora updates yum repository file sudo vi /etc/yum.repos.d/fedora-updates.repo Add this line to each repository block exclude=kernel kernel-smp yum Remove your existing kernel To find your existing kernel uname -a This will be different depending on your kernel sudo yum remove kernel-2.6.18-1.2868.fc6 sudo yum install kernel If you have a multi- core or processor machine use kernel-smp Watch Yum and make sure you see the kernel downloaded from Dhozac, not fedora updates Reboot /sbin/init 6 When your machine reboots check to make sure the kernel loaded uname -a You should see something like this 2.6.18-1.2861.fc6.vs2.0.2.2.0.rc9.1 The important bit is "fc6.vs2" At this point I tried to create a vserver but found out that I needed util-vserver-build FYI: you will need util-vserver{-core,-lib,-i386,-sysv,-build} sudo yum install util-vserver-build Install chroot Yum sudo yum update yum Now you should have a chroot version of yum (yum.noarch 3.0.1-2.fc6.chroot)
To make sure
sudo tail /var/log/yum.log At this point we're ready to build a vserver. Build a vserver For this vserver I created a 10GB partition called /vserver1. My base server is on 192.168.1/24 so I'll stay on that subnet. I'll call my vserver bianca. Context has something to do with unique UIDs in the kernel. For more on all the build options vserver build build --help
Here is a bash script you can use to create a vserver.
#!/bin/bash
ROOTDIR="/vserver1" PKGBASE="/vserver1/.pkg" SUDO="sudo" HOSTNAME="bianca" VSERVER=$HOSTNAME IP="eth0:192.168.1.106/24" INTERFACE="bianca0" CONTEXT="43" DIST="fc6" PM="yum"
echo "$SUDO /usr/sbin/vserver $VSERVER build / -m $PM --context $CONTEXT / --hostname=$HOSTNAME --interface $INTERFACE=$IP / --rootdir $ROOTDIR --pkgbase $PKGBASE -- -d $DIST -- rsyslog"
#EOF
At this point you'll wait for yum to get started, then you'll see expected yum download output. Yum will download kernel hook packages and then it will download a minimal set of user packages. The yum process finishes as expected, but I got this warning/error: /usr/lib/util-vserver/distributions/fc6/initpost: line 105: 3587 Killed $_VSERVER "$vserver" exec bash -c ': >/tmp/startwait' >&/dev/null Not sure which part of this script is broken, but it did not impact the install, so move on. Technically at this point you should be able to start the vserver. sudo vserver bianca start sudo vserver bianca status This will take you "inside" the Vserver to a shell. sudo vserver bianca enter
Now, if you entered the vserver, get out of the vserver and stop it.
Ctrl + D
sudo vserver bianca stop
sudo vserver bianca status Install minimal packages
The FC 5 wiki entry talks about unmanaged guest package management Here the guest is able to run its own yum.
# to enable unmanaged guest vyum gast -- install yum vserver gast running && vserver gast stop vserver gast pkgmgmt internalize
I decided to use "managed guest" package management. Here the base server will update the guest (vserver) The vserver must be stopped for these vyum steps. sudo vyum bianca -- install openssh-server sudo vyum bianca -- install vim-minimal sudo vyum bianca -- install passwd After each of these commands you'll see normal yum install output.
Now enter your vserver.
sudo vserver bianca start
sudo vserver bianca enter
Make sure you see a different bash prompt now, which means your in the vserver.
Now setup your shadow passwd file and set root passwd.
pwconv
pwck passwd root
Set the nameserver by modifying resolv.conf
echo "nameserver 192.168.1.1" >> /etc/resolv.conf
Set the timezone file.
cp -f /usr/share/zoneinfo/<your timezone> /etc/localtime Things to keep in mind. Most of the problems I encountered were network related. 1. Modify your firewall.
Fedora has a firewall in place by default and it will block your Vserver.
Check your firewall. sudo /sbin/iptables -L 2. SSHD will not work until you either change the Listen from all interfaces on your base machine, or change the port for your Vserver SSHD. Otherwise they collide.