Linux.com

Home Learn Linux Linux Tutorials Intro to Slackware Package Management

Intro to Slackware Package Management

Print PDF

Many users decide to use Linux based operating systems because of the freedoms they enjoy, included in the list is the freedom to choose the right tool for the job. The Slackware package management schema is a model for displaying the choices that are available to the users. When maintaining a server or even a personal system a certain amount of control must be given to the administrator, the control and simplicity of Slackware package management is what may in fact make you want to try Slackware.

Brief Explanation of Slackware Packages

In terms of security and accountability Slackware is excellent because it beings you software in the condition that the authors intended. What this means is that the Slackware community does not modify the source or add and remove functions from software beyond the author's design. All packages are built using the original source code in which only official patches are applied, the only modifications that are made for the packages are adding .desktop files (executables for windows managers) and running installed applications/scripts to update application, font or icon caches to include the newly installed files.

Other distributions such as debian and redhat choose to modify the original source code with their own revisions prior to distributions, this can add additional functionality but in some cases such as the debian OpenSSL packages (http://www.securityfocus.com/bid/29179) it can result exploits that only effect your distribution which can remain unseen for some time because the original authors (those who know the apps best) were not responsible for the changes or aware of the changes. This additional liability is something that doen't want hanging over your head when running a production system which requires heightened security and uptime, with Slackware these issues cannot happen all code that is used has been developed by those who know the functionality of the applications best, namely the original authors.

The Slackware packages can be found with any of the following extensions:

  • tgz - Slackware package archive compressed using gzip
  • tbz - Slackware package archive compressed using bzip2
  • tlz - Slackware package archive compressed using lzma
  • txz - Slackware package archive compressed using xz

Currently the two most commonly used formats are tgz and txz. txz is the current standard for official packages because of the increase compression rate, this change has allowed the development team to reduce the filesize in installation packages which in turn reduced the space requirements for the installation DVD, leaving additional space for new apps or documentation to be added in the same space as before. The tgz format has a less impressive compression rate but it is sufficient for packages that you build on your system since on most systems disk space is abundant.

Dependency Tracking

One of the major complaints by new users is the fact that Slackware does not automatically track dependencies and install dependencies when you install a file.  To many this may seem like a negative mark against Slackware, but I prefer to know exactly what is installed on my system and what it is for.

Why is Automatic Dependency Resolution is Bad Thing?

  • Lack of administrative control
  • It prompts for installation of packages that may have a bad security history, without manual research you would not be able to verify the security history of an installed package
  • It may install an app that conflicts with current installed apps which can break software components in your system.
  • If you may decide to recompile an app and remove certain functions, the removal of said functions may eliminate the need to have specific dependencies installed but with an auto-resolution system it will force those packages even though they are not needed

The official and many of the third-party package management tools in Slackware try to keep away from automatic dependency resolution so that the administrator is in full control of the system.

Installation and Package Management Tools

There are many package management tools for Linux both official and from third-parties, I will be discussing them below.

Official Tools

Included in the base installation of Slackware are two packages pkgtools and slackpkg.  pkgtools contains a set of application that are o be used for basic package management. slackpkg is a package manager and update tool for you to use with the official Slackware servers.

pkgtools contains the following executable applications, refer to the man pages on your system for more detailed information including options and syntax.

  • installpkg - This application is used to install a new package
  • removepkg -This application is used to remove a package from your system
  • upgradepkg - upgradepkg upgrades a Slackware package from an older version to a newer one.  It does this by INSTALLING the new package onto the system, and then REMOVING any files from the old package that aren't in the new package (taken from the man pages)
  • explodepkg - This tool uncompresses and untar a Slackware package into your current directory.
  • pkgtool - pkgtool is a menu-driven package maintenance tool provided with the Slackware Linux distribution.  It allows the user to install, remove, or view software packages  through an interactive system.  Pkgtool can also be used to re-run the menu-driven scripts normally executed at the end of a Slackware installation.  This is useful for doing basic reconfiguration (like changing the mouse type). (taken from the man pages)
  • makepkg - This application is used to create a new Slackware package from the contents of your current directory.

slackpkg is to be used to installed official slackware packages from the official Slackware servers and to manage updates and upgrades, this tools is very useful for keeping a system up-to-date and for doing a distribution version upgrade without having to do a reinstall or having to download and burn a disk.

 

Unofficial Tools

The unofficial tools are tools that were made by third parties which are not officially supported by Slackware.  These tools can be broken into two groups package retrieval and package building. The package retrieval tools have a functionality which is similar to YAST, yum, apt-get, urpmi and various tools which are used in other distributions.  These package retrieval tools call to specific package repositories which have been set by the user and allow the user to search the repositories and download and install pre-configured packages. In contrast the package building tools are somewhat similar to the package retrieval tools but rather than downloading a pre-build package they retrieve a build script (which can be customized and the subsequent source code allowing the user to custom compile an application for their system and their needs, once the application has been compiled the scripts pass the proper instructions to utilize the resulting binaries and build a Slackware formatted package that properly interacts with the Slackware package management tools. The best comparison for package building tools is to compare them to the portage system that is used in the BSD Operating Systems.

Listed below are the Unofficial tools and a brief explanation of their functionality.

  • swaret – This tool is designed to replicate the functionality of the Debian apt-get system, you identify the repositories you would like to use and it allows you to download and install packages from the specified location, this tool also attempts dependency resolution.
  • slapt-get - This tool is designed to replicate the functionality of the Debian apt-get system, you identify the repositories you would like to use and it allows you to download and install packages from the specified location.
  • sbopkg  - This tool syncs with the slackbuilds.org build script repository, it is used to pull build scripts, upon choosing the scripts to build it allows you to choose the build order and also customize the scripts. Upon completion of the scripts it will allow you to build a Slackware package or to build and install the package. If you choose to use a third party tool, this is the one I recommend; it has the highest probability or package stability and allows you to customize your packages.

Unofficial Sites/Repositories

  • slackbuilds.org – This site holds community submitted builds scripts to easily build Slackware packages from the source code of various applications.
  • linuxpackages.net – This is a repository of pre-built packages.
  • slackware.it - This is a repository of pre-built packages.
  • alienBOB's repo (http://connie.slackware.com/~alien/slackbuilds/) – First of alienBOB is able to do things that others can’t, so I trust his work immensely. His site contains pre-built packages and the associates build scripts use d to build them, so you can use it to download packages or to get stable build scripts and build the packages to fit your needs.

Please add repositories and sites that I missed in  your comments.

Installation Methods

Now because of the quality of various tools you have options for various functionality when it comes to package management and installations. The main three methods of installation are listed below:

  • Install from a pre-built package
  • Compile the app yourself from the source code, This is ill advised in it’s standard meaning, I will discuss this later.
  • Build a custom package from a build/slackbuild script

Install from a Pre-built Package

To install Slackware from a pre-built package you can use installpkg, upgradepkg, swaret or slapt get. This is very simple, in swaret or slapt-get you only need to choose the package and select to install it. To install a package using the official tools you only need to call the program and use the package name as the argument, (example.. installpkg wine-2.5.6-x86.tgz).

Compile the App from the Source Code

I know that many people have grown accustomed to this method over time, but it is not preferred in Slackware, instead to document your actions and avoid replication of efforts it is advisable to build a slackbuild script, believe me this will save you some time and effort in the future.

Build a Custom Package from a Build/slackbuild Script

This is the true magic in Slackware, every official package that you receive has a slackbuild file, in the source directory on the Slackware disk you will find the slackbuild files and source code for every package. This availability in the source directory allows you to view all options/modifications that were done to a package and if you need you can modify the script and arguments to fit your needs. Once the script has been run and the package has been built you then have a redistributable package for the specified application that fits your needs.

The slackbuild.org script repository houses user submitted scripts for building stable applications for Slackware that have been tested on various architectures by extremely knowledgeable members of the Slackware community. Included in the slackbuild archive are the build script, license information, .desktop files (if needed), icons, and a .info file that tell you the version, source download location, md5sum, supported architectures and the author of the script. There is also a mailing list and an irc channel available if you have questions or experience problems.

Now for an example of how to build a package from a slackbuild, I will use audacity as an example .

  1. Find the app on slackbulds.org, for audacity the page is http://slackbuilds.org/repository/13.0/audio/audacity/.
  2. Read the description to see what options are available and what dependencies are needed.
  3. Download the slackbuild file/archive to your computer.
  4. Extract the archive using tar or your preferred archive management tool, to extract the archive using tar you would type “tar xvf audacity.tar.gz”, this will extract the contents to a directory within your current directory named audacity.
  5. Go into the newly created directory.
  6. Download the source download that is listed on the slackbuilds.org website, a clean method is to use wget, for example you can type “wget –c http://downloads.sourceforge.net/sourceforge/audacity/audacity-minsrc-1.3.7.tar.bz2”, the –c option is to make it continuous so that if you loose a connection you can restart from the last point in the download.
  7. Verify the md5sum of the downloaded source archive, to do it with this archive you would run “md5sum audacity-minsrc-1.3.7.tar.bz2”, if the checksum does not match the one on the website then your download was corrupt and needs to be downloaded again.
  8. Open the .Slackbuild file with a text editor.
    1. Modify the arch line (ARCH=${ARCH:-i486}) to reflect your system’s architecture, this can be pulled by running uname –a in the terminal.
    2. If you need you can go to the configure section to add or remove compile time options.
  9. Save and close the document.
  10. As root run the slackbuild file, in this case you would run “sh audacity.SlackBuild”.
  11. When the build and package process it complete the location of the resulting package will be announced, you will only need to install the package after this.

Slackbuilds.org has a howto page that can help you also (http://slackbuilds.org/howto/).
Also if you can build a program from source then it is advisable to make a build script using the examples from slackbuilds.org around the compile operations, this will allow you to add documentation and save your build actions for future use.

Package Tracking

When using Slackware you have the ability to track the installation date, installed files, and package description of all packages that are installed on your system, This tracking is done within the /var/log/packages directory, this directory contains a single text file for each installed application, the file contains the package description and list of installed files/directories from the current package. You can easily view the list of files within the /var/log/packages directory and sort by name, creation date or whatever additional criteria you use. 

For some examples of the usability of the /var/log/packages directory I will show you the following. If you are looking to see what package installed a specific file to your computer, let say the file is /sbin/iptables, you can run the commands “cd /var/log/packages;grep /sbin/iptables *” this will display all files within the current directory that contain the exact phrase that was called by grep. If you want to review the installed files for a package to find all files that were installed in the /bin directory, let say we are looking at the pkgtools package, you can run the command “cat /var/log/package/pkgtools-13.0-noarch-3.txt|grep /bin/”.

In a similar fashion Slackware moves the text files from /var/log/packages to /var/log/removed-packages when you remove a package from your system, this makes it easier to have adequate tracking of what you have installed and what you removed and when each action was taken, this will help you greatly if you are wanting to replicate the list of installed packages from one server to another, you can easily write a script to compare the output of the folders on both systems and output a resulting file of non-matching packages that you can later use in a script for automatic installation..

That is all that I can think of right now on this subject. I am sure that the readers will have much to add to detail additional options and functionality, so please add whatever you like in the comments.

I know that I did not cover any specific tool in-depth but if you would like an in-depth explanation, please post a request in the Linux.com forum and I will gladly write up more detailed responses.

Comments (10)Add Comment
Gianni
slacky.eu repository
written by Gianni, December 05, 2009
You forgot the largest unofficial repository: Slacky.eu

Slackware.it has not an unofficial repository. It has the "Slackware Package Browser" (currently broken smilies/sad.gif . The author is creating a new one...)

You can find a list of repositories here:
http://slackfind.net/en/packages/repositories/

(slackfind.net is a search tool for slackware-packages across repositories)
mfillpot
Thanks for the comment
written by mfillpot, December 05, 2009
Gianni,
Thank you for your comment.
This was only an attempt to give brief information to show people the package management options, so I am glad that you could give additional information. I was unaware that slackware.it is official, so it is good to be corrected. And thank you for pointing out the list of repositories, this is all valuable information.

I have had some bad prior experiences using European package repositories because some of the packages were compiled in languages that I do not know, can you give information about languages that were used during compile time for the repositories that you listed?
Gianni
...
written by Gianni, December 06, 2009
Thanks for your answer.

Slacky.eu is an Italian Community but packages are dowloaded from around the world.
From what I know the packages are compiled with the languages provided by the original source.
Some packages built with the original binary (for example mozilla-xy) are in Italian and in English version (if Slackware does not provide a packgage). They add an -it or -en suffix.

In any case, every package in the repository has the Slackbuild. smilies/wink.gif You can check the options used by the packagers.


Examples:

- Mozilla Firefox and Thunderbird in the repository are only in Italian because Slackware has the English version. The packages are mozilla-firefox-it and mozilla-thunderbird-it.

- Mozilla Sunbird: mozilla-sunbird-en-us and mozilla-sunbird-it

- Opera package is multilanguage: opera-multilanguage-versionxy

- Openoffice is not provided as a real package: there's a multilanguage-autobuilder package. You can build your package: the script asks you to specify your language, then downloads the right binary and build the package.
mfillpot
...
written by mfillpot, December 06, 2009
Thanks again for the good information.
Is there any additional information or package management options that you felt I missed or require further information for potential users?
Jon Zacsh
good article
written by Jon Zacsh, December 09, 2009
Thanks for the article, short and to the point. Finding myself in using screen all day in Ubuntu's xterm, I don't see any more reason not to move to a more custom build. This article makes a nice introduction. Funny: yes, I *was* just told, today, that Slackware has a useless package management system. I think I'll try it, anyway smilies/smiley.gif
V. T. Eric Layton
...
written by V. T. Eric Layton, January 23, 2010
Excellent information. Reposted at --> http://forums.scotsnewsletter....opic=32216
Bradley D. Thornton
You forgot Robby Workman's package respository...
written by Bradley D. Thornton, March 01, 2010
Located here: http://rlworkman.net/pkgs/

All in all one, if not the, best treatises on Slackware packaging tools, methodologies, and resources wrapped into one cohesive article.

Bravo!
mfillpot
...
written by mfillpot, March 02, 2010
Bradley,
Thanks for adding Robbie's packages to the list, I can't believe that I forgot to include his repo.
Bradley D. Thornton
...
written by Bradley D. Thornton, March 02, 2010
No Prob smilies/smiley.gif

Actually, with the totally comprehensive nature of your article there just had to be something that got left out smilies/wink.gif

BTW, for those who don't know, Robby's OpenOffice.org package is the one that most people get and install. Sure, you can go and do an SBo, but considering the size of it, and the fact that Robby is one of the majors at Slackware.com (and SlackBuilds.org), people can rest assured that simply d/l/ing and installing his OpenOffice.org package is the quickest, simplest, and wrt just getting a package and installing it, the most trustworthy.

Basically, most of us are quite leary of intalling ANY packages NOT created by Eric or Robby, and build our packages with SlackBuilds.

non sequitur: SalixOS has a repository of (IMO) trusted packages that will work fine on Slackware 13.0, and if you're running Salix, you can use any Slackware 13.0 packages too smilies/smiley.gif In fact, their dependancy checking package management system gets packages from official Slackware package repositories unless they don't exist, in which case those packages are installed from the Salix repos smilies/wink.gif

Once again, Thanks for a truly excellent article mfillpot!!!!

Kindest regards,

Bradley
securitybreach
Excellent post
written by securitybreach, May 13, 2010
Thanks for the excellent overview of Slackware's package management

Write comment
You must be logged in to post a comment. Please register if you do not have an account yet.

busy
Become an Individual Member

Who we are ?

The Linux Foundation is a non-profit consortium dedicated to the growth of Linux.

More About the foundation...

Frequent Questions

Join / Members / Staff / Board