Build your own Slackware repository
Automated Repository Management
If you deploy software packages to several computers, the standard Slackware tools lack efficiency. We show you how to create a custom repository to automatically install and upgrade software for multiple systems.
Slackware [1] has a bad reputation when it comes to package management. Many new users experience Linux through distributions that include advanced package managers. Tools such as Apt or Discover [2] set expectations and, for a new user, define how a package manager functions as well as its capabilities. Modern package managers can track software dependencies, purge software no longer in use, search and find applications in the available repositories, and perform system upgrades. When users come in contact with Slackware, they find Slackware's approach too different from what they are used to and wonder why would anybody like it.
Intended to be installed as a monolithic system, you are expected to install the whole Slackware distribution on a machine. Slackware includes lots of libraries, desktop environments, web browsers and, ultimately, most software needed for a personal workstation or server. You can partially install Slackware (e.g., if you plan to run a web server, you may skip installing a graphical desktop environment), but partial installs are not officially supported.
In practical terms, what you get on the DVD is all there is to official Slackware. Unlike Apt, there are no official repositories for extra software. Official Slackware repositories exist only to serve upgrades to existing installs. The only official Slackware tool that interacts with the repositories directly, slackpkg
[3], is designed specifically to fetch security updates and keep your system in sync with the official package tree.
When a Slackware administrator needs to install software not included in the official distribution, they must do so using unofficial means. Traditionally, users would build their own packages from source. Slackware packages have a simple format, and it is very easy to create packages from a project's source code using build scripts, commonly known as SlackBuild scripts. Eventually, the Slackware community created the SlackBuilds.org [4] website (Figure 1), which stores a large stockpile of build scripts that administrators may use to build any required package manually.
SlackBuild scripts still have shortcomings. In order to get a complex application installed, the user must track down the application's dependencies and get the build scripts and source code for each application. SlackBuild scripts make the process easier, but they don't automate it. To solve this, the Slackware community has developed some useful third-party tools that make use of SlackBuilds.org. Programs such as sbopkg
[5] and sbotools
[6] can replicate the Apt experience: If you instruct these tools to install a package, they will build, package, and install the requested program alongside its dependencies automatically. In particular, sbotools
replicates using a ports system like the ones used by the BSD family of operating systems.
Unfortunately, these tools are not very helpful if you intend to manage a fleet of Slackware computers. Issuing an install
command using one of these pseudo-ports systems on every computer would cause all the software to be downloaded once for each machine, and then every computer would compile and install its own packages. This is very inefficient. Instead, if you are responsible for a sizable number of Slackware machines, a custom repository allows you to compile each package just once and distribute it to an indefinite number of machines with minimal effort.
Why Bother with Slackware?
You may be wondering why you would bother using the Slackware package system. Instead of going to the trouble of using a ports system or building a custom repository, you could use a distribution such as Devuan that offers ready-made repositories.
It comes down to flexibility. With Devuan, if you use the stable version (Devuan Chimaera) and find out you need a more recent version of a library, upgrading the library might prove challenging. Just picking up the version you need from a development branch may not work, because the package manager may refuse to install it unless you bring along a whole set of dependencies. Changing a library may also cause you to break the applications that use it. While you can upgrade some isolated components in binary distributions, the process can become complex.
When you use source-based software provisioning, you are provided with an automated way of solving these conflicts out of the box. If you need to apply a patch to one of the installed programs, or upgrade it to a newer version, the only thing you need to do is to bump a number in a configuration file in your build system. The computer will build your upgraded package specifically for your environment and deploy it with (usually) no conflicts.
To learn more about other popular distributions that use a software provisioning approach, see the "Ports-Based Systems" box.
Ports-Based Systems
Ports are scripted mechanisms designed to build programs from source. The user issues a command to install a specific piece of software, and the ports system builds and installs it alongside its dependencies.
Gentoo is probably the most popular source-based Linux distribution. It makes use of a complex (if powerful) ports system. Gentoo supports flags, which let you configure Gentoo to build itself according to your specifications. With flags, you can build your distribution without components you might not want, such as PAM, PulseAudio, or systemd.
The BSD operating system family also makes use of ports. FreeBSD, OpenBSD, NetBSD, and DragonflyBSD can use either their own ports systems or regular repositories with binary packages (with some skill, a combination of both in some cases). This approach is quite powerful and offers the best of both worlds.
NetBSD's port system, pkgsrc
[7], is designed to be portable and may be used on other operating systems (MINIX 3, illumos, and others) to some degree.
slackrepo
Slackrepo [8] (Figure 2), created by David Spencer and maintained by Andrew Clemons [9], offers the best way to create a custom Slackware repository.
Slackrepo is a set of tools capable of taking a set of build scripts and compiling any packages you may need distributed to your systems. You can load packages created this way onto a web server, which may be used as a formal repository.
This article provides precise instructions on how to create a custom repository with slackrepo and then configure your Slackware computers to use it. The slackrepo server will be in our LAN with the IP address 192.168.3.40 in this example, while our other Slackware machines will have arbitrary addresses in network 192.168.3.0/24.
In order to get started, you first need to install a full Slackware system on the server. Slackrepo is intended to run on a fresh install with all the official software installed. Listing 1 summarizes building slackrepo using a build script from SlackBuilds.org along with its "hintfiles," which are instructions for slackrepo to build some tricky software. Slackrepo can use fakeroot
as an optional dependency, which allows it to prevent the repository building engine from interfering with the host operating system.
Listing 1
Install Slackrepo on the Server
01 # Download the SlackBuild script for fakeroot, unpack it, download fakeroot and 02 # build it using the script. 03 04 cd /tmp 05 wget https://slackbuilds.org/slackbuilds/15.0/system/fakeroot.tar.gz 06 tar -xzf fakeroot.tar.gz 07 cd fakeroot 08 wget http://ponce.cc/slackware/sources/repo/fakeroot_1.25.3.orig.tar.gz 09 bash ./fakeroot.SlackBuild 10 installpkg /tmp/fakeroot*.tgz 11 12 # Download the SlackBuild script for slackrepo, unpack it, download slackrepo and 13 # build it using the script. 14 15 cd /tmp 16 wget https://slackbuilds.org/slackbuilds/15.0/system/slackrepo.tar.gz 17 tar -xzf slackrepo.tar.gz 18 cd slackrepo 19 wget https://github.com/aclemons/slackrepo/archive/v20230107/slackrepo-20230107.tar.gz 20 bash ./slackrepo.SlackBuild 21 installpkg /tmp/slackrepo*.tgz 22 23 # Download the SlackBuild script for the hintfiles, unpack it, download the hintfiles and 24 # build them using the script. 25 26 cd /tmp 27 wget https://slackbuilds.org/slackbuilds/15.0/system/slackrepo-hints.tar.gz 28 tar -xzf slackrepo-hints.tar.gz 29 cd slackrepo-hints 30 wget https://github.com/aclemons/slackrepo-hints/archive/v20230128/slackrepo-hints-20230128.tar.gz 31 bash ./slackrepo-hints.SlackBuild 32 installpkg /tmp/slackrepo-hints*.tgz
By default, slackrepo is configured to download the whole repository of SlackBuild scripts from SlackBuilds.org, which is what most administrators will want. Slackrepo updates the local SlackBuilds tree every time it is used and if more than one day has passed since it was last executed.
In order to create a formal repository, you must create GPG keys to sign the packages. Package signatures are used by the clients to verify the integrity of the packages downloaded from your repository. Listing 2 shows you how to create signing keys on the slackrepo server and then output the file GPG-KEY
, which will be distributed to the clients. Clients will use this file to validate the packages. Beware: The instructions in Listing 2 aren't particularly safe, because the OpenPGP key is left unencrypted, but I am choosing this method for the sake of clarity.
Listing 2
Creating Keys for Package Signatures
01 gpg2 --batch --yes --passphrase="" --quick-generate-key "Repomaster <repomaster@example.org>" dsa 02 gpg2 --export -a Repomaster > GPG-KEY
You then must configure slackrepo to use this key. Edit the /etc/slackrepo/slackrepo_SBo.conf
file and perform the changes shown in Listing 3.
Listing 3
slackrepo.conf Variables
01 USE_GENREPOS=1 02 REPOSOWNER="Repomaster <repomaster@example.org> 03 DL_URL=http://192.168.3.40/pkgrepo/%REPO%/%SLACKVER%/%ARCH%" 04 RSS_UUID=SOME_EXAMPLE_UUID 05 GPGBIN=/usr/bin/gpg2 06 FOR_SLAPTGET="1"
To ensure your values are correct, generate a valid RSS_UUID
with the command uuidgen -t
.
You are now ready to start deploying your packages. As a demonstration, I'll build the Hedgewars package [10] along with its dependencies:
# slackrepo build hedgewars
A minimal repository will be placed in /var/lib/slackrepo/SBo/packages
. You may compile as many additional packages as needed, and all the packages will be placed here. You may also move everything to a web server folder at this point:
# rsync --delete -as /var/lib/slackrepo/SBo/packages/ /var/www/htdocs/ # mv GPG-KEY /var/www/htdocs/15.0/x86_64/
Now, you just need to enable and launch the web server included with a Slackware full install:
# chmod +x /etc/rc.d/rc.httpd # /etc/rc.d/rc.httpd start
You will now find your repository online at http://192.168.3.40 (as shown in Figure 3).
Client Setup
You now have a package repository, but how can you leverage it?
Packages stored in slackrepo repositories may be downloaded and installed manually, but Slackware supports a number of tools for automating the task. The previously mentioned sbopkg
is a popular choice, but for this example, I am going to use slackpkg
, because it is closer to the standard Slackware operational model.
While slackpkg
is intended for use only with official Slackware repositories, the slackpkg+
plugin lets you work with separate repositories. You can install slackpkg+
on a given client machine as follows:
# wget https://slakfinder.org/slackpkg+/pkg/slackpkg+-1.8.0-noarch-7mt.txz # installpkg slackpkg+-1.8.0-noarch-7mt. txz
Next, you need to configure slackpkg+
. The simplest way is to edit /etc/slackpkg/slackpkgplus.conf
on each client machine and set the variables shown in Listing 4.
Listing 4
Setting Variables in slackpkgplus.conf
01 REPOPLUS=( custom ) 02 MIRRORPLUS['custom']=http://192.168.3.40/15.0/x86_64/
Finally, uncomment any of the official Slackware mirrors of your choice in /etc/slackpkg/mirrors
. The repository may now be used to install any package you require:
# slackpkg gpg-update # slackpkg update # slackpkg install physfs ghc lua fpc hedgewars
Keep in mind slackpkg
does not do dependency tracking. However, when you perform your regular Slackware upgrades, any package from your custom repository that gets upgraded in the server will be picked up by slackpkg
:
# slackpkg update # slackpkg upgrade-all
Buy this article as PDF
(incl. VAT)
Buy Linux Magazine
Subscribe to our Linux Newsletters
Find Linux and Open Source Jobs
Subscribe to our ADMIN Newsletters
Support Our Work
Linux Magazine content is made possible with support from readers like you. Please consider contributing when you’ve found an article to be beneficial.
News
-
ESET Discovers New Linux Malware
WolfsBane is an all-in-one malware that has hit the Linux operating system and includes a dropper, a launcher, and a backdoor.
-
New Linux Kernel Patch Allows Forcing a CPU Mitigation
Even when CPU mitigations can consume precious CPU cycles, it might not be a bad idea to allow users to enable them, even if your machine isn't vulnerable.
-
Red Hat Enterprise Linux 9.5 Released
Notify your friends, loved ones, and colleagues that the latest version of RHEL is available with plenty of enhancements.
-
Linux Sees Massive Performance Increase from a Single Line of Code
With one line of code, Intel was able to increase the performance of the Linux kernel by 4,000 percent.
-
Fedora KDE Approved as an Official Spin
If you prefer the Plasma desktop environment and the Fedora distribution, you're in luck because there's now an official spin that is listed on the same level as the Fedora Workstation edition.
-
New Steam Client Ups the Ante for Linux
The latest release from Steam has some pretty cool tricks up its sleeve.
-
Gnome OS Transitioning Toward a General-Purpose Distro
If you're looking for the perfectly vanilla take on the Gnome desktop, Gnome OS might be for you.
-
Fedora 41 Released with New Features
If you're a Fedora fan or just looking for a Linux distribution to help you migrate from Windows, Fedora 41 might be just the ticket.
-
AlmaLinux OS Kitten 10 Gives Power Users a Sneak Preview
If you're looking to kick the tires of AlmaLinux's upstream version, the developers have a purrfect solution.
-
Gnome 47.1 Released with a Few Fixes
The latest release of the Gnome desktop is all about fixing a few nagging issues and not about bringing new features into the mix.