Slackware Linux with pkgsrc Packages

Last updated $Date: 2006/09/09 08:25:10 $

Martti Kuparinen <>


Most Linux distributions today install a huge set of applications and services which are never used. The author comes from the NetBSD camp where everything is kept simple and secure by default while it is made easy to install additional software from the NetBSD Package Collection. Like the NetBSD system itself, pkgsrc is a portable framework for building third-party software on NetBSD and other UNIX-like systems This article describes how to make a minimalistic Slackware Linux installation and install most of the user applications like Mozilla and XFce from the pkgsrc.

Table of Contents

1. Introduction
2. Initial install
3. Bootstrapping pkgsrc
4. Updating Slackware packages
5. Known problems
6. Using pkgsrc

1. Introduction

I wrote this article as I needed Linux at work but I wasn't happy with the standard Linux package management frameworks. I have used several Linux distributions such as RedHat and Gentoo but I have always preferred the NetBSD pkgsrc as a software installation system. I have used Linux since the early 1990's (remember all those Slackware floppies?) and in my search of the best Linux distribution I found Slackware to be the best for me.

2. Initial install

We start by installing Slackware Linux normally. After installation we take a look at the installed packages and remove everything which is not needed with the removepkg command. Please remember that we will install most of the applications from pkgsrc. At this point we should not remove CVS, SSH or OpenSSL as those are needed to bootstrap the pkgsrc. The following example shows what packages are left from the original Slackware distribution. I found this set to be the minimum requirement for daily use. Note that this means we need to compile our own kernel as the original Slackware kernel packages are no longer used.

# removepkg tcsh
# ls /var/adm/packages/
aaa_base-10.1.0-noarch-2     diffutils-2.8.1-i386-1         grep-2.5-i386-2               pkgtools-10.1.0-i486-4
aaa_elflibs-10.1.0-i486-1    e2fsprogs-1.35-i486-1          groff-1.17.2-i386-3           procps-3.2.3-i486-1
bash-3.0-i486-2              etc-5.1-noarch-9               gzip-1.3.3-i386-2             sed-4.0.9-i486-2
bc-1.06-i386-2               findutils-4.1.7-i386-1         kbd-1.12-i486-2               shadow-4.0.3-i486-11
bin-9.2.0-i486-2             gawk-3.1.4-i486-1              lilo-22.5.9-i486-2            slocate-2.7-i486-3
binutils-  gcc-3.3.4-i486-1               logrotate-3.6.8-i486-1        sysklogd-1.4.1-i486-9
bzip2-1.0.2-i486-5           gcc-g++-3.3.4-i486-1           make-3.80-i386-1              sysvinit-2.84-i486-51
coreutils-5.2.1-i486-1       gettext-0.14.1-i486-1          man-1.5m2-i486-1              tar-1.15.1-i486-1
cxxlibs-5.0.6-i486-1         glibc-2.3.4-i486-1             man-pages-1.64-noarch-1       tcpip-0.17-i486-31
devs-2.3.1-noarch-21         glibc-solibs-2.3.4-i486-1      module-init-tools-3.1-i486-1  util-linux-2.12p-i486-1
dhcpcd-1.3.22pl4-i386-1      glibc-zoneinfo-2.3.4-noarch-1  ncurses-5.4-i486-2

We have now a minimalistic Slackware installation. The host should be configured now before we continue with this document. Things we might want to configure include lpd, ntpd and NFS and NIS.

Next we get the Linux kernel sources and fix the required symlinks in /usr/include.

# cd /usr/src
# ftp
ftp> cd /pub/mirrors/
ftp> dir LATEST*
ftp> bin
ftp> get linux-2.4.32.tar.bz2
ftp> bye

# tar xjf linux-2.4.32.tar.bz2
# ln -s linux-2.4.32 linux

# cd /usr/include
# rm -rf asm* linux
# ln -s /usr/src/linux/include/linux
# ln -s /usr/src/linux/include/asm-i386
# ln -s asm-i386 asm
# ln -s /usr/src/linux/include/asm-generic

Now it is time to compile a new kernel and make it bootable by modifying /etc/lilo.conf. It should be possible to remove the Slackware-installed kernel and kernel modules.

# cd /usr/src/linux
# make menuconfig
# make dep
# make bzImage && make modules && make modules_install
# cp arch/i386/boot/bzImage /boot/bzImage-2.4.32
# cp /boot/
# vi /etc/lilo.conf
# lilo

