About this list Date view Thread view Subject view Author view Attachment view

From: smagnuson_at_forzani.com
Date: Thu 07 Apr 2005 - 19:31:48 BST


I have vserver up and running on Crux linux. Below are my install notes. Any errors I have will (hopefully) get smoothed over on my next installation. Feel free to make comments / use this document if you desire.

thanks
sig

How to install and use vserver with Crux 2.0
http://crux.nu/
http://linux-vserver.org/

Notes:
        Expect to find errors
        I may be doing things completely backwards but it seems to work
        vservers are going to be installed onto seperate partition /vservers
        I use sudo for most root commands. If you prefer to use root then ignore sudo at front of commands

######
#
#Preparing your host server with vserver
#
######

#Get vserver code
cd ~/src/vserver
wget http://www.13thfloor.at/vserver/d_rel26/v1.9.5/util-vserver-0.30.204.tar.gz
gzip -d util-vserver-0.30.204.tar.gz
tar -xf util-vserver-0.30.204.tar

wget http://www.13thfloor.at/vserver/d_rel26/v1.9.5/linux-vserver-1.9.5.tar.gz
gzip -d linux-vserver-1.9.5.tar.gz
tar -xf linux-vserver-1.9.5.tar

# Get vanilla linux kernel and compile in vserver patch aquired from above
cd /usr/src
sudo wget ftp://ftp.kernel.org/pub/linux/kernel/v2.6/linux-2.6.11.5.tar.bz2
sudo bzip2 -d linux-2.6.11.5.tar.bz2
tar -xf linux-2.6.11.5.tar

cd linux-2.6.11.5
sudo cp ../linux-2.6.6/.config .
sudo cp ~/src/vserver/patch-2.6.11.5-vs1.9.5.diff
sudo patch -p1 -s <../patch-2.6.11.5-vs1.9.5.diff

sudo make menuconfig
sudo make all
sudo make modules_install

#Install newly patched kernel
cd /usr/src
sudo rm linux
sudo ln -s linux-2.6.11.5 linux

sudo cp /usr/src/linux-2.6.11.5/arch/i386/boot/bzImage /boot/vmlinuz-2.6.11.5-1
sudo cp System.map /boot/System.map-2.6.11.5-1
cd /boot
sudo ls -s System.map-2.6.6-2 System.map

sudo vi /etc/lilo.conf
...
...
image=/boot/vmlinuz-2.6.11.5-1
        label=KERNEL-4
        root=/dev/discs/disc0/part2
        read-only

sudo lilo -q
sudo lilo
sudo lilo -q

#Install additional/required software
sudo prt-get install iproute2
sudo prt-get install iptables
sudo prt-get install rsync

#Get vconfig binary
cd ~/src/
wget http://www.candelatech.com/~greear/vconfig
sudo cp vconfig /usr/local/sbin

#Complile and install vserver utilities
cd ~/src/vserver/util-vserver-0.30.204
./configure --prefix=/usr/local
make
sudo make install

#Create vserver guest OS directory
sudo mkdir -m 000 /vservers
sudo mkdir /vservers/vcrux01

#If using SSH (or any other port listening application) change it to listen to the specific interface (ie not 0.0.0.0)
sudo vi /etc/ssh/sshd_config
...
...
ListenAddress 172.27.12.19
...
...

#restart ssh and ensure it still works
sudo /etc/rc.d/sshd restart

######
#
#Building your first vserver
#
######
                                                                                             
sudo vserver vcrux01 build -m skeleton -n vcrux01 --context 100 --hostname vcrux01.domain.net --interface 172.27.12.24 --netdev eth0 --netmask 255.255.248.0 --initstyle plain

#Set up vserver barrier
sudo showattr -d /vservers
---bui- /vservers
sudo setattr --barrier /vservers
sudo showattr -d /vservers
---Bui- /vservers

#I don't think this is required anymore
#sudo chmod 0000 /vservers

#set default tty (not sure if this works)
sudo mkdir -p /usr/local/etc/vservers/.defaults/apps/init
cd /usr/local/etc/vservers/.defaults/apps/init
sudo ln -s /dev/tty6 tty

