Difference between revisions of "Package managers"

From OpenVZ Virtuozzo Containers Wiki
Jump to: navigation, search
(add dpkg -P)
(added some more advanced queries)
Line 28: Line 28:
 
|| <code>dpkg -L ''package''</code>
 
|| <code>dpkg -L ''package''</code>
 
|| <code>equery files ''package''</code>
 
|| <code>equery files ''package''</code>
 +
|-
 +
| colspan="4" align="center" | '''Advanced queries'''
 
|-
 
|-
 
! Which package a ''file'' belongs to?
 
! Which package a ''file'' belongs to?
Line 38: Line 40:
 
|| <code>debsums -ca ''package''</code>
 
|| <code>debsums -ca ''package''</code>
 
|| <code>equery check ''package''</code>
 
|| <code>equery check ''package''</code>
 +
|-
 +
! Show pre/post install/uninstall scripts from a ''package''
 +
|| <code>rpm -q --scripts ''package''</code>
 +
|| <code>-???-</code>
 +
|| <code>-???-</code>
 +
|-
 +
! Show change log for a ''package''
 +
|| <code>rpm -q --changelog ''package''</code>
 +
|| <code>-???-</code>
 +
|| <code>-???-</code>
 
|-
 
|-
 
| colspan="4" align="center" | '''Local package installation/upgrade/removal'''
 
| colspan="4" align="center" | '''Local package installation/upgrade/removal'''

Revision as of 17:19, 12 December 2007

With OpenVZ, you can run many different Linux distributions on a single box. One particular thing in which distributions differ is package management. This article summarizes how to perform various common package management tasks on a different distributions.

Action RPM
RHEL, Fedora, CentOS, Mandrake, ...
DEB
Debian, Ubuntu
Ebuild
Gentoo, Sabayon
Basic queries
List of all installed packages rpm -qa dpkg -l equery list
List of installing packages matching substr rpm -qa \*substr\* dpkg -l \*substr\* equery list substr
Basic information about an installed package rpm -qi package dpkg -p package -???-
List of files in a given package rpm -ql package dpkg -L package equery files package
Advanced queries
Which package a file belongs to? rpm -qf file dpkg -S file equery belongs file
Check the hash (i.e. MD5 etc.) sums of an installed package rpm -V package debsums -ca package equery check package
Show pre/post install/uninstall scripts from a package rpm -q --scripts package -???- -???-
Show change log for a package rpm -q --changelog package -???- -???-
Local package installation/upgrade/removal
Install a package from local package_file rpm -ihv package_file*.rpm
yum localinstall package_file*.rpm[1]
dpkg -i package_file*.deb [2] -???-
Upgrade a package from local package_file rpm -Uhv package_file*.rpm dpkg -i package_file*.deb [2] -???-
Remove an installed package rpm -e package dpkg -r package

dpkg -P package

emerge --unmerge package

emerge --prune package

Get information about package interdependencies
What a given package provides? rpm -q --provides package dpkg-query -W -f='${Provides}\n' package -???-
What a given package requires? rpm -q --provides package dpkg-query -W -f='${Depends}\n' package -???-
What package(s) provide a given dependency[3]? rpm -q --whatprovides dependency -???- -???-
What package(s) require a given dependency[3]? rpm -q --whatrequires dependency -???- -???-
  1. In case there are unsatisfied dependencies for package_file, yum will try to get and install it from known repositores.
  2. 2.0 2.1 Usually it is not necessary to download packages manually and install them. Use apt-cache search name to search for package in configured repositories and apt-get install package to install package and all it's dependencies
  3. 3.0 3.1 In rpm world, a dependency can be a package name, a file, or a special atom like perl(IO::Zlib) for a perl module. In deb world, this can be either real or virtual package name.