Many variants of GNU/Linux use the Red Hat Package Manager
(RPM). The rpm tool automates
the installation of software and the important dependencies among software
components. If you don't know whether on not your GNU/Linux uses the Red Hat
Package manager, you'll have to find a GNU/Linux expert to help you make
Red Hat Linux (and the related Fedora Core distributions) have a
version of Python pre-installed. Sometimes, the pre-installed Python is an
older release and needs an upgrade.
This book will focus on Fedora Core GNU/Linux because that's what I
have running. Specifically, Fedora Core 8. You may have a different
GNU/Linux, in which case, this procedure is close, but may not be precisely
what you'll have to do.
The Red Hat and Fedora GNU/Linux installation of Python has three
- Pre-installation: make backups.
- Installation: install Python. We'll focus on the simplest
kind of installation.
- Post-installation: check to be sure everything
We'll go through each of these in detail.
Resolving RPM Dependencies. When doing manual RPM installations, you may have to make several
passes. This occurs when the package you're trying to install depends on a
package that is missing or out of date. The installation step breaks down
into a series of attempts to locate and install the needed
First, attempt to install the package. If all of the foundation is
in place, this will work, and you'll be finished. If you don't have the
complete foundation in place, you'll get messages telling you what's
missing or out-of-date.
If RPM reports any missing or wrong
version packages, you must freshen or install the missing packages. This
will build the proper foundation. Note that foundations have
sub-foundations, and sub-foundations have sub-sub-foundations. This
process can go pretty deep, so keep notes on where you are in the
- Search for the missing our out of date RPM.
- Freshen or Install the missing package. This may lead to
a search for additional packages.
Finally, finish installing the package you started out trying to
install. Ideally, you took a detour and installed everything on which
this package depends, so the second time around it should install. If
the package doesn't install, you'll be back at step 2 with a different
list of foundational components to put in place.
Before installing software, back up your computer.
You should also have a directory for saving your downloads. I
recommend that you create a
/opt directory for these
kinds of options which are above and beyond the basic Linx installation.
You can keep all of your various downloaded tools and utilities in this
directory for two reasons. If you need to reinstall your software, you
know exactly what you downloaded. When you get a new computer (or an
additional computer), you know what needs to be installed on that
A typical scenario for installing Python is a command like the
following. This has specific file names for Fedora Core 9. You'll need to
locate appropriate RPM's for your distribution of Linux.
rpm -i https://download.fedora.redhat.com/pub/fedora/linux/development\
Often, that's all there is to it. In some cases, you'll get warnings
about the DSA signature. These are expected, since we didn't tell RPM the
public key that was used to sign the packages.
Run the Terminal tool. At the command line prompt, enter
python, and see what happens. Generally, we should be able to
and run the python
[[email protected] ~]$ python
Python 2.5.1 (r251:54863, Oct 30 2007, 13:54:11)
[GCC 4.1.2 20070925 (Red Hat 4.1.2-33)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
If you hit Ctrl-D (the GNU/Linux end-of-file character), Python
will exit. The basic Python program works.