#Check the folowing files to ensure all it configured fine. If not edit files.
cat /usr/local/etc/vservers/vcrux01/apps/init/style
plain

cat /usr/local/etc/vservers/vcrux01/interfaces/dev
eth0

cat /usr/local/etc/vservers/vcrux01/interfaces/mask
255.255.248.0

cat /usr/local/etc/vservers/vcrux01/interfaces/0/ip
172.27.12.24

cat /usr/local/etc/vservers/vcrux01/interfaces/0/name
c01

cat /usr/local/etc/vservers/vcrux01/uts/nodename
vcrux01.domain.net

cat /usr/local/etc/vservers/vcrux01/name
vcrux01

cat /usr/local/etc/vservers/vcrux01/fstab
none /proc proc defaults 0 0
none /tmp tmpfs size=16m,mode=1777 0 0
none /dev/pts devpts gid=5,mode=620 0 0

cat /usr/local/etc/vservers/crux01/context
100

######
#
#Install Crux to /vserver/vcrux01
#
######

#boot from crux install cd
#mount /, /usr, and /vservers to /mnt, /mnt/usr, and /mnt/vservers
#chroot to /mnt
#set root password
#run crux setup
#use /mnt/vservers/vcrux01 as install point
#do not compile kernel, not used
#do not run lilo
#do not run lilo
#do not run lilo
#see crux handbook for details: http://crux.nu/doc/handbook.html

#boot OS back up

#configure guest OS vcrux01
cd /mnt/vservers/vcrux01

sudo vi ./etc/rc.conf
TIMEZONE=Canada/Mountain
HOSTNAME=vcrux01
SERVICES=(crond sshd)

sudo rm -f ./etc/mtab
sudo vi ./etc/mtab
/dev/hdv1 / ufs rw 0 0
sudo chmod 644 ./etc/mtab

sudo vi ./etc/rc
#At the very least comment out:
#/bin/rm -f /etc/mtab*

#null this file out
cat /dev/null > ./etc/fstab

sudo vi ./etc/hosts.allow
sshd:all

cat /dev/null > ./etc/rc.d/net

sudo vi ./etc/resolve.conf
domain domain.net
search domain1.net
nameserver xx.xx.xx.xx
nameserver xx.xx.xx.xx

sudo vi ./etc/inittab
#c1:2:respawn:/sbin/agetty 38400 vc/1 linux
#c2:2:respawn:/sbin/agetty 38400 vc/2 linux
#c3:2:respawn:/sbin/agetty 38400 vc/3 linux
#c4:2:respawn:/sbin/agetty 38400 vc/4 linux
#c5:2:respawn:/sbin/agetty 38400 vc/5 linux
#c6:2:respawn:/sbin/agetty 38400 vc/6 linux

#ca::ctrlaltdel:/sbin/shutdown -t3 -r now

sudo chmod 0666 ./dev/tty

######
#
#Start your vserver
#
######

sudo /usr/local/lib/util-vserver/vprocunhide

sudo vserver-stat
CTX PROC VSZ RSS userTIME sysTIME UPTIME NAME
0 32 33.5M 3K 0m07s48 0m09s62 13h50m14 root server

sudo vserver vcrux01 start

sudo vserver-stat
CTX PROC VSZ RSS userTIME sysTIME UPTIME NAME
0 32 33.5M 3K 0m07s48 0m09s62 13h50m14 root server
100 4 7.4M 769 0m00s72 0m00s71 13h49m58 vcrux01

#Enter vserver and complete setup
sudo vserver vcrux01 enter

#Add groups and users

#For sendmail alert you may see
/usr/bin/newaliases

#setup crux ports (using httpup (curl and httpup) if necessary) and update ports
#see crux handbook for details: http://crux.nu/doc/handbook.html

######
#
#Creating your 2nd, 3rd, nth vserver
#
######

#On host OS
#Copy existing vserver
sudo vserver vcrux01 stop
sudo vserver vcrux02 build -m skeleton -n vcrux02 --context 200 --hostname vcrux02.domain.net --interface 172.27.12.40 --netdev eth0 --netmask 255.255.248.0 --initstyle plain
sudo touch /etc/vservers/vcrux01.conf
sudo vserver-copy vcrux01 vcrux02

