Installing Software Packages

 < Day Day Up > 



Now that you know how to start Linux and access the root user account, you can install any other software packages you may want. Installing software is an administrative function performed by the root user. Unless you chose to install all your packages during your installation, only some of the many applications and utilities available for users on Linux were installed on your system. On Red Hat, you can easily install or remove software from your system with either the redhat-config-packages tool or the rpm command. Alternatively, you can install software by downloading and compiling its source code. The procedure for installing software using its source code has been simplified to just a few commands, though you have a great deal of flexibility in tailoring an application to your specific system.

Many distributions, including Red Hat, Mandrake, and SuSE, use the Red Hat Package Manager (RPM) to organize Linux software into packages you can automatically install or remove. An RPM software package operates like its own installation program for a software application. A Linux software application often consists of several files that must be installed in different directories. The program itself is most likely placed in a directory called /usr/bin, online manual files go in another directory, and library files go in yet another directory. In addition, the installation may require modification of certain configuration files on your system. The RPM software packages perform all these tasks for you. Also, if you later decide you don't want a specific application, you can uninstall packages to remove all the files and configuration information from your system (see Chapter 29 for more details).

The software packages on your CD-ROMs, as extensive as they are, represent only a small portion of the software packages available for Linux. You can download additional software from online software sites such as sourceforge.net. The sourceforge.net site not only distributes software but also serves as the primary development site for a massive number of open source software projects. Many Linux software projects have migrated to sourceforge.net in the last few years. You can also locate many of the newest Linux applications from freshmeat.net or rpmfind.net. Here, you can link to the original development sites for these applications and download documentation and the recent versions. Table 4-2 lists several Linux software sites. For distributions such as SuSE, Mandrake, and Red Hat that support RPM packages, you can find RPM package versions for software on the online repository rpmfind.net. Packages here are indexed according to distribution, group, and name. This includes packages for every distribution, including previous versions of those distributions.

Table 4-2: Linux Software sites

Internet Sites

Description

ftp.redhat.com

Red Hat distribution RPM packages

rpmfind.net

RPM package repository

sourceforge.net

Source Forge open source software repository and development site

freshmeat.net

New Linux software

apps.kde.com

KDE software applications

www.gnome.org

GNOME software applications

Installing Packages with redhat-config-packages

The redhat-config-packages tool provides an effective and easy-to-use interface for managing the Red Hat RPM packages provided by your Red Hat distribution, whether you installed from CD-ROMs, DVD-ROM, hard disk, or network. It runs on any window manager, including GNOME and KDE. You can access redhat-config-packages using the Add/Remove Applications icon in the System Settings window. This opens an Add And Remove Software window that displays a left panel bar with icons for Install Software and Remove Software, and a panel that will display either software to be installed or software to be removed, depending on the icon selected. Initially, the Install Software icon will be displayed, showing a list of software groups with packages you can install. The View menu will let you switch between group and individual package views. If you know the name of the individual package you want to install, you can use the package view.

Groups with packages not yet installed will have an Install link at the end (see Figure 4-5). Those with all packages installed will have no Install link. An uninstalled package group will be organized into required and optional packages. You can select the optional ones, and the required ones will always be installed. A partially installed group will be organized into installed and uninstalled packages. You can then select the uninstalled packages you want to add, by clicking their check boxes. Once you have made all your selections, click Install Packages; redhat-config-packages will prepare a list of packages to install, checking for dependent packages. Once the list is prepared, you can click Details to see which RPM packages will be installed, if you wish. Click Continue to perform the installation. You will be prompted to enter the appropriate CD-ROM or just the DVD-ROM.

click to expand
Figure 4-5: redhat-config-packages

You can also choose to list the uninstalled individual RPM packages provided with your distribution. You can then select the packages you want to install. From the View menu, select Package view to list all currently uninstalled RPM packages, and then click the check boxes for the ones you want. To switch back to the Group display, select Group from the View menu.

To uninstall a package, first click the Remove Software icon on the bar displayed to the left of the Package panel. In the Group view, installed groups will be displayed with a Remove link at the end. To uninstall packages from a group, click the Remove link. This displays a list of installed packages with a checked check box next to each one. Deselect the ones you want to remove and leave selected the ones you want to keep. When you have finished making your selections, click Remove Packages to queue the packages for removal. Click Continue to perform the removal. In the Package view, all installed packages are listed and you simply select the ones you want removed.

You can also install a particular RPM package directly. You can use this method to install RPM packages you have downloaded or individual packages on your distribution CD-ROM. First display it with the file manager, and then double-click the RPM package file. You can also right-click it and, on GNOME, select Open With and then Install Packages, or on KDE, select Install Package. This invokes the redhat-config-packages tool, which will install the package. It will also check for dependent packages and install those. For packages that are part of your Red Hat distribution, it will prompt you to insert any other CD-ROMs as needed (for the DVD-ROM included with this book, there will be no prompt, as it already holds all packages).

Installing Packages with the rpm Command

If you do not have access to the desktop or you prefer to work from the command line interface, you can use the rpm command to manage and install software packages. This is the command that performs installation, removal, and verification of software packages. Each software package is actually an RPM package, consisting of an archive of software files and information about how to install those files. Each archive resides as a single file with a name that ends with .rpm, indicating it is a software package that can be installed by the Red Hat Package Manager.

You can use the rpm command to either install or uninstall a package. The rpm command uses a set of options to determine what action to take. The -i option installs the specified software package, and the -U option updates a package. With an -e option, rpm uninstalls the package. A q placed before an i (-qi) queries the system to see if a software package is already installed and displays information about the software (-qpi queries an uninstalled package file). The rpm command with no options provides a complete list of rpm options. A set of commonly used options is shown here:

