Chapter 9: How do I install my new software?


Topics covered in this chapter:
Installing .tar.gz files (tarballs)
Installing .rpm files (red hat packages)
Installing .deb files (debian packages)

Installing .tar.gz. files (tarballs)

Tarballs come packaged in five main flavours:

.tar .tar.gz .tgz .tar.bz2 .bin.tar or .bin.tar.gz or .bin.tgz
standard tar archive with no extra compression. standard gzip compressed tar archive. same as .tar.gz. tar archive compressed with extra compression tool, bzip2. tar archive that contains binary files rather than source.

Most of the time, you will be dealing with .tar.gz files, as they're a standard.
If you're familiar with .ZIP PKZIP/WinZip files on Microsoft platforms, .tar.gz files should be fairly easy to get the idea of, they work in pretty much the same way.

Here's how to extract a .tar.gz file in two different ways:
  • At the Console:
    $ cd /directory_that_the_tar_file_is_in
    $ tar zxvf tarfile.tar.gz

  • In Gnome or KDE:
    Right click on the icon for the appropriate tar file in your file manager (gmc/nautilus/kfm/konqueror).
    Choose Extract (or in KDE, choose Open with Archiver).
    Extract with the tar file with the relevant archiver program for your WM.

Okay, now you've extracted it, now comes the fun! - You gotta compile that mother!
It's pretty much expected that you are at the terminal to do this stuff, you can't really do it graphically. Drop down to an xterm or whatever and go into the directory that has been made by the package, eg:
$ cd /directory_that_the_tar_file_is_in
$ ls -l

Total 302
-rwxr--r--    1    user  group    2907    May 21  17:15  mytarfile.tar
-rwxr--r--    1    user  group    0015    May 21  17:15  newdir/

$ cd newdir/

at this point, make sure you read the INSTALL file. You'll find that almost every tarball that you download (especially GNU software) has at least a file called INSTALL, COPYING, README and CHANGES
Most of the time the INSTALL file says the same thing, it's a generic process for installing tarballs, but if a program requires to be compiled in a special way, you'll find out in either INSTALL or README.
If you were installing a generic program, extracted from a tarball and presuming that we just changed into our directory, as above, we could do the following to compile the program:

$ ./configure
    (Take good notes here for any configure errors)
$ make
    (Take good notes here for any compile errors)
$ make clean
    (this cleans up after a sucessfull compile)

and that's it. Sounds pretty easy, and in theory, it should be. But it dosen't always work. Most of the times this is because of dependencies on other programs. Picture this scenario: You attempt to install tar.gzipped game called xtux.
The game bombs out during a ./configure, and you noticed on the web site and also from the output of the ./configure something about SDL. You're not quite sure what it is, but you go onto freshmeat.net anyways and type in SDL. You find out that SDL is infact a popular graphics library for X and that it's necessary for xtux.
You download SDL-1.2.3.tar.gz from the SDL website and install that tarball. It installs fine, so you try installing xtux once more. It still bombs out, but this time it gives you a different message: could not find Qt => 1.3 on a ./configure. You check your system for QT version 1.3 or greater. You have 1.3.4 so you should be fine. Why is this error coming up? Well, it's probably because Qt (which is another graphics / programming toolkit) is installed, but is not in the folder that ./configure is looking in. You can edit ./configure yourself to see if there is anything you can do to amend the situation yourself, or try removing Qt, and installing another instance of it from another source.
I find that RPM based distros often put stuff like Qt in places that a normal tarball dosen't, so that's often the reason for these compile problems.

Installing RPM files (red hat packages)
Thankfully, Red Hat, one of Linux's first ever distributors came up with a neat solution to the problems .tar.gz files and compiling has for the normal user. They precompiled a tarball on their own systems, and included standard configurations, so much less configuring was required. This system is called RPM. At the time of writing, RPM is at version 4.0.3, and you can download the latest version of RPM from www.rpm.org.
Note: you will need RPM 3 to install RPM 4 and so on, so make sure that your distro can at least support RPM before you begin.
If you have a RedHat based Distro (otherwise known as an RPM based distro), you can happily install RPM packages straight away. RPM based distros include Red Hat linux, Mandrake, SuSE and Definite Linux amongst others. If you are unsure if you have RPM installed and running on your system, or you just want to check what version of RPM you are using, then try typing the following at the shell:

