Monday, May 28, 2012

First steps with Slackware: how to install software

When I started using Slackware, I was coming from Ubuntu. Used as I was to a packet managers doing everything automagically, I was a bit puzzled by Slackware's way. So after messing up for a while my first installation I discovered three ways to install software that I'm comfortable with:
  • using a pre-compiled package (easier)
  • using a slackbuild script (easy)
  • using sources (less easy)
But let's start from the beginning.

Understanding how and where software files are stored


Usually in Slackware software is installed in /usr/, unless you specify otherwise. In most cases you will have all the software's files copied to /usr/lib/softwarename and a symlink in /usr/bin, usually linking the main executable placed in /usr/lib/softwarename.

Finding packages


To get the package you need, the first place to look is your Slackware install disk(s). If you don't have it by hand, another way is to search it in the official Slackware mirrors.

All the packages will be located in the "slackware" directory, each in it's category subdirectory. What if you are not sure about which subdirectory is the correct one? Easy, just open PACKAGES.TXT (you can find it on mirrors too) and search for the package's name: in the package description you will see a line telling you where the package is located (for example "PACKAGE LOCATION:  ./slackware/l".

The same procedure will be useful if you have to locate your package inside one of the ftp mirrors. Jus go to to the GetSlack page on official Slackware website, choose a mirror, choose your Slackware version (the one not ending with "-iso"), open "slackware/PACKAGES.TXT") and start searching.

If you can't find your package in these places, it means it is not officially part of the Slackware distribution, but you still have a chance to avoid sources. How? First, you can search on Slacky.eu, a very nice package repository, and if you can't find it there neither you can try looking into slackbuilds.org and hope to find a slackbuild. If it's not there either, the last option is searching for sources ("softwarename linux sources download" as keywords usually will do the trick).

I usually create a directory "packages" on an external disk or a data partition, and i save all the packages I download there, so if I will have to install Slackware somewhere else I will have by hand everything I need, ready to be installed.

Multiple versions


Usually it's a good thing to avoid using multiple versions of software. To check if you already have another version of the software installed, you can use two different methods: pkgtool for packages, and a harsh find /usr -iname "*softwarename*" (as root) for everything else. If you don't need a double version of the software it is better to remove the older before installing the new one.

Install a package


This one is the easiest: just cd in the directory where the package is located (on the CD/DVD or in the directory where you downloaded it) and run as root installpkg packagename.txz. I noticed that in Slackware 13.37 it's possible to use installpkg to install packages from earlier versions too (like Slackware 13.00 or Slackware 12.20), but I have not idea of how this could mess the things up, so do it at your own risk.

Compile a slackbuild


Slackbuilds.org's howto page is clear enough, but I can try to make it simplier:
  • search slackbuilds.com for the software you want to install
    firefox http://slackbuilds.org/result/?search=skype&sv=13.37
  • crate a directory to store your slackbuilds files and scripts
    mkdir slackbuilds
  • move to the directory
    cd slackbuilds
  • download the slackbuild package from slackbuilds.org
    wget http://slackbuilds.org/slackbuilds/13.37/network/skype.tar.gz
  • extract the files
    tar xvf skype.tar.gz
  • move to the slackbuild's directory
    cd skype
  • download source package (into the slackbuild's dir!)
    wget http://download.skype.com/linux/skype-2.2.0.35.tar.bz2
  • make the slackbuild script executable
    chmod +x skype.SlackBuild
  • execute the slackbuild script
    ./skype.SlackBuild 
  • move the newly created package to your package's dir (if you have one)
    mv /tmp/skype-2.2.0.35.txz /home/username/packages
  • install the package
    installpkg /home/username/packages/skype-2.2.0.35.txz

Compile and install sources


C'mon, do I really need to tell you? Ok, let's explain it briefly: you will face a package, usually a *.tar.gz or a *.tar.bz2, extract it somewhere (using "tar -xvf packagename" command), move into the newly created dir, run the scripts ./configure, make and make install (last one as root) and you're done.
If the compile script requires a prefix to install, better use /usr since it's where everything is usually installed on Slackware.

Solving dependencies issues


Sometimes when you install a package some libraries and other software are missing, and when you try to run the newly installed software it will exit with an error saying what's missing. In this cases, ldd will be your friend: just run ldd /path/to/executable | grep not to see a list of everything is missing (usually /path/to/executable will be /usr/bin/softwarename). At this point, search and install all missing packages.

Usually to find in which package is located the library I'm searching for I search pkgs.org for the library name, and then I search it on packages repositories as mentioned above.

2 comments:

  1. Thank you man ... you were really so useful for me and in details .. I appreciate your efforts and time to type all of these .. :)

    ReplyDelete
  2. I was not a man last time I checked but... hey, you're welcome. ;)

    Sadly I don't have enough spare time lately to write other posts. :(

    ReplyDelete