This is a blog series designed to help people starting out with Slackware, or just considering it, be able to use it to their fullest extent, presented in a beginner-friendly manner.
In the last entry, we learned how to install Slackware. Today, I'll be teaching you how to work with two different essential parts of Slackware: package management, and the init system.
PACKAGE MANAGEMENT
To start working with packages, first you'll wanna be in a terminal, whether in or out of your desktop environment of choice. Then, you'll wanna type su root to become a superuser. sudo is present in Slackware, but cannot be used for package management by default, and it is not recommended that you try to make it work. You MUST be root to do any package management on Slackware. Enter your root password, and you should now be logged in as root.
If you already logged in as root before opening your terminal, this is not necessary
To actually get started, you'll wanna use your text editor of choice to edit the file /etc/slackpkg/mirrors. This file holds a list of mirrors for Slackware's packages and updates.
SELECT ONLY ONE MIRROR! MAKE SURE IT'S ONE GEOGRAPHICALLY CLOSE TO YOU.
There are mirrors for both the stable and current versions of Slackware. Choose one that matches the version you're using.
Once you select a mirror, you are now good to exit your text editor and type slackpkg update gpg. This will pull the GPG keys from the mirror, confirming that you will be using that particular mirror. This command only has to be done one unless you change mirrors (which isn't recommended). After that, type slackpkg update to actually check if any packages need updating.
This will pull down any updates that need to be done by looking at changes in the Slackware ChangeLog, which is usually updated every day. To actually apply the upgrades, type slackpkg upgrade-all.
This will start upgrading all your packages one by one. If you've done like I did and haven't upgraded your packages in about 2 weeks, this may take a while. Generally it's good practice to upgrade at least once a week or more so you stay up-to-date on all the latest bug fixes and security patches.
Bear in mind that this only updates the packages that you installed from the Slackware install media when you first started. In a minute we'll cover how to get new packages and keep those up-to-date as well.
After running slackpkg upgrade-all, it's typically good practice to also run slackpkg clean-system. This will clear off any packages that may have been removed from the official Slackware install media between now and the last update. Tread lightly with this command, however; it doesn't know the difference between packages removed from the Slackware install media, and packages you've installed on your own time, so take care to deselect any of those packages that you don't want deleted. To avoid this issue, there's another file you can edit, located at /etc/slackpkg/blacklist. This file is where you can put any packages and/or external repositories that you don't want slackpkg to mess with. We'll be editing this file in a minute so we can use the SlackBuilds repository without worry. But first, we must install a particular package known as sbopkg. This package is itself a package manager that's designed to work with the SlackBuilds repo. At the time of this writing, the latest version of sbopkg is 0.38.2. To download this package from the terminal, simply enter whatever directory you'd like to download it to (or even make a special directory just for packages) and type:
wget https://github.com/sbopkg/sbopkg/releases/download/0.38.2/sbopkg-0.38.2-noarch-1_wsr.tgz
This will download the sbopkg package to whatever directory you're in, and you can then install it with the command:
installpkg sbopkg-0.38.2-noarch-1_wsr.tgz
or if you're updating from a previous version of sbopkg:
upgradepkg sbopkg-0.38.2-noarch-1_wsr.tgz
BLACKLISTING
Once again, we have to edit a file, in this case /etc/slackpkg/blacklist. Luckily, the part we have to edit is already there for us, just commented out, since so many Slackware users use the SlackBuilds repo.
With that line uncommented, we can then run slackpkg update to make the changes take effect.
With that over, we can now type sbopkg and we'll be presented with a nice menu. Since this is the first time we're using it, we'll sync the repository, either by selecting the option Sync or by typing sbopkg -r from the terminal (the menu is purely optional. sbopkg can function just the same from the terminal).
For the purposes of today's blog, I'll be installing a package known as i2pd. This package is a rewrite of the I2P network protocol in daemon form, written in C++. I'll also use this package to demonstrate the init system part of the blog later.
I can find the package one of two ways: either by selecting the search option and typing i2pd when prompted, or from the terminal. Because I'm a sucker for the terminal, and because there I can demonstrate another tool, I'll be going the second route.
One of the arguments often used by naysayers of Slackware is that its package management is unusably archaic, with no dependency resolution. With sbopkg this simply isn't true, as the sbopkg package also includes another neat tool, known as sqg. sqg is a tool for easily managing dependencies on packages in the SlackBuilds repo. All you do is type sqg -p <name of package>, and this will generate a queue of packages to install including the package you listed and all of its dependencies. For this example, I'll type sqg -p i2pd, following which I can load the queue it generated into sbopkg, either by entering the menu, selecting Queue, then Load, and finally selecting the i2pd queuefile. Instead, I'll do it the quick and easy way, by typing sbopkg -i i2pd in the terminal. If the package you selected has any dependencies, you'll be prompted to either type q to select the queuefile, p to just install the package you listed, or a to abort the process. Now, the i2pd package, has no dependencies, so I didn't even need to use sqg for this, but if you want to easily resolve dependencies, now you know how. So I'll type p to install just the package.
It'll now install the package by compiling from source
Now to clear up a weird thing about Slackware. It's technically a binary-based distro, meaning packages are precompiled before being installed, yet the SlackBuilds repo, which is inarguably the most popular third-party repo for Slackware, is source-based, meaning it compiles the software from source and turns it into a package which is then installed. If you use Arch Linux, this concept is similar to the Arch User Repository, or AUR. In fact, the creation of SlackBuilds was inspired by the AUR. The SlackBuilds repo is also one of the only third-party repos that has the seal of approval from Slackware creator Patrick Volkerding, so you know it's high-quality.
And now it's time for the init system!
THE INIT SYSTEM
So now that we've installed the i2pd package, it's time to talk about the init system. i2pd is a daemon, so if we desire, we can run it on bootup. All daemons on Slackware are stored in the /etc/rc.d/ directory. Unfortunately, in the case of i2pd, it doesn't seem to have put anything in this directory; luckily, we can create a system service to run using this handy template from the SlackDocs wiki. So I quickly created the necessary i2pd service.
To actually enable a service to run on bootup, just run chmod +x /etc/rc.d/<name of service>, in my case chmod +x /etc/rc.d/rc.i2pd. To disable a service, just run, for example, chmod -x /etc/rc.d/rc.i2pd. Note the -x instead of +x to disable. Now if we reboot, it should start up by default.
We have now set up a system service in Slackware, and it will work on startup.
CONCLUSION
I know this entry was also kind of long, but hopefully it still captivated you and taught you something. Again, I should stress that you should not rely on this blog as your sole source of Slackware information, as there are plenty of other (BETTER) sources of info, such as the SlackDocs wiki and the LinuxQuestions forum.
I'll be back soon enough!
Comments
Displaying 0 of 0 comments ( View all | Add Comment )