Difference between revisions of "RPM Commands"

From Free Knowledge Base- The DUCK Project: information for everyone
Jump to: navigation, search
m (WHAT PROVIDES?)
m
Line 57: Line 57:
 
The following is an example of using --whatprovides
 
The following is an example of using --whatprovides
  
  rpm -q --whatprovides XFree86-libs
+
rpm -q --whatprovides XFree86-libs
  
 
 
 
 
Line 77: Line 77:
  
 
:find the dovecot init script in dovecot-0.99.14-1.1.el3.rf.i386.rpm)
 
:find the dovecot init script in dovecot-0.99.14-1.1.el3.rf.i386.rpm)
  rpm -qpl dovecot-0.99.14-1.1.el3.rf.i386.rpm  |grep init
+
rpm -qpl dovecot-0.99.14-1.1.el3.rf.i386.rpm  |grep init
 
(looks like the path is /etc/rc.d/init.d/dovecot)
 
(looks like the path is /etc/rc.d/init.d/dovecot)
  rpm2cpio dovecot-0.99.14-1.1.el3.rf.i386.rpm | cpio -ivd ./etc/rc.d/init.d/dovecot
+
rpm2cpio dovecot-0.99.14-1.1.el3.rf.i386.rpm | cpio -ivd ./etc/rc.d/init.d/dovecot
 
(created a ./etc/.... inside of the directory I am in: relative to pwd)
 
(created a ./etc/.... inside of the directory I am in: relative to pwd)
  
Line 89: Line 89:
  
 
If you want to remove a list of RPMs without typing each on separately, you can use the xargs command with rpm.
 
If you want to remove a list of RPMs without typing each on separately, you can use the xargs command with rpm.
  rpm -qa | grep xine
+
rpm -qa | grep xine
  
 
 
 
 

Revision as of 20:32, 31 May 2007

REDHAT _ _ _ _ _ _ _ _ _ _ _

 _     ___ _   _ _   ___  __
| |   |_ _| \ | | | | \ \/ /
| |    | ||  \| | | | |\  / 
| |___ | || |\  | |_| |/  \ 
|_____|___|_| \_|\___//_/\_\ 

RPM COMMANDS
..............................................................................

RPM is an acronym for Red Hat Package Manger. It was developed by Redhat and is now being used by many Linux distributions.

QUICK COMMAND REFERENCE

Get a list of all RPM packages installed on system:

rpm -qa

Looking for a specific package or group of packages? Use grep:

rpm -qa|grep up2date

Remove an unwanted rpm package from the system:

rpm -e up2date-gnome-2.8.39-1.7.2

Forcing removal can be done by saying "don't do dependency check"

rpm -e --nodeps packagename

What's necessary or required for this package:

rpm -qR vim-minimal-6.1-18.8x.1.i386.rpm

Install a package:

rpm -i vim-minimal-6.1-18.8x.1.i386.rpm

Install with status and information:

rpm -ihvv --percent vim-minimal-6.1-18.8x.1.i386.rpm

List files in rpm package when the rpm has not been installed

rpm -qpl vim-minimal-6.1-18.8x.1.i386.rpm

Rebuild RPM database:

(solves "rpmdb: unable to join the environment" problem)
rpm --rebuilddb

Upgrade/Freshen

Using the freshen option is the same as upgrade except the package will only be upgraded if a previous version is installed. Upgrade will install the package even if a previous version does not exist.
rpm -F packagename.rpm
rpm -U packagename.rpm

 

WHAT PROVIDES?

When attempting to install an RPM and the install fails due to a missing dependency, one as to figure out which RPM is needed to supply the dependency (such as a file, library, or capability) in order to obtain it, install it, and then go back and try to install the original RPM file that first complained about the missing dependency.

The --whatprovides switch sounds promising, however, it only searches though the RPM files already on your system. Since the dependency is not fulfilled, then the RPM is not yet on the system, and therefore the switch seems rather stupid IMHO.

The following is an example of using --whatprovides

rpm -q --whatprovides XFree86-libs

 

RPM MANIPULATION

All of these apps will convert rpm files to tar.gz files.

rpm2targz, rpm2tgz, rpm2cpio, alien, etc.

Extract a single file from rpm package without installing entire package

First use rpm -qpl <packagename>|grep <filename> to determine the path to which the file will be installed. Now use rpm2cpio

rpm2cpio <packagename> | cpio -ivd ./path/<filename>

The period will create the path and place <filename> within that structure under whatever directory you are currently in.

example:

find the dovecot init script in dovecot-0.99.14-1.1.el3.rf.i386.rpm)
rpm -qpl dovecot-0.99.14-1.1.el3.rf.i386.rpm  |grep init

(looks like the path is /etc/rc.d/init.d/dovecot)

rpm2cpio dovecot-0.99.14-1.1.el3.rf.i386.rpm | cpio -ivd ./etc/rc.d/init.d/dovecot

(created a ./etc/.... inside of the directory I am in: relative to pwd)

rpm2cpio turns an RPM into a standard CPIO archive that you can extract certain files from with the cpio command.

rpm2cpio package | cpio -iv --make-directories full-path

You may also convert the rpm to a cpio archive

rpm2cpio package > cpio-archive-file

If you want to remove a list of RPMs without typing each on separately, you can use the xargs command with rpm.

rpm -qa | grep xine