| |
Chapter 9: How do I install software in Linux?
Topics covered in this chapter:
Installing .deb files (debian/ubuntu/linspire packages)
Installing .rpm files (red hat/fedora/suse/mandriva packages) with RPM and YUM.
Installing .tar.gz files (tarballs)
Installing .deb (Debian packages) and the APT System
|
Debian's package management system is a very well made packaging system. Much
like the one used by the RPM system, however, when DEB packages are combined
with the APT System, both the act of obtaining software, and issues with
dependent software are almost completely removed.
|
The DEB/APT system is now highly popular, and is found on many other systems
other than Debian, including the Ubuntu system we installed in Chapter 5, as
well as many others.
These are the main parts to the DEB system:
- 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 found in
/etc/apt/sources.list to obtain the relevant .deb file from the net.
- dselect - A 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 GUI tools for GNOME and KDE respectively
that provide an easy to use graphical front-end to installing software, which
most users will feel 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 Ubuntu Linux, and then we will briefly cover installation
at the command-line shell:
Installing software with the Synaptic Package Manager:

Click on image for a larger view
|
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!
|
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.
|

Click on image for a larger view
|

Click on image for a larger view
|
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.
|
|
If 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.
|

Click on image for a larger view
|

Click on image for a larger view
|
The example of 'kdegames' was specifically chosen because it is an example of
software that has dependencies on other software. Synaptic/APT is showing you
this fact 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 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.
|

Click on image for a larger view
|

Click on image for a larger view
|
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 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 can't see it, some older applications may need
manually entred into the menu - to do this, right click your Applications menu, and click 'Edit Menu'. You can find the location for
most software, by typing which followed by the software's program name,
at the command line shell. If that doesn't work, try using Synaptic again,
locate the software you just installed and right click it, view the
Properties, and click on 'Installed Files'.
|
Using APT-GET to Install software at the command-line shell:
Installing a deb package through apt-get is as simple as running the following
command at the root Linux prompt:
$ sudo apt-get install firefox
you will need to input your administrator 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 remove [software]
Removes [software] from your system, and any non-required dependencies.
Installing .DEB packages at the command-line 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.
...About the ads on this site...
Installing RPM files (red hat packages)
|
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 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 Core, 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, Ubuntui, 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 rpmfind.net and type in
netscape, 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 it's self
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:
- Open up a terminal/console:
su - (to become the root superuser)
Password: <your root password>
# 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 Core 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 (again, as root):
$su -
Password: <root password>
#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!
How do you install it, I hear you ask?
$su -
Password:
#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
...About the ads on this site...
Installing .tar.gz. files (tarballs)
.Tar.gz files, or, Tarballs 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 |
.tar.gz |
.tgz |
.tar.bz2 |
.bin.tar or .bin.tar.gz or .bin.tgz |
| standard tar archive with no compression. |
standard gzip compressed tar archive. |
same as .tar.gz. |
tar archive compressed with extra compression tool, bzip2. |
rarely seen 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
- In Gnome or KDE (Graphical Desktop):
Right click on the icon for the appropriate tar file in your file manager (nautilus/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 you have to either:
a) Compile the source code you just extracted
b) Run the installer script which is part of the files youextracted
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:
$su root (or sudo bash, depending upon distribution)
Password:
#chmod 755 vmware-installer.pl (change permission)
#./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 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 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 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, move
over to chapter 11 - 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 10.
|