Difference between revisions of "Package managers"
m (correct word form) |
(→Commands) |
||
Line 23: | Line 23: | ||
|| <code>rpm -qi ''package''</code> | || <code>rpm -qi ''package''</code> | ||
|| <code>dpkg -p ''package''</code> | || <code>dpkg -p ''package''</code> | ||
− | || <code> | + | || <code>eix ''package''</code> |
|- | |- | ||
! List of files in a given ''package'' | ! List of files in a given ''package'' | ||
Line 45: | Line 45: | ||
|| <code>rpm -q --scripts ''package''</code> | || <code>rpm -q --scripts ''package''</code> | ||
|| <code>less /var/lib/dpkg/info/''package''.{pre,post,config}*</code> | || <code>less /var/lib/dpkg/info/''package''.{pre,post,config}*</code> | ||
− | || <code> | + | || <code>cat `equery which ''package''`</code> |
|- | |- | ||
! Show change log for a ''package'' | ! Show change log for a ''package'' | ||
Line 57: | Line 57: | ||
|| <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>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 it's dependencies</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 it's dependencies</ref></code> | ||
− | || <code> | + | || <code>N/A</code> |
|- | |- | ||
! Upgrade a package from local ''package_file'' | ! Upgrade a package from local ''package_file'' | ||
|| <code>rpm -Uhv ''package_file*.rpm''</code> | || <code>rpm -Uhv ''package_file*.rpm''</code> | ||
|| <code>dpkg -i ''package_file*.deb'' <ref name="apt"/></code> | || <code>dpkg -i ''package_file*.deb'' <ref name="apt"/></code> | ||
− | || <code> | + | || <code>N/A</code> |
|- | |- | ||
! Remove an installed ''package'' | ! Remove an installed ''package'' |
Revision as of 02:02, 26 December 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.
Contents
Commands
Action | RPM RHEL, Fedora, CentOS, Mandriva, SUSE, ... |
DEB Debian, Ubuntu |
Ebuild Gentoo, Sabayon |
---|---|---|---|
Basic queries | |||
List of all installed packages | rpm -qa
|
dpkg -l
|
equery list
|
List of installed packages matching substr | rpm -qa \*substr\*
|
dpkg -l \*substr\*
|
equery list substr
|
Basic information about an installed package | rpm -qi package
|
dpkg -p package
|
eix 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}*
|
cat `equery which package`
|
Show change log for a package | rpm -q --changelog package
|
zcat /usr/share/doc/package/changelog.Debian.gz aptitude [-t release] changelog package
|
-???-
|
Local package installation/upgrade/removal | |||
Install a package from local package_file | rpm -ihv package_file*.rpm
|
dpkg -i package_file*.deb [2]
|
N/A
|
Upgrade a package from local package_file | rpm -Uhv package_file*.rpm
|
dpkg -i package_file*.deb [2]
|
N/A
|
Remove an installed package | rpm -e package
|
dpkg -r package
|
emerge --unmerge package
|
Package installation from repositories | |||
Install a package | yum install package
|
apt-get update && apt-get install package
|
emerge -av package
|
Only download a package from repository, do not install | First install the yum-downloadonly plugin by running: yum install yum-downloadonly And then: yum install|update package -y --downloadonly --downloaddir=/opt
|
apt-get install --download-only --reinstall package [4]aptitude download package
|
emerge -avf package [5]
|
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[6]? | rpm -q --whatprovides dependency
|
dpkg-query -W -f='${Package}: ${Provides}\n' '*' | grep ': .*package'
|
-???-
|
Which installed package(s) require a given dependency[6]? | rpm -q --whatrequires dependency
|
dpkg-query -W -f='${Package}: ${Depends}\n' '*' | grep ': .*package' aptitude why package [7]
|
-???-
|
Show what prevents installation of a package | -???-
|
aptitude why-not package
|
-???-
|
Get package source files | -???-
|
apt-get source package
|
-???-
|
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
|
First run: apt-file update and then: 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
- ↑ In case there are unsatisfied dependencies for package_file, yum will try to get and install it from known repositores.
- ↑ 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
- ↑ This will also remove any packages which depend on the package
- ↑ Package will reside in /var/cache/apt/archives.
- ↑ Package sources will reside in /usr/portage/distfiles.
- ↑ 6.0 6.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. - ↑ Actualy shows the whole dpendency situation that leads to install this package