Older Newer
Wed, 19 Apr 2006 23:21:53 . . . . SilvioRhatto? [added rc script for the new configuration scheme]
Fri, 10 Feb 2006 10:24:38 . . . . SilvioRhatto? [added note about simplepkg]
Tue, 02 Aug 2005 23:41:11 . . . . SilvioRhatto?
Sat, 30 Jul 2005 16:14:19 . . . . SilvioRhatto?
Sat, 30 Jul 2005 01:06:37 . . . . SilvioRhatto?
Sat, 30 Jul 2005 01:05:06 . . . . SilvioRhatto?
Fri, 15 Jul 2005 12:58:32 . . . . (Nam)? [The code was broken and does not work properly. The author forgot the word "in"]
Fri, 15 Apr 2005 00:37:50 . . . . 200-206-215-220.speedyterra.com.br
See complete list (22 entries)


Changes by last author:

Changed:
This is a quick-and-dirty Slackware Vserver Howto as I haven't seen anything about vserver on slack. The advantage of this approach is that you can easily setup new vsevers and keep all of them up to date with the slackware packaging system, with just few commands.
This is a quick-and-dirty Slackware Vserver Howto as I haven't seen anything about vserver on slack. The advantage of this approach is that you can easily setup new vsevers and keep all of them up to date with the slackware packaging system, with just a few commands. There is also a portuguese[1] version of this howto.

Note that this howto is a from scratch way to do the job, there's a tool called [simplepkg] that uses templates do create vservers and have some scripts to keep all the jails updated.

Changed:
Create a default skeleton for your vserver's config (skel.conf) and put it the the same dir of the scripts.
Create a default skeleton for your vserver's config (skel.conf) and put it the the same dir of the scripts. You'll also need a tgz file with a small /dev folder containing the following devices/subfolders:

<code>

crw-rr 1 root root 1, 7 2004-09-13 00:00 full

-rw-rr 1 root root 0 2004-09-13 00:00 hdv1

srw-rw-rw- 1 root root 0 2005-07-23 09:35 log

crw-rr 1 root root 1, 3 2004-09-13 00:00 null

crw-rr 1 root root 5, 2 2004-09-13 00:00 ptmx

drwxr-xr-x 2 root root 0 2005-07-22 18:28 pts

crw-rr 1 root root 1, 8 2004-09-13 00:00 random

crw-rr 1 root root 5, 0 2004-09-26 15:15 tty

crw-rr 1 root root 1, 9 2004-09-13 00:00 urandom

crw-rr 1 root root 1, 5 2004-09-13 00:00 zero

</code>

Changed:
#

# mkjail: create vservers

# feedback: rhatto at riseup.net

#

# adjust this to where your packages live

PACKAGES=/slackware

# this is where you put the rc's scripts

SCRIPTS=/scripts

# which disk sets you want to install

SERIES="a ap l n"

#

# mkjail v0.2: chroot jail maker (slack 10.1.0)

# feedback: rhatto at riseup.net | GPL

#

# adjust this to where your things live

PACKAGES="/storage/vserver/slack/"

DEVICES="/storage/vserver/devices.tar.gz"

SCRIPTS="/storage/vserver/etc/"

GPGKEY="/storage/vserver/slack/GPG-KEY"

SKEL="/storage/vserver/skel.conf"

