Добавил:
Upload Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:
Linux+ Certification Bible.pdf
Скачиваний:
47
Добавлен:
15.03.2015
Размер:
3.78 Mб
Скачать

150 Part II Installation

Installing Additional Software with gzip and tar

2.17 Install and uninstall applications after installing the operating system (e.g., RPM, tar, gzip)

Many software packages can’t be installed with the Linux distribution because most commercial software won’t allow it. Many programs are a collection of binaries and libraries, compressed with the gzip utility, and brought together as one file with the tar utility.

The gzip (GNU zip) utility is the GNU compression utility that was designed to replace the original, Unix compress utility. The gzip utility is used to compress files in order to save space and speed transfer of large files. The first step is to unzip the file, which you can do with gunzip, which unzips Gzip files, by using the format gunzip <file name>.gz. When finished, you will be left with a file with the extension .tar.

A tar file is a single archive of multiple files; it can be created on a disk or tape. It supports spanning of media, which can save the data across multiple media such as floppy diskettes, and supports incremental and differential backups to allow great flexibility in use. Therefore, you can use tar on previously created archives to extract files, to store additional files, or to update or list the files that were already stored.

To extract files from the tar archive, use the tar utility to extract the individual files. The tar command takes the form of tar -xvf <file name>.tar. .tar. When the file extraction is complete, you will be able to compile and run the binaries to install the program.

Installing Additional Software with RPM

2.17 Install and uninstall applications after installing the operating system (e.g., RPM, tar, gzip)

2.19 Validate that an installed application is performing correctly in both a test and a production environment

RPM stands for Red Hat Package Manager, and is an open packaging system available to everyone. RPM is used to retrieve source code, and packages it into source and binary form. The binaries can then be installed and tracked, and the source is easy to rebuild. RPM maintains a searchable database of all the installed packages and is used to track all the files of the packages and can provide information about the installed packages. The RPM database is used to give the RPM command the ability to install, upgrade, and remove software packages. RPM uses switches to perform specific tasks. Table 5-3 lists most of the switches used by RPM.

Chapter 5 Advanced Installation 151

Table 5-3

Red Hat Package Manager Installation Commands

Switches used with

Switch performs this task

the rpm command

 

 

 

-i or --install

Used to install from RPM

 

 

--dbpath <path>

Uses <path> to find RPM database

 

 

--excludedocs

Do not install documentation

 

 

--force

Ignore package and file conflicts

 

 

--ftpport <port>

Use <port> as the FTP port

 

 

--ftpproxy <host>

Use <host> as the FTP proxy

 

 

-h

Print hash marks during installation

 

 

--ignorearch

Do not verify package architecture

 

 

--ignoreos

Do not verify package operating system

 

 

--includedocs

Install documentation

 

 

--nodeps

Do not check on dependencies

 

 

--noscripts

Do not execute preand post-install scripts

 

 

--percent

Prints percentages during installation

 

 

--prefix <path>

Relocate the package to another <path> if possible

 

 

--rcfile <rcfile>

Set alternate rpmrc file to <rcfile>

 

 

--replacefiles

Replace files owned by another package

 

 

--replacepkgs

Replace a package with a new copy

 

 

--root <path>

Set alternate root to <path>

 

 

--test

Performs installation test only

 

 

-v

Display additional information

 

 

-vv

Display debugging information

 

 

The most basic installation command for RPM is rpm -i filename-1.2-2. i386.rpm. The most common command that is used to install an RPM, however, is rpm -ivh filename-1.2-2.i386.rpm, which displays additional information, and displays hash marks to illustrate that the RPM is still working, which is helpful for large RPMs that take a longer time to install. You can use the other options, but in general, this is a basic RPM installation command.

You need to know the format and switches that are used with the RPM command.

152 Part II Installation

Removing software with RPM

RPM has the ability to remove software packages from the system. Use the switches in Table 5-4 to accomplish this task.

Table 5-4

Red Hat Package Manager Erase Commands

Switches used with

Switch performs this task

the rpm command

 

 

 

-e

Erase or remove one or more packages

 

 

--dbpath <path>

Use <path> to find the RPM database

 

 

--nodeps

Do not check on dependencies

 

 

--noscripts

Do not execute preand post-install scripts

 

 

--rcfile <rcfile>

Set alternate rpmrc file to <rcfile>

 

 

--root <path>

Set alternate root to <path>

 

 

--test

Performs installation test only

 

 

-v

Display additional information

 

 

-vv

Display debugging information

 

 

The rpm -e filename-1.2-2.i386.rpm command erases or removes the package. You can use an optional command to give more information, such as rpm -evv filename-1.2-2.i386.rpm, which gives detailed information about the removal of the package.

Use the erase switch with great care because RPM may remove packages that are required for the system to function. The system can be rendered useless if the wrong package is removed from the system.

Upgrading software with RPM

RPM can also be used to upgrade a package, which is no small task. To accomplish this, RPM tracks the installation and removal of previous packages in order to correctly install an upgrade to an existing RPM package. Table 5-5 lists the switches that you use to upgrade an RPM package.

Chapter 5 Advanced Installation 153

Table 5-5

Red Hat Package Manager Upgrade Commands

Switches used with

Switch performs this task

the rpm command

 

 

 

-U or --upgrade

Used to upgrade an RPM

 

 

--dbpath <path>

Use <path> to find RPM database

 

 

--excludedocs

Do not install documentation

 

 

--force

Ignore package and file conflicts

 

 

--ftpport <port>

Use <port> as the FTP port

 

 

--ftpproxy <host>

Use <host> as the FTP proxy

 

 

-h

Print hash marks during installation

 

 

--ignorearch

Do not verify package architecture

 

 

--ignoreos

Do not verify package operating system

 

 

--includedocs

Install documentation

 

 

--nodeps

Do not check on dependencies

 

 

--noscripts

Do not execute preand post-install scripts

 

 

--oldpackage

Permit the upgrading to an older package

 

 

--percent

Prints percentages during installation

 

 

--prefix <path>

Relocate the package to another <path> if possible

 

 

--rcfile <rcfile>

Set alternate rpmrc file to <rcfile>

 

 

--replacefiles

Replace files owned by another package

 

 

--replacepkgs

Replace a package with a new copy

 

 

--root <path>

Set alternate root to <path>

 

 

--test

Performs installation test only

 

 

-v

Display additional information

 

 

-vv

Display debugging information

 

 

Upgrading packages can be accomplished by using the command rpm -U file- name-1.4-4.i386.rpm. A more common way to upgrade is to use the command rpm -Uvh filename-1.4-4.i386.rpm, which displays additional information and provides hash marks during installation. Notice that anything similar to the rpm - ivh filename-1.2-2.i386.rpm, is also correct. The only difference is the use of the -U upgrade switch to perform an upgrade versus an installation with the -i