Chapter 7: How do I install software?

7.1 The easy way: Ubuntu Software Center etc

Ubuntu's Software Centre

Ubuntu Software Centre shows how easy it is to download and install software in Linux.

There are many different distributions (flavours) of Linux, as demonstrated in Chapter 3: Choosing a distribution. Each distribution of Linux handles the installation of software slightly differently, however as we saw in Chapter 6, they all use one of three main ‘packaging’ types, so they rarely vary in drastic ways.

When Ubuntu Linux first came out back in 2005, it used the ‘Synaptic package manager’ as an easy-to-use tool to obtain software. You simply searched for the software you wanted, clicked ‘Select to install’ beside the package you wanted, then pressed Apply. It wasn’t hard to do, but since then, Apple made the App Store with the advent of the iPhone etc. Since then, the Mac, the PC (Windows) and Android mobile also got an App Store, so it’s only fair that some polish went into Linux too. The old synaptic package manager can still be used if so desired, however, if you use Ubuntu, you will likely prefer the Ubuntu Software Center. It shows you which software you have installed on your Ubuntu PC, as well as all of the software titles available from Ubuntu.  It even recommends software that you might like, based on the software you have previously downloaded.

Installing the software in the Ubuntu Software Center is as easy as clicking on the title you are interested in and tapping ‘Install’. The rest is done for you, and the application is available from the Ubuntu Launcher (that brown circle icon up at the top left-hand side of the screen).

The rest of this chapter talks about how to install software utilising traditional software packaging methods, including apt-get, synaptic package manager and YUM.

7.2 Installing .deb (Debian packages) and the APT Tool

debThe Debian package management system is a very well made software packaging model. It has similarities with the Red Hat system (RPM), however, when DEB packages are combined with the APT tool, both the act of obtaining software, and issues with dependent software are almost completely removed.

The DEB/APT system is highly popular, and is found on many systems other than Debian, including the Ubuntu, Linux Mint and more.

These are the main parts to the DEB system:

  • dpkg – A command line program with which you can install .DEB packages. This is the most basic (and most difficult way to install debian .DEB packages)
  • apt-get – An easy-to-use command line tool that offers a simple way to install packages, and unlike dpkg, does not work with the .deb package, but uses a file found in /etc/apt/sources.list to obtain the relevant .deb file from the net.
  • dselect – A text-based menu driven interface that acts as more than just a frontend to dpkg. Allows for installation and removal of packages
  • Aptitude – An ncurses terminal based front end to APT. It’s popular for it’s user friendly interface and highly descriptive nature.
  • Synaptic or Adept – The graphical frontend tools for GNOME and KDE respectively that provide an easy to use interface to apt-get. They make installing software easier as you don’t have to remember any commands, which most new users will feel more comfortable with.

Now that you know what the main Debian DEB tools are, we’ll step through installing a Debian package first using the Synaptic package manager, which is the default tool for Debian Linux, and then we will briefly cover installation at the command-line shell:

Installing software with the Synaptic Package Manager:

synaptic package manager

Synaptic Package Manager. Click thumbnail to expand

To start up Synaptic, click on the System menu at the top left of the desktop menu.

Then Click on Administration.

Finally, Click ‘Synaptic Package Manager’

Once you type your administrator password (which is the same password as the main user of the machine), you will shortly be presented with a screen similar to the one on the left.

Amongst the many options you see, there is a large list on the left hand side of the window.

This list contains all sorts of different categories of software. If you don’t know what you are looking for, start here!

Searching for packages in synaptic

Searching for packages in synaptic

By clicking on the Search button at the right hand side of the toolbar, it is possible to type in the name of a program you know the name of.

Note I am typing ‘kdegames’ here, because I know that I want the software package entitled kdegames.

By pressing the search button in the last step, I have now been shown the package ‘kdegames’ as well as a description, and version information.

synaptic-guide3If you are sure you want to install this title, then right click on it. The menu on the right will appear. By choosing ‘Mark for Installation’, the software ‘kdegames’ will be chosen for installation, when you apply these changes.