if ($# != 1)?; then

echo "usage: $0 <server-name>"

exit 1

fi

Changed:
if ($# != 1)?; then

echo "usage: $0 <server-name>"

exit 1

fi

server=$1

mkdir /vservers/$server

server=$1

mkdir /vservers/$server

Changed:
echo "installing the packages"
echo "instaling packages..."
Changed:
for dir in $SERIES; do

cd $dir; installpkg -root /vservers/$server *tgz; cd ..

done

for dir in a ap n extra contrib; do

cd $dir; installpkg -root /vservers/$server *tgz; cd ..

done

Changed:
echo "copying initialization scripts"

cp $SCRIPTS/rc.* /vservers/$server/etc/rc.d/

echo "creating /etc/ and copying init scripts"

rsync -Cav $SCRIPTS/ /vservers/$server/etc/

Deleted:

echo "creating /etc/fstab /etc/mtab /etc/localtime /etc/profile"

echo /dev/hdv1 / ext2 defaults 1 1 > /vservers/$server/etc/fstab

echo /dev/hdv1 / ext2 rw 0 0 > /vservers/$server/etc/mtab

Changed:
cp $SCRIPTS/profile /vservers/$server/etc
echo /dev/hdv1 / ext2 defaults 1 1 > /vservers/$server/etc/fstab

echo /dev/hdv1 / ext2 rw 0 0 > /vservers/$server/etc/mtab

Changed:
echo "creating dependency cache"

cd /vservers/$server/

tar xvf /storage/vserver/vserver-dev.tar

ln -s lib/ld-2.3.2.so lib/ld-linux.so.2

chroot /vservers/$server/ sbin/ldconfig

echo "creating config file"

cp $SCRIPTS/skel.conf /etc/vservers/$server.conf

echo "creating devices and dependencies"

cd /vservers/$server/

tar zxvf $DEVICES

chroot /vservers/$server/ sbin/ldconfig

echo "creating /etc/vservers/$server.conf"

cp $SKEL /etc/vservers/$server.conf

echo "importing slack gpg pubkey"

mkdir /vservers/$server/root/.gnupg

gpg homedir /vservers/$server/root/.gnupg import $GPGKEY

Added:
# todo: add rebootmgr
Changed:
echo "then, route your server thru iptables and start it"

echo "dont forget to change your vserver's root passwd"

echo "then, set iptables rules and start $server vserver"

echo "dont forget to change root's password"

Changed:
#!/bin/bash
#!/bin/sh #

# vserver-upgrade v0.2: fabulous script for slack vserver upgrade

# feedback: rhatto at riseup.net | GPL

#

# Uses some functions from pkgtools, which license is:

Changed:
# vserver-upgrade
# Copyright 1999 Patrick Volkerding, Moorhead, Minnesota, USA

# Copyright 2001, 2002, 2003 Slackware Linux, Inc., Concord, California, USA

# All rights reserved.

#

# Redistribution and use of this script, with or without modification, is

# permitted provided that the following conditions are met:

#

# 1. Redistributions of this script must retain the above copyright

# notice, this list of conditions and the following disclaimer.

#

# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED

# WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF

# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO

# EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,

# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,

# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;

# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,

# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR

# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF

# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

Changed:
# where your patches live

PATCHES=/slackware/patches/packages/

PACKAGE_DIR=/storage/packages/patches/
Changed:
cd $PATCHES

for file in $(ls *tgz); do

pack=$(echo $file | cut -d - -f 1)

# this upgrades your main system

if [ -f /var/log/packages/$pack* ]; then

upgradepkg $pack*tgz

# pkgtool stuff

package_name() {

STRING=`basename $1 .tgz`

# Check for old style package name with one segment:

if [ "`echo $STRING | cut -f 1 -d -`" = "`echo $STRING | cut -f 2 -d -`" ]; then

echo $STRING

else # has more than one dash delimited segment

# Count number of segments:

INDEX=1

while [ ! "`echo $STRING | cut -f $INDEX -d -`" = "" ]; do

INDEX=`expr $INDEX + 1`

done

INDEX=`expr $INDEX - 1` # don't include the null value

# If we don't have four segments, return the old-style (or out of spec) package name:

if [ "$INDEX" = "2" -o "$INDEX" = "3" ]; then

echo $STRING

else # we have four or more segments, so we'll consider this a new-style name:

NAME=`expr $INDEX - 3`

NAME="`echo $STRING | cut -f 1-$NAME -d -`"

echo $NAME

fi

Changed:
# this upgrades packages on every vserver running slackware

for vserver in $(ls /vservers); do

if [ -f /vservers/$vserver/var/log/packages/$pack* ]; then

ROOT=/vservers/$vserver upgradepkg $pack*tgz

}

# vserver stuff

cd $PACKAGE_DIR

for file in `ls *tgz`; do

pack=`package_name $file`

for installed in `ls /var/log/packages/$pack* 2> /dev/null`; do

if [[ "$pack" == "`package_name $installed.tgz`" ]]; then

if [[ "`basename $installed`" != "`basename $file .tgz`" ]]; then

upgradepkg $file

fi

Added:
for vserver in `ls /vservers`; do

for installed in `ls /vservers/$vserver/var/log/packages/$pack* 2> /dev/null`; do

if [[ $pack == `package_name $installed.tgz` ]]; then

if [[ "`basename $installed`" != "`basename $file .tgz`" ]]; then

ROOT=/vservers/$vserver upgradepkg $file

fi

fi

done

done

Added:
=== Config format ===

If you're using the new configuration method for your vservers and want to use the sysv init style, you should create the following /etc/rc.d/rc script inside your vserver:

<code>

#!/bin/bash

if [ "$1" == "3" ]; then

/etc/rc.d/rc.M

elif [ "$1" == "6" ]; then

/etc/rc.d/rc.6

else

echo "Invalid level."

exit 1

fi

</code>

=== Passive FTP ===

Changed:
*Any questions/comments: rhatto at riseup.net
=== Contact ===

Any questions/comments: rhatto at riseup.net