Changes
typo fix
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.
{| class="wikitable"
! align="center" | Action
! RPM<br/><small>RHEL, Fedora, CentOS, MandrakeMandriva, SUSE, ...</small>! DEB<br/><small>Debian, Knoppix, Ubuntu, ...</small>! Ebuild<br/><small>Gentooand derivatives (Sabayon, SabayonUtuto, ...)</small>! Pacman<br/><small>Arch Linux</small>
|-
|-
! List of all installed packages
|| <code>rpm -qa</code>
|| <code>dpkg -l</code>
|| <code>equery list'*'</code>|| <code>pacman -Q</code>
|-
! List of installing installed packages matching ''substr''
|| <code>rpm -qa ''\*substr\*''</code>
|| <code>dpkg -l ''\*substr\*''</code>
|| <code>equery list ''substr''</code>
|| <code>pacman -Q | grep ''substr''</code>
|-
! Basic information about an installed ''package''
|| <code>rpm -qi ''package''</code>
|| <code>dpkg -p s ''package''</code>|| <code>eix ''package''</code>|| <code>pacman -???-Qi ''package''</code>
|-
! List of files in a given ''package''
|| <code>dpkg -L ''package''</code>
|| <code>equery files ''package''</code>
|| <code>pacman -Ql ''package''</code>
|-
! colspan="5" align="center" | <big>'''Advanced queries'''</big>
|-
! Which package a ''file'' belongs to?
|| <code>dpkg -S ''file''</code>
|| <code>equery belongs ''file''</code>
|| <code>pacman -Qo ''file''</code>
|-
! Check the hash (i.e. MD5 etc.) sums of an installed package| | <code>rpm -V ''package''</code>|| <code>debsums -ca ''package''</code>|| <code>equery check ''package''</code>|||-! Show pre/post install/uninstall scripts from a ''package''|| <code>rpm -q --scripts ''package''</code>|| <code>less /var/lib/dpkg/info/''package''.{pre,post,config}*</code>|| <code>cat `equery which ''package''`</code>|||-! Show change log for a ''package''|| <code>rpm -q --changelog ''package''</code>|| <code>zcat /usr/share/doc/''package''/changelog.Debian.gz</code><br/><code>aptitude [-t release] changelog ''package''</code>|| <code>view /usr/portage/''category''/''package''/ChangeLog</code>|| <code>pacman -Qc ''package''</code>|-! colspan="45" align="center" | <big>'''Package Local package installation/upgrade/removal'''</big>
|-
! Install a package from local ''package_file''
|| <code>rpm -ihv ''package_file*.rpm''<br/>yum localinstall ''package_file*.rpm''<ref name="localinstall">In case there are unsatisfied dependencies for ''package_file'', yum will try to get and install it from known repositores.</ref></code>|| <code>dpkg -i ''package_file*.deb'' <ref name="apt">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 its dependencies</ref></code>|| <code>emerge -???-usepkg|-k ''package''<ref name="emerge-usepkg">Use a binary package if it is available from $PKGDIR, otherwise emerge from source as usual.</ref></code><br/><code>emerge --usepkgonly|-K ''package''<ref name="emerge-usepkgonly">Use a binary package if it is available from $PKGDIR, otherwise abort.</ref></code>|| <code>pacman -U ''package''</code>
|-
! Upgrade a package from local ''package_file''
|| <code>rpm -Uhv ''package_file*.rpm''</code>
|| <code>dpkg -i ''package_file*.deb'' <ref name="apt"/></code>|| <code>emerge --update --usepkg|-k ''package''<ref name="emerge-usepkg"/></code><br/><code>emerge --update -???-usepkgonly|-K ''package''<ref name="emerge-usepkgonly"/></code>|| <code>pacman -???-U ''package''</code>
|-
! Remove an installed ''package''
|| <code>rpm -e ''package''</code><br/><code>yum remove|erase ''package''<ref name="yum-remove">This will also remove any packages which depend on the ''package''</ref></code>|| <code>dpkg -???r ''package''</code><br/><code>dpkg -P ''package''</code>
|| <code>emerge --unmerge ''package''</code><br/>
<code>emerge --prune ''package''</code>
|| <code>pacman -R ''package''</code>|-! colspan="5" align="center" | <big>'''Package installation from repositories'''</big>|-! Install a ''package''|| <code>yum install ''package''</code><br/><code>urpmi ''package''</code>|| <code>apt-get update && apt-get install ''package''</code><br/><code>aptitude update && aptitude install ''package''</code>|| <code>emerge -av ''package''</code>|| <code>pacman -S ''package''</code>|-! Install a debug information files for a ''package''|| <code>debuginfo-install ''package''</code>|| || <code>FEATURES="splitdebug installsources" emerge -av ''package''</code>|||-! Only download a ''package'' from repository, do not install|| First install the yum-downloadonly plugin by running: <br/><code>yum install yum-downloadonly</code><br/> And then: <br/> <code>yum install|update ''package'' -y --downloadonly --downloaddir=/opt</code>|| <code>apt-get install --download-only --reinstall ''package''</code><ref name="dpkgdir">Package will reside in /var/cache/apt/archives.</ref><br/><code>aptitude download ''package''</code>|| <code>emerge -avf ''package''</code><ref name="distfiles">Package sources will reside in /usr/portage/distfiles.</ref>|| <code>pacman -Sw ''package''</code>|-! colspan="5" align="center" | <big>'''Get information about package interdependencies'''</big>|-! What a given ''package'' provides?|| <code>rpm -q --provides ''package''</code>|| <code>dpkg-query -W -f='${Provides}\n' ''package''</code>|| <code>equery files ''package'' (package must be installed first)</code>|| <code>pacman -Ql ''package'' (package must be installed first)</code>|-! What a given ''package'' requires?|| <code>rpm -q --requires ''package''</code>|| <code>dpkg-query -W -f='${Depends}\n' ''package''</code>|| <code>equery depgraph --depth=1 ''package''</code>|| <code>pacman -Si ''package''</code>|-! Which installed package(s) provide a given ''dependency''<ref name="dep">In rpm world, a ''dependency'' can be a package name, a file, or a special atom like <code>perl(IO::Zlib)</code> for a perl module. In deb world, this can be either real or virtual package name.</ref>?|| <code>rpm -q --whatprovides ''dependency''</code>|| <code>dpkg-query -W -f='${Package}: ${Provides}\n' '*' | grep ': .*''dependency''<nowiki>'</nowiki></code>|| <code>equery belongs ''dependency''</code>|||-! Which installed package(s) require a given ''dependency''<ref name="dep"/>?|| <code>rpm -q --whatrequires ''dependency''</code>|| <code>dpkg-query -W -f='${Package}: ${Depends}\n' '*' | grep ': .*''package''<nowiki>'</nowiki></code><br><code>aptitude why ''package''</code><ref name="why">Actualy shows the whole dpendency situation that leads to install this package</ref>|| <code>equery depends ''package''</code>|| <code>pacman -Qi ''package'' | grep Required</code>|||-! Show what prevents installation of a package|| <code>(yum/rpm tells with --verbose option -v)</code>|| <code>aptitude why-not ''package''</code>|| <code>emerge -pv ''package''</code>|||-! Get package source files|| <code>yumdownloader --source ''package''</code>|| <code>apt-get source ''package''</code>|| <code>emerge -f ''package''</code>|| <code>abs ''repository''/''package''</code>|-! colspan="5" align="center" | <big>'''Working with package files'''</big>|-! Unpack a package ''file'' to local directory|| <code>rpm2cpio ''file.rpm'' | cpio -id</code>|| <code>dpkg -x / --extract ''file.deb'' .</code>|| N/A|| <code>tar -xzf ''package''</code> if ''package''.pkg.tar.gz or<br/><code>tar -xJf ''package''</code> if ''package''.pkg.tar.xz|-! Check package file integrity (checksums, signatures...)|| <code>rpm -K ''file.rpm''</code><br/>(yum/rpm also checks GPG-signature and checksums automatically every time the package is installed or upgraded)|| <code>debsums ''package''</code>|| <code>emerge -f ''package''</code>|||-! Show package metadata|| <code>rpm -qip ''file.rpm''</code>|| <code>dpkg -I / --info ''file.deb''</code>|| N/A|| ??|-! Show package file list|| <code>rpm -qlvp ''file.rpm''</code>|| <code>dpkg -c / --contents ''file.deb''</code>|| N/A|| ??|-! colspan="5" align="center" | <big>'''Repository queries'''</big>|-! Find a package in a repository which <code>/some/file</code> belongs to|| <code>yum provides ''/some/file''</code>|| First run: <br/><code>apt-file update</code><br/>and then:<br/><code>apt-file search ''/some/file''</code>|| N/A|||-! Find a package based on some string or part of the string describing it|| <code>yum search ''\*substr\*''</code>|| <code>apt-cache search ''\*substr\*''</code>|| <code>eix -S ''substr''</code>|| <code>pacman -Ss ''substr''</code>|-! Shows the full description of ''package''|| <code>yum info ''package''</code>|| <code>apt-cache show ''package''</code>|| <code>eix ''package''</code>|| <code>pacman -Si ''package''</code>|} == Relevant directories and files == === Red Hat, Fedora, CentOS === * yum config: <code>/etc/yum.conf</code>.* yum repos: <code>/etc/yum.repos.d/</code>.* rpm configs and macros: <code>/etc/rpm/</code>, <code>/usr/lib/rpm/</code>, * rpm DB: <code>/var/lib/rpm/</code> === Debian/Ubuntu === * List of repositories and mirror sites: <code>/etc/apt/sources.list</code>, <code>/etc/apt/sources.list.d/</code>. === Gentoo === * emerge configs: <code>/etc/make.conf</code>, <code>/etc/portage/</code>.* Portage tree: <code>/usr/portage</code>.* Binary packages (FEATURES="buildpkg" enabled in make.conf): <code>/usr/portage/packages</code>.* Default directory to download sources to: <code>/usr/portage/distfiles</code>.* Default Portage working directory: <code>/var/lib/portage/</code>. == Notes==<references/> == See also ===== Debian ===* [http://www.debian.org/doc/FAQ/ch-pkgtools.en.html Debian FAQ: package management tools]* [http://www.debian.org/doc/manuals/apt-howto/ APT HOWTO] [[Category: HOWTO]][[Category: Templates]][[Category: Debian]][[Category: Ubuntu]][[Category: Gentoo]]