3. Bootstrapping pkgsrc

Next we need to bootstrap the pkgsrc. In this example we get the source files with CVS so we need to make sure we have the operating system's CVS package installed (from the Slackware distribution CD-ROM). First we need to configure our CVS client to use SSH and be quiet. This can be done with the following commands.

# echo export CVS_RSH=ssh >> /root/.bash_login
# echo cvs -q >> /root/.cvsrc

Next we need to get the pkgsrc, install and configure the pkgsrc management tools.

# cd /usr
# cvs -d co -P pkgsrc

# cd /usr/pkgsrc/bootstrap
# sh bootstrap -h
# sh bootstrap

# cp work/mk.conf.example /etc/mk.conf
# vi /etc/mk.conf
# rm -rf work

It's good to have PKG_RCD_SCRIPTS and RCD_SCRIPTS_DIR settings in /etc/mk.conf or otherwise the startup scripts are left in /usr/pkg/share/examples/rc.d.

.ifdef BSD_PKG_MK


# Startup scripts for packages


We have now the pkgsrc tools installed. Next we need to modify our PATH and MANPATH settings so we can start the pkgsrc compiled applications without typing the whole path. Add the bolded lines into your /etc/profile.

## Added for pkgsrc installed packages
export PATH="${PATH}:/usr/pkg/bin"
if [ `id -u` -eq 0 ]; then
  export PATH="${PATH}:/usr/pkg/sbin"
export MANPATH="${MANPATH}:/usr/pkg/man"

# I had problems using 'eval tset' instead of 'TERM=', but you might want to
# try it anyway. I think with the right /etc/termcap it would work great.
# eval `tset -sQ "$TERM"`
if [ "$TERM" = "" -o "$TERM" = "unknown" ]; then

It is also important to configure the Linux dynamic linker so it is able to find and load the shared libraries installed by the pkgsrc.

# echo /usr/pkg/lib >> /etc/
# cat /etc/ 

The pkgsrc bootstrap kit installs the NetBSD ftp client which is much nicer to use than the standard Slackware ftp client. From now on it is possible to disable the Slackware's ftp client and make the newly installed NetBSD ftp client the only available ftp client.

# chmod 0 /bin/ftp

4. Updating Slackware packages

Next we fetch and install all available updates using the up2date script. Save the script in /usr/local/sbin and make it executable. This script needs the NetBSD ftp client which was installed by the bootstrap kit.

# mv up2date /usr/local/sbin
# chmod 755 /usr/local/sbin/up2date

Next we load and install the official Slackware updates by using the up2date script.

# up2date
# up2date -l
# up2date -i

5. Known problems

Slackware 9.1 has broken and files. We can fix them with the following commands:

# cd /usr/lib

# mv
# sed 's,^\(libdir.*\)/.,\1,' < >

# mv
# sed 's,^\(libdir.*\)/.,\1,' < >

Slackware 10.2 has no reported problems with pkgsrc.

6. Using pkgsrc

We have now a fully functional pkgsrc. As the reader might guess there are not many packages installed yet. This is the same pkgsrc as in NetBSD so the same make targets are available. The reader is instructed to look at the pkgsrc documentation. The only exception is that we must use the bmake command instead of the normal make.

We start by removing OpenSSH, OpenSSL and CVS and compile these from pkgsrc. The reader must note that these should not be removed until we have checked out a copy of pkgsrc. After all, without CVS it is impossible to run cvs checkout -P pkgsrc.

# removepkg cvs openssh openssl openssl-solibs

# cd /usr/pkgsrc/devel/cvs
# bmake install
# bmake clean clean-depends

# cd /usr/pkgsrc/security/openssh
# bmake install
# bmake clean clean-depends
# echo /usr/pkg/etc/rc.d/sshd start >> /etc/rc.d/rc.local

The pkgsrc is updated with CVS and the need for package updates can be detected with lintpkgsrc which can be installed from pkgsrc/pkgtool/pkglint.

# cd /usr/pkgsrc
# cvs update -dPA

# cd /usr/pkgsrc/pkgtools/pkglint
# bmake update

And finally some useful lintpkgsrc commands:

# lintpkgsrc -i			# check for updates
# lintpkgsrc -o			# check for old distribution files
# lintpkgsrc -or		# remove old distribution files

Did this article help you? Is this missing something? Send your comments to the author.