Package manager - cheat sheet

By: John McFarlane <john.mcfarlane@rockfloat.com>
Last updated: 08/14/2008 @ 00:20

Abstract:
The goal of this howto is to document how you do common things in each of the following package managers or os specific tools:
  1. Gentoo - portage
  2. Debian/Ubuntu - apt
  3. Redhat-4.x - rpm
  4. Redhat-5.x, CentOS-5.x - yum




1. Check the version of an installed package

Frequently you need to look up what version of Apache or something you are currently running:
Gentoo Debian/Ubuntu Redhat Centos
equery list apache dpkg --list httpd rpm -qa httpd yum list installed | grep httpd
I'm finished with this step

2. Check to see what updates are available

It's usually wise to look at package updates before applying them. This can really safe time because you can then plan around package updates that require more regression testing and configuration changes.
Gentoo Debian/Ubuntu Redhat Centos
emerge -uDp world apt-get --dry-run upgrade -NA- yum list updates
I'm finished with this step

3. Manage the default runlevel

Servers are best configured with only the required services running. Here's [one way] to turn them on/off.
Gentoo Debian/Ubuntu Redhat Centos
etc-update add apache2 default
etc-update del apache2 default
update-rc.d httpd defaults
update-rc.d -f httpd remove
chkconfig httpd on
chkconfig httpd off
chkconfig httpd on
chkconfig httpd off
I'm finished with this step

4. Check what package a particular file belongs to

Frequently I need to know what package a particular file belongs to, or what package put it there.
Gentoo Debian/Ubuntu Redhat Centos
equery belongs /etc/services dpkg -S /etc/services rpm -qf /etc/services yum provides /etc/services
I'm finished with this step

Changelog: Date Description
08/08/2008 @ 02:20 Initial creation
08/14/2008 @ 00:20 Equery belongs

This document was originally created on 08/08/2008


Conventions and tips for this howto document:
  1. For the record I think RPM is a piece of poo
  2. For the record I think Yum is not really much better
  3. For the record I will not be documenting up2date

Disclaimer:
This page is not endorsed by gentoo.org or any other cool cats. Any information provided in this document is to be used at your own risk.