cat /usr/local/etc/vservers/vcrux02/apps/init/style
plain

cat /usr/local/etc/vservers/vcrux02/interfaces/dev
eth0

cat /usr/local/etc/vservers/vcrux02/interfaces/mask
255.255.248.0

cat /usr/local/etc/vservers/vcrux02/interfaces/0/ip
172.27.12.40

cat /usr/local/etc/vservers/vcrux02/interfaces/0/name
c02

cat /usr/local/etc/vservers/vcrux02/uts/nodename
vcrux02.domain.net

cat /usr/local/etc/vservers/vcrux02/name
vcrux02

cat /usr/local/etc/vservers/vcrux02/fstab
none /proc proc defaults 0 0
none /tmp tmpfs size=16m,mode=1777 0 0
none /dev/pts devpts gid=5,mode=620 0 0

cat /usr/local/etc/vservers/crux02/context
200

sudo vi /vservers/vcrux02/etc/rc.conf
HOSTNAME=vcrux02

#Start your new vserver
sudo /usr/local/lib/util-vserver/vprocunhide

sudo vserver-stat
CTX PROC VSZ RSS userTIME sysTIME UPTIME NAME
0 32 33.5M 3K 0m07s48 0m09s62 13h50m14 root server
100 4 7.4M 769 0m00s72 0m00s71 13h49m58 vcrux01

sudo vserver vcrux01 start

sudo vserver-stat
CTX PROC VSZ RSS userTIME sysTIME UPTIME NAME
0 32 33.5M 3K 0m07s48 0m09s62 13h50m14 root server
100 4 7.4M 769 0m00s72 0m00s71 13h49m58 vcrux01
200 4 7.4M 769 0m00s83 0m00s93 13h55m46 vcrux02

#Enter vserver and complete setup
sudo vserver vcrux01 enter

######
#
#How I'm starting/stopping vservers at boot time
#
######

#On host OS
sudo vi /etc/rc.conf
SERVICES=(net crond sshd vcrux01 vcrux02 vcrux03)

sudo vi /etc/rc.d/vcrux01

#!/bin/sh
#
# /etc/rc.d/vserver: start/stop vservers
#
VSERVER=vcrux01

case $1 in
start)
        /usr/local/lib/util-vserver/vprocunhide
        /usr/local/sbin/vserver $VSERVER start
        ;;
stop)
        /usr/local/sbin/vserver $VSERVER stop
        ;;
status)
        /usr/local/sbin/vserver-stat
        ;;
*)
        echo "usage: $0 [start|stop|status]"
        ;;
esac

# End of file

######
#
#Common commands I'm using
#
######

#On the Host OS

/usr/local/lib/util-vserver/vprocunhide
#This command makes available some areas of /proc to verserver. Only need to run once per boot.

/usr/local/sbin/vserver vcrux01 start
#Start vcrux01 vserver

/usr/local/sbin/vserver vcrux01 stop
#Stop vcrux01 vserver

/usr/local/sbin/vserver vcrux01 enter
#Enter vcrux01 vserver

/usr/local/sbin/vserver-stat
#Displays status of running ververs

/usr/local/sbin/vserver-info
#Displays build/versioning info of verserver install

/usr/local/sbin/vps -ef
#vserver ps command

/usr/local/sbin/vtop
#vserver top command

/usr/local/sbin/vuname --xid 100
#vserver uname command. Displays uname of vserver with context ID

#more commands in /usr/local/sbin/ and /usr/local/lib/util-vserver/

#THE END

_______________________________________________
Vserver mailing list
Vserver_at_list.linux-vserver.org
http://list.linux-vserver.org/mailman/listinfo/vserver


About this list Date view Thread view Subject view Author view Attachment view
[Next/Previous Months] [Main vserver Project Homepage] [Howto Subscribe/Unsubscribe] [Paul Sladen's vserver stuff]
Generated on Thu 07 Apr 2005 - 19:32:11 BST by hypermail 2.1.3