The example of ‘kdegames’ was specifically chosen because it is an example of software that has dependencies on other software (it needs other software titles to be installed for it to work). Synaptic/APT is showing you this synaptic-guide4fact and is conveniently telling you that it will also download the extra software shown in the menu to the left to ‘satisfy’ these dependencies.

You should click ‘Mark’, in order to continue.

One you click ‘Mark’, Synaptic will take you back to the main screen so that you may choose more software to install, if you wish.

If you are ready to install the software you chose earlier, click the ‘Apply’ button.

synaptic-guide5Synaptic gives you a warning message, telling you that new packages are going to be installed. By clicking on the Arrow beside ‘To be Installed’, you can see which ones.

If you are happy with this, click Apply.

Finally, the Synaptic Package Manager goes out to the Net, or perhaps requests a CD (if the data is to be found on the installation CD of your

The final step in downloading and installing software using the Synaptic Package Manager

The final step in downloading and installing software using the Synaptic Package Manager

Linux distro), and then installs the software onto your system.

Once the software is installed, you can generally use it directly from the ‘Applications’ menu. If you want to find out where the software was installed to, using Synaptic again, locate the software you just installed and right click it, view the Properties, and click on ‘Installed Files’.

If you would like to see a video guide on how to install software in Linux, using various methods, see our video tutorial here.

Installing software using APT-GET at the command line

Installing a deb package through apt-get is quick and is as simple as running the following command at the root Linux prompt (for example):

$ sudo apt-get install firefox

(you will need to input your password)

That example would install the most recent version of the program ‘firefox’. Apt would also tell you that it needs to download some other software (dependencies) in order for ‘firefox’ to run. A few other commands for Apt you’ll need are:

apt-get update

Updates the APT source information, to tell it about any new software in the APT repositories.

apt-get upgrade

Upgrades any old software on your machine to the latest versions automatically.

apt-get dist-upgrade

Upgrades the distribution to the latest available version of the distribution.

apt-get remove [software]

Removes [software] from your system, and any non-required dependencies.

Installing .DEB packages at the command-line shell:

Firstly, download the .deb package and pop it into any folder on your system, then simply install it by running the following command using the terminal:

$sudo 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.

7.3 Installing RPM files (red hat packages)

RPM LogoRed Hat, one of Linux’s first distributors came up with a neat solution to the problems .tar.gz files and compiling has for the normal user. They pre-package the thar file, zip it up and make it do all the hard installation work for you. This system is called RPM and it’s the standard software installation method for a lot of Linux distributions today, such as Red Hat, Fedora, SuSE and Mandriva.

If you are unsure if you have an RPM system or you just want to check what version of RPM you are using, then try typing the following at the Linux terminal:

$ rpm -q rpm
You should get a similar answer to this:
rpm-4.0.3-5

If you get something like ‘command not found’, then it sounds like you don’t have RPM installed, you may be using a Linux distribution that does not use RPM natively, for example, Debian, Ubuntu, Gentoo, Slackware, Mepis or Xandros have a look at the DEB or TGZ sections of this page.

It’s important that if you go to download an RPM from the net, always try to get one that was packaged by the vendor of your distribution.

For example, if you go to the web and search for an RPM package called ‘firefox’, and you get 3 RPMs back: One from Red Hat, one from Mandriva and one from SuSE. If you have a Mandriva Linux distribution on your PC, make sure you use the Mandriva one.

The reason for this is all down to fitting into your system configuration structure and things called libraries, which vary from distro to distro.

How to install the package

Okay, let’s presume that you have an RPM file ready to install called netscape-4.76-3.i386.rpm

You can install it in the following ways:

At the terminal/console:

sudo 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

Don’t use RPM – YUM is easier and better:

YUM (mentioned in the previous chapter) is a system much like Debian’s APT, but for Fedora and other RPM based distributions. It makes dependency problems far less likely for Fedora users.

Installing an RPM package through YUM can be done by the following steps using the Terminal application:

$sudo yum install netscape

Note that you do not need to specify the version of software you are installing. YUM goes out to the Internet and automatically pulls down the latest version it can find of ‘netscape’, and installs it for you, along with any other software you may need, in order to run ‘netscape’.

What if I don’t want to type commands in to install software via YUM?

Then use the graphical program, Yum Extender (or similar)!

