0% found this document useful (0 votes)
96 views8 pages

Enter Your Search Terms

Rpm performs package installation, updating, and removal. It also checks file integrity, sets permissions, backs up configuration files. Rpm provides four options for installing, upgrading, and removing software.

Uploaded by

Deepak Yadav
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
96 views8 pages

Enter Your Search Terms

Rpm performs package installation, updating, and removal. It also checks file integrity, sets permissions, backs up configuration files. Rpm provides four options for installing, upgrading, and removing software.

Uploaded by

Deepak Yadav
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 8

Search pub-8640800643 1 ISO-8859-1 ISO-8859-1 GALT:#008000;G en

Submit search form


Top of Form

Bottom of Form

Related tags
You are here: CodeIdol.com > Unix > Fedora Linux > Package Management > Installing
And Removing Software Using RPM

SAVE
Digg

del.icio.us
Popular Categories
Technorati Unix books and guides

AJAX popular information


reddit
C# language guides
Windows books and
5.2. Installing and Removing Software Using RPM cookbooks
In addition to queries, rpm performs package installation, updating, and removal. As well as
copying files to the correct locations (or deleting them), rpm checks file integrity, sets .......
permissions, backs up configuration files, and executes scripts within the affected package
and other packages that have asked to be notified of changes (trigger scripts). These scripts
can in turn start or stop services, modify configuration files, or perform other operations.
5.2.1. How Do I Do That?
rpm provides four options for installing, upgrading, and removing software:

-i package_file
Installs a package that is not currently installed.

-U package_file
Upgrades an existing package version, or installs the package if it is not currently
installed.
-F package_file
Freshens an existing installation of the package by upgrading the version. If the
package is not currently installed, it remains uninstalled.

-e package
Erases the installed package. Unlike the other options, -e requires a package name
(httpd), not a package filename (httpd-2.0.54-10.i386.rpm).
All of these operations must be performed as the root user (unlike queries, which may be
performed by anyone). This prevents unwanted software, such as viruses and worms, from
being installed in the normal course of activities.
To perform a basic installation of a package, use the -i option and supply the name of a
package file:
# rpm -i httpd-2.0.54-10.i386.rpm

To upgrade the package:


# rpm -U httpd-2.0.62-3.i386.rpm

In this case, the upgrade would succeed even if httpd package weren't already present on the
system; it would be installed.
To remove the package:
# rpm -e httpd

Note that in this case, only the package name is given, not a package filename.
No additional arguments are needed if the installation or removal does not affect any other
packages, but frequently a package to be installed will depend on other packages:
# rpm -i ogle-0.9.2-1.1.fr.i386.rpm
error: Failed dependencies:
libdvdread >= 0.9.4 is needed by ogle-0.9.2-1.1.fr.i386
libdvdread.so.3 is needed by ogle-0.9.2-1.1.fr.i386
libmad.so.0 is needed by ogle-0.9.2-1.1.fr.i386

Likewise, when removing a package, other packages can depend on that package:
# rpm -e httpd
error: Failed dependencies:
httpd-mmn = 20020903 is needed by (installed) mod_auth_kerb-5.0-
6.i386
httpd-mmn = 20020903 is needed by (installed) mod_auth_mysql-2.6.1-
4.i386
...(Lines snipped)...
httpd = 2.0.54-10.2 is needed by (installed) mod_ssl-2.0.54-
10.2.i386
httpd is needed by (installed) squirrelmail-1.4.6-
0.cvs20050812.1.fc4.noarch
The solution is to add or remove all of the needed packages at the same time ( \ indicates that
the line is continued):
# rpm -i a52dec-0.7.4-4.fr.i386.rpm libdvdcss-1.2.8-2.fr.i386.rpm \
libdvdread-0.9.4-4.fr.i386.rpm libmad-0.15.0b-3.fr.i386.rpm \ ogle-
0.9.2-1.1.fr.i386.rpm ogle_gui-0.9.2-1.1.fr.i386.rpm

