I tried to use newvserver and install-rh9.0 and neither of them worked out of the box on my redhat 9.0 system using 2.4.21-smpctx17a. vserver build worked fine, but made a way bigger image than I wanted on my dev machine.

I didn't like the idea of using rpm --nodeps in the install-rh9.0 script, so I just stripped our the complicated rpm bits and used yum instead. It works like a charm, with proper dependency resolution and everything. The script only installs dependencies necessary to run rpm inside the vserver, but you can just use yum to shoot in whatever else you want (httpd)

Yum also supports a groups file, so you could use it to install a certain set of rpms. I obviously haven't done this yet.

If you're not familiar with yum, you can get it at http://linux.duke.edu/projects/yum/

I haven't tried this script on anything but redhat 9.0, but judging by the looks of the other install scripts, probably just adding some tests re: mounting /dev/pts would make it work.

Seems like it might be a useful addition to the distribution.

Heres the script:

#!/bin/sh
# This script creates a vserver from the currently
# available set of yum repositories
# Specify the name of the vserver
# "install-yum test" will create /vservers/test

USR_LIB_VSERVER=/usr/lib/vserver
if [ $# -lt 1 ] ; then
        echo install-yum vserver-id
elif [ -d /vservers/$1/var/lib/rpm ] ; then
        echo /vservers/$1 already exist
else
        VROOT=/vservers/$1
        $USR_LIB_VSERVER/install-pre.sh $1
        mkdir -p $VROOT/proc
        mount -t proc none $VROOT/proc
        mount -t devpts none $VROOT/dev/pts
        mkdir -p $VROOT/var/lib/rpm
        rpm --root $VROOT --initdb
        yum --installroot=$VROOT install rpm
        umount $VROOT/proc
        umount $VROOT/dev/pts
        $USR_LIB_VSERVER/install-post.sh $1
fi





Reply via email to