Difference between revisions of "Package managers"

From OpenVZ Virtuozzo Containers Wiki
Jump to: navigation, search
(add Commands: section header)
(Commands: formatting headers)
Line 8: Line 8:
 
! Ebuild<br/><small>Gentoo, Sabayon</small>
 
! Ebuild<br/><small>Gentoo, Sabayon</small>
 
|-
 
|-
| colspan="4" align="center" | '''Basic queries'''
+
! colspan="4" align="center" | <big>'''Basic queries'''</big>
 
|-
 
|-
 
! List of all installed packages
 
! List of all installed packages
Line 30: Line 30:
 
|| <code>equery files ''package''</code>
 
|| <code>equery files ''package''</code>
 
|-
 
|-
| colspan="4" align="center" | '''Advanced queries'''
+
! colspan="4" align="center" | <big>'''Advanced queries'''</big>
 
|-
 
|-
 
! Which package a ''file'' belongs to?
 
! Which package a ''file'' belongs to?
Line 52: Line 52:
 
|| <code>-???-</code>
 
|| <code>-???-</code>
 
|-
 
|-
| colspan="4" align="center" | '''Local package installation/upgrade/removal'''
+
! colspan="4" align="center" | <big>'''Local package installation/upgrade/removal'''</big>
 
|-
 
|-
 
! Install a package from local ''package_file''
 
! Install a package from local ''package_file''
Line 71: Line 71:
 
<code>emerge --prune ''package''</code>
 
<code>emerge --prune ''package''</code>
 
|-
 
|-
| colspan="4" align="center" | '''Package installation from repositories'''
+
! colspan="4" align="center" | <big>'''Package installation from repositories'''</big>
 
|-
 
|-
 
! Install a ''package''
 
! Install a ''package''
Line 85: Line 85:
 
|| <code>emerge -avf ''package''</code><ref name="distfiles">Package sources will reside in /usr/portage/distfiles.</ref>
 
|| <code>emerge -avf ''package''</code><ref name="distfiles">Package sources will reside in /usr/portage/distfiles.</ref>
 
|-
 
|-
| colspan="4" align="center" | '''Get information about package interdependencies'''
+
! colspan="4" align="center" | <big>'''Get information about package interdependencies'''</big>
 
|-
 
|-
 
! What a given ''package'' provides?
 
! What a given ''package'' provides?
Line 107: Line 107:
 
|| <code>-???-</code>
 
|| <code>-???-</code>
 
|-
 
|-
| colspan="4" align="center" | '''Working with package files'''
+
! colspan="4" align="center" | <big>'''Working with package files'''</big>
 
|-
 
|-
 
! Unpack a package ''file'' to local directory
 
! Unpack a package ''file'' to local directory
Line 119: Line 119:
 
|| N/A
 
|| N/A
 
|-
 
|-
| colspan="4" align="center" | '''Repository queries'''
+
! colspan="4" align="center" | <big>'''Repository queries'''</big>
 
|-
 
|-
 
! Find a package which <code>/some/file</code> belongs to
 
! Find a package which <code>/some/file</code> belongs to

Revision as of 07:52, 21 July 2008

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.

Commands

Action RPM
RHEL, Fedora, CentOS, Mandrake, SUSE, ...
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 less /var/lib/dpkg/info/package.{pre,post,config}* -???-
Show change log for a package rpm -q --changelog package zcat /usr/share/doc/package/changelog.Debian.gz -???-
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

Package installation from repositories
Install a package yum install package

urpmi package

apt-get install package

aptitude install package

emerge -av package
Only download a package from repository, do not install -???- apt-get install --download-only --reinstall package[3] emerge -avf package[4]
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 --requires package dpkg-query -W -f='${Depends}\n' package -???-
Which installed package(s) provide a given dependency[5]? rpm -q --whatprovides dependency -???- -???-
Which installed package(s) require a given dependency[5]? rpm -q --whatrequires dependency -???- -???-
Working with package files
Unpack a package file to local directory rpm2cpio file.rpm | cpio -id dpkg -x file.deb . N/A
Check package file integrity (checksums, signatures...) rpm -K file.rpm -???- N/A
Repository queries
Find a package which /some/file belongs to yum provides /some/file apt-file search /some/file N/A

Relevant directories and files

Red Hat, Fedora, CentOS

  • yum config: /etc/yum.conf.
  • yum repos: /etc/yum.repos.d/.
  • rpm configs and macros: /etc/rpm/, /usr/lib/rpm/,
  • rpm DB: /var/lib/rpm/

Debian/Ubuntu

  • List of repositories and mirror sites: /etc/apt/sources.list, /etc/apt/sources.list.d/.

Gentoo

  • emerge configs: /etc/make.conf, /etc/portage/.
  • Portage tree: /usr/portage.

Notes

  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. Package will reside in /var/cache/apt/archives.
  4. Package sources will reside in /usr/portage/distfiles.
  5. 5.0 5.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.

See also

Debian