Saturday, 21 April 2012

Rpm Package Management Quick Reference


An updated version of this article at: RPM Package Management Quick Reference

RPM tool


rpm tool deals with rpm packages directly, but cannot deal with packages placed in a repository. Zypper, Yum,... tools deal with repositories.


$rpm -q package_name #e.g rpm -q subversion Query if a package is installed.

$rpm -qf "*/bash" #find which package owns that file.

#rpm -e package_name #deletes a package.

$rpm -qi package_name # shows info about a package.

$rpm -ql package_name # list files contained in package_name


#rpm -i package.rpm # installs a rpm file package.

#rpm -i --force package.rpm # forces package.rpm installation.

#rpm -qpl foo.rpm # shows the files in foo.rpm file package.

$rpm -q --scripts foo # shows installation and uninstallation scripts for foo package.

$rpm -qR foo # shows which dependencies foo package requires.



ZYPPER (OpenSuse 10.3 and up)


#zypper install foo # installs foo package from repository.

#zypper remove foo # removes a package. e.g: zypper remove python-twisted-conch

$zypper info python-twisted-conch # shows package info

$zypper search python # searchs for packages matching python.

#zipper ref && zipper dup # refresh repositories and then update the system.


YUM (Fedora, etc)


#yum install foo # installs foo package from repository.

#yum erase foo # deletes foo package.


$yum search foo # searchs for packages containing foo pattern in its name or description.

$yum provides "*/rpmbuild" # searchs for packages containing files matching the pattern.

#yum info foo # shows info about foo package.


#yum localinstall foo.rpm # installs foo.rpm package and searchs for dependencies in repositories.

#yum update foo # updates foo package.

#yum update # updates all the system.


MANDRAKE


#urpmi foo # installs foo package or search package that match foo pattern.

#urpme foo # erases foo package.

$urpmf foo # searchs for rpm packages which contain files matching foo pattern.

#urpme --auto-orphans # removes orphan packages.



RPMBUILD


#rpm -ivv python-tz-2006p-1.1.src.rpm # first we install a rpm source file.

#rpmbuild -ba /usr/src/packages/SPECS/python-tz.spec # we build the binary package.

NOTE: in Fedora based systems spec files are placed in /usr/src/redhat/SPECS

1 comentarios:

Macarons Recipes said...

Hi nice reading yourr post