$ rpm -q rpm

You should get a similar answer:

rpm-4.0.3-5

If you get something like 'command not found', then it sounds like you don't have RPM installed. Eeek!.
Finally, when you go to get an RPM, always try to get one that was packaged by the vendor of your distribution, for example, if you go to rpmfind.net and type in netscape, and you get 3 RPMs back: One from Red Hat, one from Mandrake and one from Connectiva, and you have a Mandrake Linux distribution on your PC, use the Mandrake one. The reason for this is all down to fitting into your exising configuration structure, which varies from distro to distro.

How to install the package it's self
Okay, let's presume that you've been to rpmfind.net already, and you've got yourself an RPM, called netscape-4.76-3.i386.rpm
You can install it in the following ways:
  • At the console:
      as root (so do a 'su -' to become root)
      # rpm -Uvh netscape-4.76-3.i386.rpm
      Preparing [###################] 100%
      Installing [###################] 100%
      #

      The options -Uvh stand for the following:
        U - Upgrade package if already installed, or install if not installed
        v - Be verbose about the installation
        h - show hash symbols to indicate progress of installation

  • In KDE 2:
      Click the 'K' Start Button, click 'Run Command'
      Type in kdesu -c 'kpackage'. Press OK
      Type in the root password when prompted
      Click File, then Open
      Choose the package you want to install in the file browser
      Press the Install button.

      Kpackage busy at work - note the feature full options list and easy to use icons.
  • In GNOME:
      ! Do the following as root -- or run GnoRPM from a root shell
      Click the Gnome Start Button.
      Locate a program called GnoRPM
      Press the Install button
      Press the Add button
      In the new window choose the package you want to install
      Press Add, and it will be added to the list of programs to install
      Click 'Upgrade' and let the package install

      GnoRPM in action - Slightly less options, and a little harder to use than Kpackage, but still good

The only reason you should get any problems when installing is through dependencies. Unlike it's tarball counterpart, RPM makes counteracting dependent programs a breeze, you need only take note of the program(s) that the RPM is dependant on and make another visit to rpmfind or wherever and download the dependant RPM. Install that, and retry installing the first RPM again. It should install fine.


Installing .deb (Debian packages)
Second to RPM in popularity, Debian's package management system is actually a suite of command-line tools:
  • dpkg - the main package management program, used mainly to install DEB packages
  • apt-get - offers a simple way to install packages, and unlike dpkg, does not work with the .deb package, but uses a file called /etc/apt/sources.list to obtain the relevant .deb file
  • dpkg-deb - this tool manipulates deb packages, for example, extracts the contents of a deb package to a directory, or shows package information
  • dpkg-split - this tool splits packages into smaller parts, and makes it handy to split packages into 1.44MB parts, so that they can fit on a series of disks.
  • dselect - A menu driven interface that acts as more than just a frontend to dpkg. Allows for installation and removal of packages

Now that you know what the main Debian DEB tools are, we'll step through installing a Debian package at the shell:

$su
Password:

#dpkg --install package-name.deb

That should be the package installed, although again, there are dependencies to think about, and as with RPMs, make a note of any dependency errors, download the appropriate DEB package(s) to meet the dependenc(ies) and try again.
Both DEB and RPM are much, much better at dealing with dependencies, so as long as you can find the dependency in question, there should be little problem in resolving a dependency based problem for either RPM or DEB.

For more information on DEB, try debian's DEB Package-basics HOWTO

If you've installed your tarball, RPM or DEB package and you want to run it and you don't know how to, move over to chapter 10 - Managing my files
HOME | LINKS |