enter your search terms

Upload: deepak-yadav

Post on 08-Apr-2018

216 views

Category:

Documents


0 download

TRANSCRIPT

  • 8/7/2019 Enter Your Search Terms

    1/8

    Top of Form

    Bottom of Form

    u are here:CodeIdol.com > Unix > Fedora Linux > Package Management >Installingd Removing Software Using RPM

    SAVE

    Digg

    del.icio.us

    Technorati

    reddit

    . Installing and Removing Software Using RPM

    addition to queries, rpm performs package installation, updating, and removal. As well asying files to the correct locations (or deleting them), rpm checks file integrity, setsmissions, backs up configuration files, and executes scripts within the affected package

    d other packages that have asked to be notified of changes (trigger scripts). These scriptsin turn start or stop services, modify configuration files, or perform other operations.

    1. How Do I Do That?

    m provides four options for installing, upgrading, and removing software:

    ackage_file

    Installs a package that is not currently installed.

    package_file

    Upgrades an existing package version, or installs the package if it is not currentlyinstalled.

    Related tags

    Popular Categories

    Unix books and guide

    AJAX popular informC# language guidesWindows books andcookbooks

    .......

    Submit search form

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

    http://codeidol.com/http://codeidol.com/unix/http://codeidol.com/unix/fedora/http://codeidol.com/unix/fedora/Package-Management/http://codeidol.com/unix/fedora/Package-Management/Installing-and-Removing-Software-Using-RPM/http://codeidol.com/unix/fedora/Package-Management/Installing-and-Removing-Software-Using-RPM/http://codeidol.com/unix/fedora/Package-Management/Installing-and-Removing-Software-Using-RPM/http://digg.com/submit?phase=2&url=http://codeidol.com/unix/fedora/Package-Management/Installing-and-Removing-Software-Using-RPM/&title=CodeIdol+-+Thinking+about+Fedora+Linux+-+Package+Management+-+Installing+And+Removing+Software+Using+RPM&bodytext=%22Neither+a+%22Starting+Linux%22+book+nor+a+dry+reference+manual,+this+book+has+a+lot+to+offer+to+those+coming+to+Fedora+from+other+operating+systems+or+distros.%22+--+Behdad+Esfahbod,+Fedora+developer%0D%20%20%0D%20%20This+book+will+get+you+up+to+speed+quickly...&topic=programminghttp://digg.com/submit?phase=2&url=http://codeidol.com/unix/fedora/Package-Management/Installing-and-Removing-Software-Using-RPM/&title=CodeIdol+-+Thinking+about+Fedora+Linux+-+Package+Management+-+Installing+And+Removing+Software+Using+RPM&bodytext=%22Neither+a+%22Starting+Linux%22+book+nor+a+dry+reference+manual,+this+book+has+a+lot+to+offer+to+those+coming+to+Fedora+from+other+operating+systems+or+distros.%22+--+Behdad+Esfahbod,+Fedora+developer%0D%20%20%0D%20%20This+book+will+get+you+up+to+speed+quickly...&topic=programminghttp://del.icio.us/post?v=4&noui&jump=close&tag=codeidol%20free%20online%20books%20book&url=http://codeidol.com/unix/fedora/Package-Management/Installing-and-Removing-Software-Using-RPM/&title=CodeIdol+-+Thinking+about+Fedora+Linux+-+Package+Management+-+Installing+And+Removing+Software+Using+RPM&notes=%22Neither+a+%22Starting+Linux%22+book+nor+a+dry+reference+manual,+this+book+has+a+lot+to+offer+to+those+coming+to+Fedora+from+other+operating+systems+or+distros.%22+--+Behdad+Esfahbod,+Fedora+developer%0D%20%20%0D%20%20This+book+will+get+you+up+to+speed+quickly...&tags=codeidol%20free%20online%20books%20bookhttp://technorati.com/search/http://codeidol.com/unix/fedora/Package-Management/Installing-and-Removing-Software-Using-RPM/http://technorati.com/search/http://codeidol.com/unix/fedora/Package-Management/Installing-and-Removing-Software-Using-RPM/http://reddit.com/submit?url=http://codeidol.com/unix/fedora/Package-Management/Installing-and-Removing-Software-Using-RPM/&title=CodeIdol+-+Thinking+about+Fedora+Linux+-+Package+Management+-+Installing+And+Removing+Software+Using+RPMhttp://reddit.com/submit?url=http://codeidol.com/unix/fedora/Package-Management/Installing-and-Removing-Software-Using-RPM/&title=CodeIdol+-+Thinking+about+Fedora+Linux+-+Package+Management+-+Installing+And+Removing+Software+Using+RPMhttp://codeidol.com/unix/http://codeidol.com/ajax/http://codeidol.com/csharp/http://codeidol.com/windows/http://codeidol.com/http://codeidol.com/http://codeidol.com/unix/http://codeidol.com/unix/fedora/http://codeidol.com/unix/fedora/Package-Management/http://codeidol.com/unix/fedora/Package-Management/Installing-and-Removing-Software-Using-RPM/http://codeidol.com/unix/fedora/Package-Management/Installing-and-Removing-Software-Using-RPM/http://digg.com/submit?phase=2&url=http://codeidol.com/unix/fedora/Package-Management/Installing-and-Removing-Software-Using-RPM/&title=CodeIdol+-+Thinking+about+Fedora+Linux+-+Package+Management+-+Installing+And+Removing+Software+Using+RPM&bodytext=%22Neither+a+%22Starting+Linux%22+book+nor+a+dry+reference+manual,+this+book+has+a+lot+to+offer+to+those+coming+to+Fedora+from+other+operating+systems+or+distros.%22+--+Behdad+Esfahbod,+Fedora+developer%0D%20%20%0D%20%20This+book+will+get+you+up+to+speed+quickly...&topic=programminghttp://del.icio.us/post?v=4&noui&jump=close&tag=codeidol%20free%20online%20books%20book&url=http://codeidol.com/unix/fedora/Package-Management/Installing-and-Removing-Software-Using-RPM/&title=CodeIdol+-+Thinking+about+Fedora+Linux+-+Package+Management+-+Installing+And+Removing+Software+Using+RPM&notes=%22Neither+a+%22Starting+Linux%22+book+nor+a+dry+reference+manual,+this+book+has+a+lot+to+offer+to+those+coming+to+Fedora+from+other+operating+systems+or+distros.%22+--+Behdad+Esfahbod,+Fedora+developer%0D%20%20%0D%20%20This+book+will+get+you+up+to+speed+quickly...&tags=codeidol%20free%20online%20books%20bookhttp://technorati.com/search/http://codeidol.com/unix/fedora/Package-Management/Installing-and-Removing-Software-Using-RPM/http://reddit.com/submit?url=http://codeidol.com/unix/fedora/Package-Management/Installing-and-Removing-Software-Using-RPM/&title=CodeIdol+-+Thinking+about+Fedora+Linux+-+Package+Management+-+Installing+And+Removing+Software+Using+RPMhttp://codeidol.com/unix/http://codeidol.com/ajax/http://codeidol.com/csharp/http://codeidol.com/windows/http://codeidol.com/
  • 8/7/2019 Enter Your Search Terms

    2/8

    package_file

    Freshens an existing installation of the package by upgrading the version. If thepackage is not currently installed, it remains uninstalled.

    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).

    of these operations must be performed as the root user (unlike queries, which may beformed by anyone). This prevents unwanted software, such as viruses and worms, fromng installed in the normal course of activities.

    perform a basic installation of a package, use the -i option and supply the name of akage file:

    rpm -i httpd-2.0.54-10.i386.rpm

    upgrade the package:

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

    his case, the upgrade would succeed even ifhttpdpackage weren't already present on thetem; it would be installed.

    remove the package:

    rpm -e httpd

    te that in this case, only the package name is given, not a package filename.

    additional arguments are needed if the installation or removal does not affect any otherkages, but frequently a package to be installed will depend on other packages:

    rpm -i ogle-0.9.2-1.1.fr.i386.rpmror: Failed dependencies:

    libdvdread >= 0.9.4 is needed by ogle-0.9.2-1.1.fr.i386libdvdread.so.3 is needed by ogle-0.9.2-1.1.fr.i386libmad.so.0 is needed by ogle-0.9.2-1.1.fr.i386

    ewise, when removing a package, other packages can depend on that package:

    rpm -e httpdror: Failed dependencies:

    httpd-mmn = 20020903 is needed by (installed) mod_auth_kerb-5.0-

    386httpd-mmn = 20020903 is needed by (installed) mod_auth_mysql-2.6.1-

    386(Lines snipped)...

    httpd = 2.0.54-10.2 is needed by (installed) mod_ssl-2.0.54-2.i386

    httpd is needed by (installed) squirrelmail-1.4.6-cvs20050812.1.fc4.noarch

  • 8/7/2019 Enter Your Search Terms

    3/8

    e solution is to add or remove all of the needed packages at the same time ( \ indicates thatline is continued):

    rpm -i a52dec-0.7.4-4.fr.i386.rpm libdvdcss-1.2.8-2.fr.i386.rpm \bdvdread-0.9.4-4.fr.i386.rpm libmad-0.15.0b-3.fr.i386.rpm \ ogle-9.2-1.1.fr.i386.rpm ogle_gui-0.9.2-1.1.fr.i386.rpm

    wever, each of the other package may have other dependencies, which is why repositoriesso helpful (see Lab 5.3, "Using Repositories").

    ble 5-3outlines the most common options used when installing or upgrading packages.

    Table 5-3. rpm options for installing and upgrading

    Option Description

    xcludepathrectory

    Excludes files located in directory.

    xcludedocsExcludes documentation files. This will save some space and may beuseful on a small system, particularly if another machine is availablewith the documentation installed.

    forceEnables rpm to overwrite files that are part of other packages, reinstallpackages already installed, and downgrade instead of upgradepackages.

    Verbose; lists each package as it is processed.

    Displays hash marks (#) to show the progress of each operation.ustdb

    Updates the RPM database, but doesn't actually install any software.

    nodeps Turns off checking for dependencies. Be careful using this option; theinstalled package will usually be unusable.

    noscriptsPrevents installation scripts in the package from running.

    notriggersPrevents trigger scripts in other packages from running.

    ldpackage

    Permits a downgrade instead of an upgrade.

    relocateddir=newdir

    Relocates files from one directory subtree to another. Useful if youwant your binary files, datafiles, or documentation installed into anunusual location. Many Fedora packages are not relocatable.

    repackage (Applies to update/freshen only). Repackages the files from the oldversion of the package so that the upgrade can be undone (rolled

  • 8/7/2019 Enter Your Search Terms

    4/8

    Table 5-3. rpm options for installing and upgrading

    Option Description

    back). SeeLab 5.4, "Rolling Back a Package Installation, Upgrade, orRemoval."

    est Checks for conflicts and potential problems, but does not make anyactual changes to the system.

    s command installs httpd(Apache) without documentation, using a verbose display withh marks to show progress:

    rpm -ivh --excludedocshttpd-2.0.54-10.i386.rpmparing... ###########################################0%]1:httpd ###########################################0%]

    ou later decide that you want the documentation files after all, you can't simply reinstallpd:

    rpm -ivhhttpd-2.0.54-10.i386.rpmparing... ###########################################0%]

    package httpd-2.0.54-10 is already installed

    t if you add the --force option, the reinstallation will be successful:

    rpm -ivh--force httpd-2.0.54-10.i386.rpmparing... ###########################################

    0%]1:httpd ###########################################0%]

    e httpdpackage normally places the DocumentRoot (start of the HTML document tree) inr/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-i386.rpmparing... ###########################################0%]1:httpd ###########################################0%]

    e change is recorded in the RPM database, so querying the database will show the actual,talled paths:

    rpm -ql httpd

    c/httpdc/httpd/confc/httpd/conf.dc/httpd/conf.d/READMEc/httpd/conf.d/welcome.conf

  • 8/7/2019 Enter Your Search Terms

    5/8

    (Many lines snipped)...r/share/html/icons/world1.pngr/share/html/icons/world2.gifr/share/html/icons/world2.png

    Relocating files does not change configuration files, scripts, orprograms that expect files to be located in particular locations. In thehttpdexample just shown, the Apache configuration files(/etc/httpd/conf/httpd.confplus module-specific files in/etc/httpd/conf.d/*) must be edited by hand to reflect the new documentroot.

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

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

    Option Description

    matches Erases all packages matching the name given (useful if more than oneversion is installed).

    nodeps Proceeds with the package removal even if doing so will break somedependencies for other packages.

    noscriptsPrevents removal scripts in the package from running.

    riggers Prevents trigger scripts in other packages from running.

    repackageRepackages the files being removed so that the removal can be undone(rolled back). See Lab 5.4, "Rolling Back a Package Installation, Upgrade, orRemoval."

    est Checks for conflicts and potential problems, but does not make any actualchanges to the system.

    2. How Does It Work?

    Ms are named using the pattern:

    name-version-packagerelease.arch.rpm

    which:

    me

  • 8/7/2019 Enter Your Search Terms

    6/8

    The name of the software in the package.

    rsion

    The software's version number.

    ckagerelease

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

    ch

    The architecture for which the package is compiled (i386,x86-64, orPPC). Forpackages 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, thearchitecture is set to src.

    m goes through many steps when performing an installation or upgrade/freshen:

    1. The viability of the operation requested is analyzed. rpm tests the available diskspace, dependencies, installed packages, and package integrity to ensure that theoperation can be successfully completed. If not, the user is informed and rpm abortsexecution.

    2. The RPM database is queried to see if any installation trigger scripts in otherpackages are triggered by the installation, and if so, they are executed.

    3. Thepreinstallation script in the package is executed.

    4. The package files are installed. Required directories are created, relocations areperformed, and permissions and ownership are adjusted.

    5. Thepostinstallation script in the package is executed.

    6. If the operation being performed is not an upgrade or freshen, rpm exits because thereisn't an older version of the package to uninstall.

    7. The RPM database is queried to see if any uninstallation trigger scripts in otherpackages are triggered by the removal of the old package, and if so, they are executed.

    8. Thepre-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.Thepost-uninstallation script in the package is executed.

    12.The RPM database is queried to see if anypost-uninstallation trigger scripts in otherpackages 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.

    ere are four opportunities for scripts to run. This permits configuration files to be backed

  • 8/7/2019 Enter Your Search Terms

    7/8

    before new packages are installed, services to be stopped before upgrading and restarteder, and configuration data to be copied from the old to the new package. There are alsoee opportunities for trigger scripts to run.

    ch RPM operation is called a transaction. All of the packages processed in one operationcalled a transaction set; this may include a large number of packages. For example, an

    date transaction could include dozens of packages processed at one time. In the RPMabase, a transaction set identifier(TID) is used to tie together all of the packagescessed in the same transaction set. The TID currently used is the time in seconds since thert of the 1970s (called a utime).

    3. What About...

    3.1. ...installing multiple versions of a package?

    possible, but it can create a lot of problems. The --force option is required, and it'sbably best to relocate the second installation to avoid file conflicts:

    rpm -qhttpdpd-2.0.54-10.2

    rpm -i --force httpd-2.0.54-10.i386.rpm \ --relocate/var/compare/httpd-oldrpm -qhttpdpd-2.0.54-10.2pd-2.0.54-10

    s will install the old version of httpd into/var/compare/httpd-oldso that you can comparet installation with the current one.

    remove the packages, you'll either need to specify the full package name including thetware and package version numbers (e.g., httpd-2.0.54-10 instead ofhttpd) to delete onecific version, or use the --allmatches option to remove all versions:

    rpm -e httpdror: "httpd" specifies multiple packagesrpm -e --allmatcheshttpd

    4. Where Can I Learn More?

    Maximum RPM, Chapters 2, 3, and4: http://www.rpm.org/max-rpm-snapshot/(somewhat out of date, but useful)

    The manpage forrpm

    SAVEDigg

    del.icio.us

    Technorati

    reddit

    http://www.rpm.org/max-rpm-snapshot/http://digg.com/submit?phase=2&url=http://codeidol.com/unix/fedora/Package-Management/Installing-and-Removing-Software-Using-RPM/&title=CodeIdol+-+Thinking+about+Fedora+Linux+-+Package+Management+-+Installing+And+Removing+Software+Using+RPM&bodytext=%22Neither+a+%22Starting+Linux%22+book+nor+a+dry+reference+manual,+this+book+has+a+lot+to+offer+to+those+coming+to+Fedora+from+other+operating+systems+or+distros.%22+--+Behdad+Esfahbod,+Fedora+developer%0D%20%20%0D%20%20This+book+will+get+you+up+to+speed+quickly...&topic=programminghttp://digg.com/submit?phase=2&url=http://codeidol.com/unix/fedora/Package-Management/Installing-and-Removing-Software-Using-RPM/&title=CodeIdol+-+Thinking+about+Fedora+Linux+-+Package+Management+-+Installing+And+Removing+Software+Using+RPM&bodytext=%22Neither+a+%22Starting+Linux%22+book+nor+a+dry+reference+manual,+this+book+has+a+lot+to+offer+to+those+coming+to+Fedora+from+other+operating+systems+or+distros.%22+--+Behdad+Esfahbod,+Fedora+developer%0D%20%20%0D%20%20This+book+will+get+you+up+to+speed+quickly...&topic=programminghttp://del.icio.us/post?v=4&noui&jump=close&tag=codeidol%20free%20online%20books%20book&url=http://codeidol.com/unix/fedora/Package-Management/Installing-and-Removing-Software-Using-RPM/&title=CodeIdol+-+Thinking+about+Fedora+Linux+-+Package+Management+-+Installing+And+Removing+Software+Using+RPM&notes=%22Neither+a+%22Starting+Linux%22+book+nor+a+dry+reference+manual,+this+book+has+a+lot+to+offer+to+those+coming+to+Fedora+from+other+operating+systems+or+distros.%22+--+Behdad+Esfahbod,+Fedora+developer%0D%20%20%0D%20%20This+book+will+get+you+up+to+speed+quickly...&tags=codeidol%20free%20online%20books%20bookhttp://technorati.com/search/http://codeidol.com/unix/fedora/Package-Management/Installing-and-Removing-Software-Using-RPM/http://technorati.com/search/http://codeidol.com/unix/fedora/Package-Management/Installing-and-Removing-Software-Using-RPM/http://reddit.com/submit?url=http://codeidol.com/unix/fedora/Package-Management/Installing-and-Removing-Software-Using-RPM/&title=CodeIdol+-+Thinking+about+Fedora+Linux+-+Package+Management+-+Installing+And+Removing+Software+Using+RPMhttp://reddit.com/submit?url=http://codeidol.com/unix/fedora/Package-Management/Installing-and-Removing-Software-Using-RPM/&title=CodeIdol+-+Thinking+about+Fedora+Linux+-+Package+Management+-+Installing+And+Removing+Software+Using+RPMhttp://www.rpm.org/max-rpm-snapshot/http://digg.com/submit?phase=2&url=http://codeidol.com/unix/fedora/Package-Management/Installing-and-Removing-Software-Using-RPM/&title=CodeIdol+-+Thinking+about+Fedora+Linux+-+Package+Management+-+Installing+And+Removing+Software+Using+RPM&bodytext=%22Neither+a+%22Starting+Linux%22+book+nor+a+dry+reference+manual,+this+book+has+a+lot+to+offer+to+those+coming+to+Fedora+from+other+operating+systems+or+distros.%22+--+Behdad+Esfahbod,+Fedora+developer%0D%20%20%0D%20%20This+book+will+get+you+up+to+speed+quickly...&topic=programminghttp://del.icio.us/post?v=4&noui&jump=close&tag=codeidol%20free%20online%20books%20book&url=http://codeidol.com/unix/fedora/Package-Management/Installing-and-Removing-Software-Using-RPM/&title=CodeIdol+-+Thinking+about+Fedora+Linux+-+Package+Management+-+Installing+And+Removing+Software+Using+RPM&notes=%22Neither+a+%22Starting+Linux%22+book+nor+a+dry+reference+manual,+this+book+has+a+lot+to+offer+to+those+coming+to+Fedora+from+other+operating+systems+or+distros.%22+--+Behdad+Esfahbod,+Fedora+developer%0D%20%20%0D%20%20This+book+will+get+you+up+to+speed+quickly...&tags=codeidol%20free%20online%20books%20bookhttp://technorati.com/search/http://codeidol.com/unix/fedora/Package-Management/Installing-and-Removing-Software-Using-RPM/http://reddit.com/submit?url=http://codeidol.com/unix/fedora/Package-Management/Installing-and-Removing-Software-Using-RPM/&title=CodeIdol+-+Thinking+about+Fedora+Linux+-+Package+Management+-+Installing+And+Removing+Software+Using+RPM
  • 8/7/2019 Enter Your Search Terms

    8/8

    u are here:CodeIdol.com > Unix > Fedora Linux > Package Management >Installingd Removing Software Using RPM

    2009 . , ,

    Polski Francais Deutschsupport sitemap terms

    CodeIdol Labs, 2007 - 2009

    http://codeidol.com/http://codeidol.com/unix/http://codeidol.com/unix/fedora/http://codeidol.com/unix/fedora/Package-Management/http://codeidol.com/unix/fedora/Package-Management/Installing-and-Removing-Software-Using-RPM/http://codeidol.com/unix/fedora/Package-Management/Installing-and-Removing-Software-Using-RPM/http://codeidol.com/unix/fedora/Package-Management/Installing-and-Removing-Software-Using-RPM/http://codeidol.com/sys/rus/http://codeidol.com/sys/polska/http://codeidol.com/sys/french/http://codeidol.com/sys/german/http://codeidol.com/sys/support/http://codeidol.com/sys/sitemap/http://codeidol.com/sys/terms/http://codeidol.com/http://codeidol.com/unix/http://codeidol.com/unix/fedora/http://codeidol.com/unix/fedora/Package-Management/http://codeidol.com/unix/fedora/Package-Management/Installing-and-Removing-Software-Using-RPM/http://codeidol.com/unix/fedora/Package-Management/Installing-and-Removing-Software-Using-RPM/http://codeidol.com/sys/rus/http://codeidol.com/sys/polska/http://codeidol.com/sys/french/http://codeidol.com/sys/german/http://codeidol.com/sys/support/http://codeidol.com/sys/sitemap/http://codeidol.com/sys/terms/