Contributed by mhearn
Compiling from source is something that will always work, given enough
time and patience. Things become a lot easier however when there is a
package available for your distro. Red Hat, SuSE and Mandrake all use
RPM packages, and it is vital that you only use RPMs designed for your
distro, and usually, for the exact
version of your distro.
Other RPMs may work, but also they may not. RPMs are normally clearly
labelled as to which distro they are meant for in their file names
(unless they are specifically designed to install on any), for example:
Code:
something-2.4-rh8.rpm
.. is probably meant for Red Hat 8. Another common abbreviation is mdk
for Mandrake.
RPMs meant for older versions of a distro can sometimes be installed on
newer ones, but rarely, if ever, the other way around. For instance, a
package meant for Mandrake 8.1 will probably install OK on 8.2, but a
package meant for Mandrake 9 will not run on 8.1.
To install an RPM, you must first download it and then, as root, run
this command:
Code:
rpm -Uvh something-2.4-rh8.rpm
Obviously replacing the made up name with the file you downloaded.
Remember to use tab completion to save typing!
Sometimes RPM may refuse to install a package. Errors about missing or
failed dependencies mean you need to find, download and install those
packages first. But be careful! Not all packages can be installed from
the net. In particular:
* Failed dependencies that mention GLIBC are probably an indication that
you downloaded an RPM meant for another distro, or a newer version of
your own distro. If there is no RPM available, use the source tarball
(tar.gz file). You cannot upgrade glibc, but you'll find that using an
RPM built for your distro, or compiling from source, will magically fix
this dependency.
* There are some packages that you almost certainly have on your
distribution CDs, but might not be installed depending on what options
you chose when you first installed Linux itself. Examples of such
packages would be gcc, GTK, glib, Qt, anything related to KDE or GNOME
and so on. When you need to resolve a dependency (install a package the
one you want needs), check the CDs first to see if they are available on
there. For Redhat users, you can use the "Add/Remove Packages tool" and
have a hunt under the options. Mandrake users might want to try urpmi.
* A file ending in .src.rpm is a different thing entirely, you probably
want to avoid these for now.
* If two packages appear to depend on each other, this is called a
circular dependency and can be fixed by specifying them all on the same
command line to RPM, for instance:
Code:
rpm -Uvh foo.rpm bar.rpm
If you're thinking this is a lot of hassle, you're right. An easier way
is to use a program that will automatically download and install (or
upgrade) the software you ask for, as well as anything it needs. For
Redhat users, you want to get apt - Mandrake users already have such a
thing included, called urpmi.
To install apt, get the RPM from freshrpms.net
(
http://apt.freshrpms.net/) and then run as root:
Code:
apt-get update && apt-get install synaptic
which will install the Synaptic GUI. You can then use it to pick the
software you want from a list and the package, and any dependencies,
will be automatically installed. A word of caution - not all software is
available via apt, so you'll still need to know how to compile from
source, and install RPMs by hand.
Sometimes RPM might freeze. If you run rpm from the command line, and it
doesn't do anything for say 30 seconds, RPM probably broke. To fix it,
make sure nothing is running that might be using it (for instance, shut
down synaptic or the add/remove packages window) and run these commands
as root:
Code:
cd /var/lib/rpm
rm __db.*
Finally, if you aren't sure about anything, you can always ask!
Installing software can be one of the most confusing and convoluted
aspects of using Linux, expect improvements to it in the next few years.
For now, just remember that if a program is being especially obstinate
about installing, rpmfind.net, freshrpms.net and the source tarballs are
your friends.
- thanks mhearn