August 29, 2020 Roberto Puzzanghera4 comments
Linux-Vserver
: https://en.wikipedia.org/wiki/Linux-VServerLinux-Vserver is an open source software which acts as a virtual private server implementation done by adding operating system-level virtualization capabilities to the Linux kernel.
This means that all guests share the same kernel and they don't need to provide hardware support.
The purpose of this note is to show how to setup a guest based on Slackware
into a Slackware
host. What follows was tested on Slackware
14.2, 14.1, 14.0, 13.37 and 13.1 (both 32b and 64b). I will assume that you have a Linux-Vserver box working. You can find here a quick and easy howto concerning Linux-Vserver
installation and configuration (patching the kernel + utils-vserver installation).
wget https://notes.sagredo.eu/files/linux-vserver/slack_vserver.tar.gz tar xzf slack_vserver.tar.gz cd slack_vserver ls
You have downloaded the following files:
First of all select a minimal set of packages to be installed on the virtual server. This list of 123 packages is based on the Minimal System reported at http://www.slackwiki.com/Minimal_System without all hardware, kernel and multimedia related packages. The install leads to a guest of about 460M of size. This set fits with the installation of a complete virtual web server including apache, apache-tomcat, php, mysql, postgresql, qmail and related, ftp, named.
I assume that the packages to be installed are stored in the slackware{$ARCH}-{$VERSION}_pkg folder. If not, adjust its location editing the make_slack_vserver.sh script.
You can download my minimal set of packages running the shell script download_slack_pkg.sh. It can create a folder like slackware{$ARCH}-{$VERSION}_pkg for you, where $ARCH has to be "64" if you want to download 64b packages or empty otherwise, while $VERSION is the Slackware version, so it's something like "14.1".
#!/bin/bash # # v. 2016.06.08 # Now the script parses comments in the package list (thanks to Mark Colclough) VERSION="14.2" # Slackware version ARCH="64" # you can put 64 for 64b cpu just to separate 64/32 download folders # Put here your favourite Slackware repository SRC="ftp://ftp.slackware.no/slackware/slackware${ARCH}-${VERSION}/" # put here your pkg list LIST="${PWD}/PKG_LIST" # the directory where you unpacked slack_vserver.tar.gz # $PWD should work, otherwise put /path/to/slack_vserver SETUP=$PWD # the directory where you want to download the slackware packages PACKAGES="${SETUP}/slackware${ARCH}-${VERSION}_pkg" # create the folder where the pkg will be downloaded if [ ! -d "$PACKAGES" ]; then mkdir -p $PACKAGES fi # create the "patches" sub-folder if [ ! -d "${PACKAGES}/patches" ]; then mkdir -p "${PACKAGES}/patches" fi # download cd $PACKAGES if [ -f $LIST ]; then while read LINE do [ "$LINE" ] || continue [ "${LINE#\#}" = "$LINE" ] || continue wget "${SRC}slackware${ARCH}/${LINE}*.t?z" done < $LIST else echo "Can't find $LIST file." exit 1 fi # download packages from the patches folder cd ${PACKAGES}/patches if [ -f ${LIST} ]; then while read LINE do IFS='/' read -ra PKG <<< "$LINE" [ "${PKG#\#}" = "${PKG}" ] || continue PKG_LEN=${#PKG[@]} if [ $PKG_LEN == 2 ]; then wget "${SRC}patches/packages/${PKG[1]}*.t?z" fi done < $LIST else echo "Can't find $LIST file." exit 1 fi
Adjust the package PKG_LIST, enter your favorite ftp server and run from the command line
./download_slack_pkg.sh
NB: this script tries also to overwrite the packages downloaded from the /slackware folder with the updates belonging to the /patches dir.
Now let's create the guest and install the packages. As you know you must choose at least a "name", a "context" and an ip. In addition you have to modify most of the rc.* startup scripts removing all the hardware related daemons, and finally replace the /dev dir.
This is done adjusting and running the script make_slack_vserver.sh:
#!/bin/bash # # v. 2016.07.05 # Author: Roberto Puzzanghera # Thanks to Mark Colclough for corrections # # This script installs a Slackware guest into a linux-vserver host (http://linux-vserver.org) # # Comments are welcome :-) # More info here: https://notes.sagredo.eu/other-contents-186/slackware-guest-on-linux-vserver-7.html # adjust this to where your things live NAME=test HOSTNAME=$NAME.YOURDOMAIN.XY IP=10.0.0.182 INTERFACE=eth0:$IP/24 CONTEXT=5182 VERSION=14.2 # Slackware version ARCH="64" # you can put 64 for 64b cpu just to separate 64/32 download folders # where is the vservers dir? default is /vservers VDIR="/usr/local/vservers" # the directory where you unpacked slack_vserver.tar.gz # $PWD should work, otherwise put /path/to/slack_vserver SETUP=$PWD # the directory where you downloaded the slackware packages PACKAGES="${SETUP}/slackware${ARCH}-${VERSION}_pkg" # the path to rc script file (leave as is) RC="${SETUP}/rc" ################### end configuration # sanity check if [ ! -d "$VDIR" ]; then echo echo "Can't find VDIR dir: $VDIR" echo "Exiting" echo exit 1 fi if [ ! -d "$SETUP" ]; then echo echo "Can't find SETUP dir: $SETUP" echo "Exiting" echo exit 1 fi if [ ! -d "$PACKAGES" ]; then echo echo "Can't find PACKAGES dir: $PACKAGES" echo "Exiting" echo exit 1 fi if [ ! -f "$RC" ]; then echo echo "Can't find RC path: $RC" echo "Exiting" echo exit 1 fi # if everything is ok start the install echo read -p "press any key to make skeleton..." vserver ${NAME} build -m skeleton \ --hostname ${HOSTNAME} \ --interface ${INTERFACE} \ --context $CONTEXT \ --flags lock,virt_mem,virt_uptime,virt_cpu,virt_load,sched_hard,hide_netif \ --initstyle sysv echo "...done" echo read -p "press any key to move the /dev folder to a temp dir the /dev folder..." mv $VDIR/$NAME/dev $VDIR/$NAME/dev2 echo read -p "press any key to install packages..." cd $PACKAGES installpkg --root $VDIR/$NAME *.t?z; ROOT=$VDIR/$NAME upgradepkg patches/*.t?z; echo "...done" echo echo read -p "press any key to copy the rc script to /etc/rc.d/init.d..." echo echo "copying rc to /etc/rc.d/init.d/rc" cp -p $RC $VDIR/$NAME/etc/rc.d/init.d/ echo "...done" echo echo "removing x flag to rc.sshd and rc.inetd, removing not needed rc scripts" chmod -x $VDIR/$NAME/etc/rc.d/rc.sshd $VDIR/$NAME/etc/rc.d/rc.inetd rm $VDIR/$NAME/etc/rc.d/rc.cpufreq $VDIR/$NAME/etc/rc.d/rc.modules* $VDIR/$NAME/etc/rc.d/rc.inet1* $VDIR/$NAME/etc/rc.d/rc.loop echo "...done" echo echo "trying to adjust HOSTNAME, hosts, resolv.conf, profile. Check them later..." cp /etc/resolv.conf $VDIR/$NAME/etc/ cp /etc/localtime $VDIR/$NAME/etc/ rm $VDIR/$NAME/etc/profile cp /etc/profile $VDIR/$NAME/etc/ echo $HOSTNAME > $VDIR/$NAME/etc/HOSTNAME echo "127.0.0.1 localhost" > $VDIR/$NAME/etc/hosts echo "$IP $HOSTNAME $NAME" >> $VDIR/$NAME/etc/hosts touch $VDIR/$NAME/etc/mtab touch $VDIR/$NAME/etc/fstab echo "...done" echo read -p "press any key to restore /dev2 to /dev" rm -r $VDIR/$NAME/dev mv $VDIR/$NAME/dev2 $VDIR/$NAME/dev echo echo -n "Do you want that I apply the patch for you y/n? [y] " read VAR_PATCH if [ "$VAR_PATCH" = 'y' ] || [ "$VAR_PATCH" = '' ]; then if [ ! -f "${SETUP}/linux-vserver_slackware-${VERSION}.patch" ]; then echo echo "Can't find any PATCH here: ${SETUP}/linux-vserver_slackware-${VERSION}.patch" echo "Exiting" echo exit 1 fi cd ${VDIR}/${NAME}/etc/rc.d patch -p1 < ${SETUP}/linux-vserver_slackware-${VERSION}.patch echo "patch applyed." echo echo "You can start and enter the virtual server typing: " echo echo "vserver $NAME start" echo "vserver $NAME enter" else echo echo "DON'T FORGET to patch /etc/rc.d as follows: " echo echo "cd $VDIR/$NAME/etc/rc.d" echo "patch -p1 < $SETUP/linux-vserver_slackware-$VERSION.patch" fi echo echo "More info on http://notes.sagredo.eu/node/7" echo
Note that /etc/resolv.conf /etc/localtime /etc/profile are copied form the host.
Edit the script inserting at least the NAME, the IP and the CONTEXT. The packages' location should be ok if you downloaded them using my script.
./make_slack_vserver.sh
The script itsself can install the patch for you. Anyway this is how to apply the patch by yourself:
cd /vservers/vserver_name/etc/rc.d patch -p1 < /path/to/slack_vserver/slackware-14.2.patch
Inside the tarball you can find the old patch for Slackware 13.1 and 13.37, 14.0, 14.1 if you like.
Put this inside your rc.local
:
/usr/local/etc/init.d/vprocunhide start
vserver <vserver_name> start vserver <vserver_name> enter
compiling netqmail with tls and dkim support
January 26, 2021 22:43
Is it support under Load blance
January 26, 2021 08:21
Is it support under Load blance
January 26, 2021 06:24
It is not working with SpamAssassin 3.4.0
January 21, 2021 21:48
It is not working with SpamAssassin 3.4.0
January 21, 2021 21:05
Support for aliasdomains added!
January 18, 2021 15:52
Dovecot Expunging script
January 17, 2021 10:38
Support for aliasdomains added!
January 13, 2021 13:12
Convert vpopmail cdb backend to use postgres for dovecot
January 12, 2021 15:58
Convert vpopmail cdb backend to use postgres for dovecot
January 10, 2021 11:48
Tags
apache clamav dkim dovecot ezmlm fail2ban hacks lamp letsencrypt linux linux-vserver lxc mariadb mediawiki mozilla mysql openboard owncloud patches php proftpd qmail qmailadmin rbl roundcube rsync sieve simscan slackware spamassassin spf ssh ssl surbl tcprules tex ucspi-tcp vpopmail vqadmin
Comments
slackware on other distro
Maikelonline December 27, 2011 17:47
Hey,
Thanks for this great article. Does anybody got expierence of having a slackware vserver on a other distro like Debian. My host is Debian, but I want some vserver running Slackware.
Reply | Permalink
I've never tried but
roberto puzzanghera Maikelonline December 27, 2011 18:28
Hi, I've never tried but I suppose that you have to install the slackware's pkgtools on your Debian and the above script should work as is..
Please post the details if you manage to do it!
cheers :)
Reply | Permalink
no self-patch
Anonymous November 1, 2011 04:40
Hey, when i tried to install the package, the patch was not installed and after me trying to install the patch myself it hangs up. Any idea on what i might be doing wrong?
Reply | Permalink
Can you provide more details
roberto puzzanghera Anonymous November 1, 2011 10:52
Can you provide more details about the error you get, please? Everything was tested for Slackware 13.37 with the packages listed in the file PKG_LIST. I'm quite sure that it works, also yesterday I installed a slackware guest following my own directives..
cheers :)
Reply | Permalink