Jump to content

Software Install with RPM

Recommended Posts

(based upon posts originally written by anyweb, kZo, Oroshi, grep420)


1. Overview


RedHat invented the RedHat Package Management system to ease installation and maintanence of software. Although you can still download raw source code and manually compile applications yourself, using a package management system like RPM provides a number of advantage:

  • no compiling: someone else has already done all the hard work of compiling, which saves you the hassle of getting a compiler and various libraries (Shared Objects)
  • package pre-requisites: the RPM package contains information about dependencies, so won't install if the pre-requisite files are missing or too old
  • package configuration: the RPM package usually contains some default/example config files - helps setting up the package from new
  • installation locations: paths in the RPM package conform to the standard Linux filesystem hierarchy (/usr/bin for binaries, /etc for config files, /var/log for logfiles, etc)
  • the RPM database: details of RPM-installed software are stored in an RPM database that can be interrogated to list all installed software, what files the package contains, etc.


2. Basic Commands


1. Listing installed packages: rpm -qa, for example:

 $ rpm -qa | more


2. Showing information about a package: rpm -qi packagename (note that the package name, and not version needed to be specified), for example:

 $ rpm -qi ethtool
Name		: ethtool					 Relocations: (not relocatable)
Version  : 3								 Vendor: Red Hat, Inc.
Release  : 1							 Build Date: Thu 03 Mar 2005 11:08:26 PM GMT
Install Date: Wed 19 May 2004 01:16:31 AM BST	 Build Host: tweety.build.redhat.com
Group	  : Applications/System		   Source RPM: ethtool-3-1.src.rpm
Size		: 134623						   License: GPL
Signature   : DSA/SHA1, Fri 20 May 2005 08:35:08 PM BST, Key ID b44269d04f2a6fd2
Packager	: Red Hat, Inc. <http://bugzilla.redhat.com/bugzilla>
URL	  : http://sourceforge.net/projects/gkernel/
Summary  : Ethernet settings tool for PCI ethernet cards
Description :
This utility allows querying and changing of ethernet card settings,
such as speed, port, auto-negotiation, and PCI locations.


3. Listing package contents: rpm -ql packagename (again, only name and not version number needs to be given), for example:

 $ rpm -ql bzip2


4. Listing which package a file belongs to: rpm -qf /path/to/file - in this case, the absolute path to a filename must be specified. I have used the which command to determine the path in this case:

 $ which nmap
$ rpm -qf /usr/bin/nmap


5. Listing contents of an uninstalled package: rpm -qlp /path/to/thisPackageHere.rpm - to see the contents of a package not yet installed, use the qlp options on the RPM file itself, eg:

 $ rpm -qlp openssl096b-0.9.6b-6.i386.rpm


6. Installing a package: rpm -ivh /path/to/thisPackage.rpm. i=install, v=verbose, h=hash signs to show progress, eg:

 # rpm -ivh Bastille-3.0.9-1.0.noarch.rpm
Preparing...				########################################### [100%]
  1:Bastille			   ########################################### [100%]

Note that root privileges or equivilent (such as sudo) are needed to install RPM packages.


7. Upgrading a package: similar to above but uses the -U option rather than -i, i.e.: rpm -Uvh /path/to/thisPackage.rpm.


8. Checking packages: rpm -V packagename. Should be silent if there are no problems.


9. Checking ALL packages: rpm -Va. Make take some time, so run this command at quiet times, but a good command to run on a regular basis for a sanity check.


10. Uninstalling package: rpm -e packagename (erase package). If other (installed) packages are dependent upon this package, RPM will refuse to erase it, citing dependency issues.


For more information, use man rpm.


3. Other Considerations


  • Upgrade over install: it is possible to "upgrade" a package that doesn't exist, so many people stick to using the -Uvh rather than -ivh options when installing.
  • erasing leaves detritus: uninstalling a package usually leaves behind data files (logs, etc) as well as config files, which may need to be manually cleared out. On the other hand, don't assume that erasing will leave behind modified config files - make a backup first if you wish to preserve them!
  • finding RPMs: there are many RPM download sites out there - try www.rpmfind.net for a good start, google for others. Some sites dedicated to the development of specific applications often have pre-build RPMs on their download pages for fast install - search around.
  • distro-specific RPMs: Some RPMs are suited to specific distros, for example those that end in .fc7.rpm are for Fedora7, those ending in .mdk.rpm are from Mandrake Cooker (for Mandrake/Mandriva).
  • "noarch" RPMs: some RPMs ending in .noarch.rpm are not distro-specific and can be installed on any Linux distro, kernel version permitting. Webmin is a good example.
  • SRPMs: some RPMs with src in the filename are the source code, not compiled binaries. Installing these will only extract and copy the source code to development areas, not provide you with the actual binaries or applications - ensure you get the right file!
  • dependency hell: occasionally an RPM will require some pre-requisite packages, which themselves require other pre-requisites... you'll need to search around for those, or use something like yum (described elsewhere).
  • module/library dependency: occasionally RPM will complain about dependency upon a missing package, but a quick rpm -qa shows it is there. Look at installing packagename-devel, which contains library functions not essential to the normal operation of the package but others that depend upon it. It won't affect your original package, but should satisfy the dependency requirements.
  • compiled packages: it is still possible to download and compile packages outside of RPM but since they won't be included in the RPM database, RPM won't know they exist - and may still complain about missing dependencies.

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...