How do you install it, I hear you ask?

$sudo yum install yumex

Now you can access Yum Extender in the “red hat” menu, under “System Tools.”

For further information on YUM, see This page

7.4 Installing .tar.gz. files (tarballs)

tar.gz icon.Tar.gz files, or, Tarballs stand for  tape archive and are the Unix equivalent of zip files for the Windows world. They can contain any files, but are often used to package up source code for programs.

Tarballs come packaged in five main flavours:

.tar  (standard tar archive with no compression.)

.tar.gz, .tgz (standard gzip compressed tar archive. same as .tar.gz.)

.tar.bz2 (tar archive compressed with extra compression tool, bzip2)

.bin.tar, .bin.tar.gz or .bin.tgz (less common tar archive that contains binary files rather than source).

Most of the time, you will be dealing with .tar.gz files.

Here’s how to extract (unzip) a .tar.gz file in two different ways:

At the Console:

$ cd /directory_that_the_tar_file_is_in
$ tar zxvf tarfile.tar.gz

To explain the latter command, tar decompresses the gzipped file (with the z flag, which is short for gz, or gzip), x means to extract, v is for verbose (so you can see what’s happening as it extracts) and f means extract the following file (in this case tarfile.tar.gz). Remember that tar was originally used for extracting archives from tapes, back in the old days, so by default it expects the standard input to be a streaming tape archive.

To extract a tar archive In Gnome or KDE (Graphical Desktop):

Right click on the icon for the appropriate tar file in your file manager.

Choose Extract (or in KDE, choose Open with Archiver).

Extract with the tar file with the relevant archiver program.

Okay, now you’ve extracted it you have to either:

a) Compile the source code you just extracted

b) Run the installer script which is part of the files you extracted

So, how do you distinguish whether you have just extracted a tar file with source code in it, or whether it’s a binary, with an installer in it?

Usually, the contents of the .tar.gz file will help you out here – A file containing source code, will often contain a file called ‘Makefile’ somewhere in the first folder within the extracted volume. This file is used to compile, or, make, the software.

A tar file which does not contain source code mainly holds a binary installer file in it, the filename of the installer usually ends in .sh or .pl.

For example, the program VMWare, contains a program called vmware-installer.pl in the extracted root folder.

To run the file, you usually need to give yourself ‘permission’ to run it:

sudo chmod 755 vmware-installer.pl (changes permissions on the file so that it can be read, write and run- executed)

sudo ./install-vmware.pl (runs the installer)

If you found a ‘Makefile’, then you need to compile the source code. Here’s how to do it:

Most of the time, you will need to use the terminal to compile source, so use an xterm/console/terminal 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 it’s helpful, it will tell you the names and websites of any other software you will require to download in order to install this software. These other pieces of software required are called ‘dependencies’.

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 install

(Take good notes here for any compile errors)

$ make clean

(this cleans up after a sucessfull compile)

Why compiling is a pain in the ass (for most people), and the problems you might have.

The above procedure doesn’t sound too difficult, and in theory, it shouldln’t be. But it dosen’t always work.

Most of the time this is because of dependencies on other programs, you need other software (usually programming libraries) to be installed first, in order to compile this software.

Picture this scenario: You attempt to install tar.gzipped game called xtux.

The ./configure bombs, and you noticed on the web site of xtux, and also from the output of the ./configure something about SDL. You’re not quite sure what it is, but you go onto a site like google 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 equal or greater than 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, make sure that if you have installed the normal version of an RPM (binary version), that you also install it’s accompanying -dev RPM if you wish to compile .tgz based source against it. By this I mean:

Make sure you have installed qt.i386.rpm and qt-dev.i386.rpm if you are compiling something that relies on QT, as the -dev package will provide the qt source code to the source program you are installing.

Dealing with your files and programs

If you’ve installed your tarball, RPM or DEB package and you want to run it, or perhaps you are interested in knowing more about the Linux file system including dealing with permissions, have a look at the tutorial on ‘managing my files‘.

Alternatively, If you want to know more about using your desktop every day, for office use, for multimedia and more, continue on to Chapter 8.

Be the first to comment on "Chapter 7: How do I install software?"

Leave a Reply