RPM / dpkg / apt-get / yum reference , comparisons, and equivalents

 http://daverdave.com/rpm_dpkg.pdf    
 http://daverdave.com/rpm_dpkg.xlsx    
     
     
Debian Red Hat Description
dpkg -Gi package(s).deb rpm -Uvh packages(s).rpm install/upgrade package file(s)
dpkg -r package rpm -e package remove package
dpkg -l '*spell*' rpm -qa '*spell*' show all packages whose names contain the word spell
dpkg -l package rpm -q package show version of package installed
dpkg -s package rpm -q -i package show all package metadata
dpkg -I package.deb rpm -q -i -p package.rpm show all package file's metadata
dpkg -S /path/file rpm -q -f /path/file what package does file belong
dpkg -L package rpm -q -l package list where files were installed
dpkg -c package.deb rpm -q -l -p package.rpm list where files would be installed
dpkg -x package.deb rpm2cpio package.rpm | cpio -id extract package files to current directory
dpkg -s package | grep ^Depends: rpm -q --requires package list files/packages that package needs
dpkg --purge --dry-run package rpm -q --whatrequires package list packages that need package (see also whatrequires)

 

At a higher level, package dependencies can be automatically managed by yum and apt. With these tools one can essentially say "install this package" for e.g. and all dependent packages will be installed/upgraded as appropriate. One of course has to configure where these tools can find these packages, and this is typically done by configuring online package repositories.

 

Debian Red Hat Description
apt-get dist-upgrade yum update [package list] upgrade specified packages (or all installed packages if none specified)
apt-get install <package list> yum install <package list> install latest version of package(s)
apt-get remove <package list> yum remove <package list> remove specified packages from system
apt-cache list [package list] yum list [package list] list available packages from repositories

 

 http://www.pixelbeat.org/docs/packaging.html

So, as written:

First column: Desired
u for Unknown
i for Install
r for Remove
p for Purge
h for Hold

Second column: Status
n for Not Installed
i for Installed
c for Config-files
u for Unpacked
f for Failed-config
h for Half-installed

Third column: Err? (error?) — If in uppercase, bad errors.
   for (none)
h for Hold
r for Reinst-required
x for both-problems

https://lists.ubuntu.com/archives/kubuntu-users/2006-July/006993.html

https://help.ubuntu.com/community/SwitchingToUbuntu/FromLinux/RedHatEnterpriseLinuxAndFedora

Command Line Tools

Ubuntu uses apt-get instead of yum, up2date and so on to find, download, and install packages and their dependencies.

Note that, unlike yum, apt-get is only for packages available in repositories - it cannot handle packages you have already downloaded. The dpkg command is used instead.

Table of Equivalent Commands

Below is a table of equivalent commands for package management on both Ubuntu/Debian and Red Hat/Fedora systems.

Task

Red Hat/Fedora

Ubuntu

Adding, Removing and Upgrading Packages

Refresh list of available packages

Yum refreshes each time it's used

apt-get update

Install a package from a repository

yum install package_name

apt-get install package_name

Install a package file

yum install package.rpm
rpm -i package.rpm

dpkg --install package.deb

Remove a package

rpm -e package_name

apt-get remove package_name

Check for package upgrades

yum check-update

apt-get -s upgrade
apt-get -s dist-upgrade

Upgrade packages

yum update
rpm -Uvh [args]

apt-get dist-upgrade

Upgrade the entire system

yum upgrade

apt-get dist-upgrade

Package Information

Get information about an available package

yum search package_name

apt-cache search package_name

Show available packages

yum list available

apt-cache dumpavail

List all installed packages

yum list installed
rpm -qa

dpkg --list

Get information about a package

yum info package_name

apt-cache show package_name

Get information about an installed package

rpm -qi package_name

dpkg --status package_name

List files in an installed package

rpm -ql package_name

dpkg --listfiles package_name

List documentation files in an installed package

rpm -qd package_name

-

List configuration files in an installed package

rpm -qc package_name

-

Show the packages a given package depends on

rpm -qR package_name

apt-cache depends

Show other packages that depend on a
given package (reverse dependency)

rpm -q -whatrequires [args]

apt-cache rdepends

Package File Information

Get information about a package file

rpm -qpi package.rpm

dpkg --info package.deb

List files in a package file

rpm -qpl package.rpm

dpkg --contents package.deb

List documentation files in a package file

rpm -qpd package.rpm

-

List configuration files in a package file

rpm -qpc package.rpm

-

Extract files in a package

rpm2cpio package.rpm | cpio -vid

dpkg-deb --extract package.deb dir-to-extract-to

Find package that installed a file

rpm -qf filename

dpkg --search filename

Find package that provides a particular file

yum provides filename

apt-file search filename

Misc. Packaging System Tools

Show stats about the package cache

-

apt-cache stats

Verify all installed packages

rpm -Va

debsums

Remove packages from the local cache directory

yum clean packages

apt-get clean

Remove only obsolete packages from the local cache directory

-

apt-get autoclean

Remove header files from the local cache directory
(forcing a new download of same on next use)

yum clean headers

apt-file purge

General Packaging System Information

Package file extension

*.rpm

*.deb

Repository location configuration

/etc/yum.conf

/etc/apt/sources.list

Some of the information in this table was derived (with permission) from APT and RPM Packager Lookup Tables.

More technical information about Debian-style packaging can be found in Basics of the Debian package management system and the Debian New Maintainers' Guide.

Services

Services on Ubuntu are managed in a broadly similar way to those on Red Hat.

Graphical Tools

Services can be configured by clicking System -> Administration -> Services. A tool called Boot-Up Manager is also available.

Command Line Tools

Below is a table of example commands for managing services. The apache/httpd service is used as an example.

Task

Red Hat / Fedora

Ubuntu

Ubuntu
(with sysv-rc-conf or sysvconfig)

Starting/stopping services immediately

service httpd start

invoke-rc.d apache start

service apache start

Enabling a service at boot

chkconfig httpd on

update-rc.d apache defaults

sysv-rc-conf apache on

Disabling a service at boot

chkconfig httpd off

update-rc.d apache purge

sysv-rc-conf apache off

Note: Whereas Red Hat and Fedora servers boot into runlevel 3 by default, Ubuntu servers default to runlevel 2.

Note: The service and invoke-rc.d commands call init scripts to do the actual work. You can also start and stop services by doing e.g. /etc/init.d/apache start on Ubuntu, or /etc/init.d/httpd start on Red Hat/Fedora.