However, each of the other package may have other dependencies, which is why repositories
are so helpful (see Lab 5.3, "Using Repositories").
Table 5-3 outlines the most common options used when installing or upgrading packages.

Table 5-3. rpm options for installing and upgrading

Option Description
--excludepath
directory
Excludes files located in directory.

--excludedocs
Excludes documentation files. This will save some space and may be
useful on a small system, particularly if another machine is available
with the documentation installed.

--force
Enables rpm to overwrite files that are part of other packages, reinstall
packages already installed, and downgrade instead of upgrade
packages.
-v
Verbose; lists each package as it is processed.
-h
Displays hash marks (#) to show the progress of each operation.
--justdb
Updates the RPM database, but doesn't actually install any software.

--nodeps Turns off checking for dependencies. Be careful using this option; the
installed package will usually be unusable.
--noscripts
Prevents installation scripts in the package from running.
--notriggers
Prevents trigger scripts in other packages from running.
--oldpackage
Permits a downgrade instead of an upgrade.
--relocate
olddir=newdir
Relocates files from one directory subtree to another. Useful if you
want your binary files, datafiles, or documentation installed into an
unusual location. Many Fedora packages are not relocatable.
--repackage (Applies to update/freshen only). Repackages the files from the old
version of the package so that the upgrade can be undone (rolled
Table 5-3. rpm options for installing and upgrading

Option Description
back). See Lab 5.4, "Rolling Back a Package Installation, Upgrade, or
Removal."
--test Checks for conflicts and potential problems, but does not make any
actual changes to the system.

This command installs httpd (Apache) without documentation, using a verbose display with
hash marks to show progress:
# rpm -ivh --excludedocs httpd-2.0.54-10.i386.rpm
Preparing... ###########################################
[100%]
1:httpd ###########################################
[100%]

If you later decide that you want the documentation files after all, you can't simply reinstall
httpd:
# rpm -ivh httpd-2.0.54-10.i386.rpm
Preparing... ###########################################
[100%]
package httpd-2.0.54-10 is already installed

But if you add the --force option, the reinstallation will be successful:
# rpm -ivh --force httpd-2.0.54-10.i386.rpm
Preparing... ###########################################
[100%]
1:httpd ###########################################
[100%]

The httpd package normally places the DocumentRoot (start of the HTML document tree) in
/var/www; to change this to /usr/share/html, use the --relocate option:
# rpm -ivh --force --relocate /var/www=/usr/share/html/ httpd-2.0.54-
10.i386.rpm
Preparing... ###########################################
[100%]
1:httpd ###########################################
[100%]

The change is recorded in the RPM database, so querying the database will show the actual,
installed paths:
# rpm -ql httpd
/etc/httpd
/etc/httpd/conf
/etc/httpd/conf.d
/etc/httpd/conf.d/README
/etc/httpd/conf.d/welcome.conf
...(Many lines snipped)...
/usr/share/html/icons/world1.png
/usr/share/html/icons/world2.gif
/usr/share/html/icons/world2.png

Relocating files does not change configuration files, scripts, or


programs that expect files to be located in particular locations. In the
httpd example just shown, the Apache configuration files
(/etc/httpd/conf/httpd.conf plus module-specific files in
/etc/httpd/conf.d/*) must be edited by hand to reflect the new document
root.

The options for erasing software are a subset of the options for installing and upgrading; the
most useful options are listed in Table 5-4.

Table 5-4. rpm package-removal (erase) options

Option Description
--
allmatches Erases all packages matching the name given (useful if more than one
version is installed).
--nodeps Proceeds with the package removal even if doing so will break some
dependencies for other packages.
--noscripts
Prevents removal scripts in the package from running.
--
notriggers Prevents trigger scripts in other packages from running.

--repackage
Repackages the files being removed so that the removal can be undone
(rolled back). See Lab 5.4, "Rolling Back a Package Installation, Upgrade, or
Removal."
--test Checks for conflicts and potential problems, but does not make any actual
changes to the system.

5.2.2. How Does It Work?


RPMs are named using the pattern:
name-version-packagerelease.arch.rpm

in which:

name
The name of the software in the package.

version
The software's version number.

packagerelease
The package version number; if one version of the software has been packaged a few
times (for example, with different file locations, scripts, triggers, or sample data), this
number is incremented while the software version number is left unchanged.

arch
The architecture for which the package is compiled (i386, x86-64, or PPC). For
packages that are not compiled (such as Perl, PHP, or bash scripts) or packages that
contain only data (such as a font set), noarch is used; for source packages, the
architecture is set to src.
rpm goes through many steps when performing an installation or upgrade/freshen:
1. The viability of the operation requested is analyzed. rpm tests the available disk
space, dependencies, installed packages, and package integrity to ensure that the
operation can be successfully completed. If not, the user is informed and rpm aborts
execution.
2. The RPM database is queried to see if any installation trigger scripts in other
packages are triggered by the installation, and if so, they are executed.
3. The preinstallation script in the package is executed.
4. The package files are installed. Required directories are created, relocations are
performed, and permissions and ownership are adjusted.
5. The postinstallation script in the package is executed.
6. If the operation being performed is not an upgrade or freshen, rpm exits because there
isn't an older version of the package to uninstall.
7. The RPM database is queried to see if any uninstallation trigger scripts in other
packages are triggered by the removal of the old package, and if so, they are executed.
8. The pre-uninstallation script in the package is executed.
9. If repackaging has been selected, the old package files and metadata are used to
construct an RPM, which is placed in /var/spool/repackage.
10. The obsolete files from the old package are deleted.
11. The post-uninstallation script in the package is executed.
12. The RPM database is queried to see if any post-uninstallation trigger scripts in other
packages are triggered by the removal of the old package, and if so, they are executed.
13. The RPM database is updated to reflect what was done during the transaction.
There are four opportunities for scripts to run. This permits configuration files to be backed
up before new packages are installed, services to be stopped before upgrading and restarted
after, and configuration data to be copied from the old to the new package. There are also
three opportunities for trigger scripts to run.
Each RPM operation is called a transaction. All of the packages processed in one operation
are called a transaction set; this may include a large number of packages. For example, an
update transaction could include dozens of packages processed at one time. In the RPM
database, a transaction set identifier (TID) is used to tie together all of the packages
processed in the same transaction set. The TID currently used is the time in seconds since the
start of the 1970s (called a utime).
5.2.3. What About...
5.2.3.1. ...installing multiple versions of a package?
It's possible, but it can create a lot of problems. The --force option is required, and it's
probably best to relocate the second installation to avoid file conflicts:
# rpm -q httpd
httpd-2.0.54-10.2
# rpm -i --force httpd-2.0.54-10.i386.rpm \ --relocate
/=/var/compare/httpd-old
# rpm -q httpd
httpd-2.0.54-10.2
httpd-2.0.54-10

This will install the old version of httpd into /var/compare/httpd-old so that you can compare
that installation with the current one.
To remove the packages, you'll either need to specify the full package name including the
software and package version numbers (e.g., httpd-2.0.54-10 instead of httpd) to delete one
specific version, or use the --allmatches option to remove all versions:
# rpm -e httpd
error: "httpd" specifies multiple packages
# rpm -e --allmatches httpd

5.2.4. Where Can I Learn More?


• Maximum RPM, Chapters 2, 3, and 4: http://www.rpm.org/max-rpm-snapshot/
(somewhat out of date, but useful)
• The manpage for rpm

SAVE
Digg

del.icio.us

Technorati

reddit
You are here: CodeIdol.com > Unix > Fedora Linux > Package Management > Installing
And Removing Software Using RPM

С 2009 года мы стали переводить структура сайта на различные языки. Сайт теперь будет содержать книги
не только на английском языке, но также и на других европейских языках, в том числе и на Русском языке.

Русский Polski Francais Deutsch


support sitemap terms

© CodeIdol Labs, 2007 - 2009

You might also like