Option

Action

-U

Updates package

-i

Installs package

-e

Removes package

-qi

Displays information for an installed package

-ql

Displays file list for installed package

-qpi

Displays information from an RPM package file (used for uninstalled packages)

-qpl

Displays file list from an RPM package file (used for uninstalled packages)

-K

Authenticates and performs integrity check on a package

The software package name is usually quite lengthy, including information about the version and release date in its name. All end with .rpm. In the next example, the user installs the freeciv package using the rpm command. Notice that the full filename is entered. To list the full name, you can use the ls command with the first few characters and an asterisk:

ls freeciv*

You can also use the * to match the remainder of the name, as in the following:

ls freeciv-1*.rpm

In most cases, you are installing packages with the -U option, for update. Even if the package is not already installed, -U still installs it.

$ rpm -Uvh freeciv-1.14.0-2.i386.rpm 

When RPM performs an installation, it first checks for any dependent packages. These are other software packages with programs the application you are installing needs to use. If other dependent packages must be installed first, RPM cancels the installation and lists those packages. You can install those packages and then repeat the installation of the application. To determine if a package is already installed, use the -qi option with rpm. The -q stands for query. To obtain a list of all the files the package has installed, as well as the directories it installed to, use the -ql option. To query package files, add the p option. The -qpi option displays information about a package, and -qpl lists the files in it. The following example lists all the files in the freeciv package:

$ rpm -qpl freeciv-1.14.0-2.i386.rpm 

To remove a software package from your system, first use rpm -qi to make sure it is actually installed, and then use the -e option to uninstall it. As with the -qi option, you needn't use the full name of the installed file. You only need the name of the application. In the next example, the user removes the freeciv game from the system:

$ rpm -e freeciv 

Package Security Check

If you download an RPM package, you may want to check its integrity and authentication, making sure the package was not tampered with and that it was obtained from a valid source. To just check a package's integrity you can use the rpm command with the -K and the --nogpg options. A value called the MD5 digest measures the contents of a package. If the value is incorrect, the package has been tampered with. See Chapter 16 for more details on integrity checks and MD5 digests. Some packages, like Webmin, provide just digest values, allowing only integrity checks. In the next example, the user checks whether the freeciv package has been tampered with. The --nogpg option says not to perform authentication, doing the integrity check only.

$ rpm -K --nogpg freeciv-1.14.0-2.i386.rpm 

To authenticate a package, you check its digital signature. Packages are signed with encrypted digital keys that can be decrypted using the public key provided by the author of the package. This public key has to first be downloaded and installed on the encryption tool used on your system. Red Hat, along with most Linux systems, uses the GNU Privacy Guard (GPG) encryption tool. GPG and authentication methods along with public keys are discussed in detail in Chapter 16. To use a public key to authenticate an RPM package, you first have to download the public key and install it in the RPM key database. For all Red Hat RPM packages that are part of the Red Hat distribution, you can use the Red Hat public key, placed during installation in the /usr/share/rhn/RPM-GPG-KEY file. You need to manually import the key to the RPM database before you can check Red Hat RPM packages, as shown here.

rpm --import /usr/share/rhn/RPM-GPG-KEY

If you have downloaded an RPM package from another site, you can also download and install its public key, with which you can authenticate that package.

Once the public key is installed, you can check the package's authentication using the rpm command with the -K option.

$ rpm -K freeciv-1.14.0-2.i386.rpm

To see a list of all the keys you have imported, you can use the -qa option and match on the gpg-pubkey* pattern. Using rpm with the -qi option and the public key, you can display detailed information about the key. The following example shows the Red Hat public key:

$ rpm -qa gpg-pubkey* gpg-pubkey-db42a60e-37ea5348

Installing Source Code Applications

Many programs are available for Linux in source code format. These programs are stored in a compressed archive that you need to decompress and then extract. The resulting source code can then be configured, compiled, and installed on your system. The process has been simplified to the extent that it involves not much more than installing an RPM package. The following example shows the common method to extract, compile, and install software, in this case the KonCD program, a CD writer and ripper. Always check the included README and INSTALL files that come with the source code to check the appropriate method for creating and installing that software.

Tip 

Be sure that you have installed all development packages onto your system. Development packages contain the key components such as the compiler, GNOME and KDE headers and libraries, and preprocessors. You cannot compile source code software without them.

First you locate the software—in this case, from apps.kde.com—and then you download it to your system. KonCD is downloaded in a file named koncd-1.0rc2.tar.gz. Then decompress and extract the file using the tar command with the xvzf options, as shown here:

tar xvzf koncd-1.0rc2.tar.gz

This will create a directory with the name of the software, in this case kreatcd-1.0rc2. Change to this directory with the cd command:

cd koncd-1.0rc2

Issue the command ./configure. This generates a compiler configuration for your particular system.

./configure

Compile the software with the make command:

make

Then install the program with the make install command:

make install 

Most KDE and GNOME software will also place an entry for the program in the appropriate menus—for example, a KonCD entry will be placed in the KDE Applications menu. You can then run KonCD from the menu entry. You could also open a terminal window and enter the program's name.



 < Day Day Up > 



Red Hat(c) The Complete Reference
Red Hat Enterprise Linux & Fedora Edition (DVD): The Complete Reference
ISBN: 0072230754
EAN: 2147483647
Year: 2004
Pages: 328

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net