[Vserver] Request for comments: Crux vserver install notes

2005-04-07 Thread smagnuson

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  /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   procdefaults0 0
none/tmptmpfs   size=16m,mode=1777  0 0
none/dev/ptsdevpts  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 

Re: [Vserver] Request for comments: Crux vserver install notes

2005-04-07 Thread Herbert Poetzl
On Thu, Apr 07, 2005 at 12:31:48PM -0600, [EMAIL PROTECTED] wrote:
 
 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

comment: why not bz2 here too?

 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

comment: why not the patch for the specific kernel?

 # 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

note: no need to build the kernel as root IIRC

 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

should have same name as the kernel uses (I doubt you added -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

what's that? does crux not support vlans?

 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

note: on a remote system, try first with a different port
and in debug mode ...

 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

nitpick: setattr --barrier /vservers/vcrux01/.. is better

 sudo showattr -d /vservers
 ---Bui- /vservers
 
 #I don't think this is required anymore
 #sudo chmod  /vservers

that would be a bad idea anyway ...

 #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

only required if you like aliases ...

 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   procdefaults0 0
 none/tmptmpfs   size=16m,mode=1777  0 0
 none/dev/ptsdevpts  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