Back to article
Linux Multi-Distro Package Manager Cheatsheet
Debian and Fedora (apt and yum)
July 9, 2010
The problem of managing software installs is one which is faced by all Linux distributions; but unfortunately, not all distros solve it the same way! If you're familiar with Debian's apt-get, you may be thrown by RedHat's yum, or OpenSUSE's Zypper, and vice versa. This handy cheatsheet is here to help when you suddenly find yourself facing an unfamiliar system.
Debian: aptitude and apt-get
Debian now has three options available for interacting with its packaging back-end, dpkg. Synaptic, the very graphical option, I won't tackle here as it's deliberately very self-explanatory. Aptitude is also graphical, but runs within a console using ncurses. To find a package, you can either browse through the package tree, or hit / to search for a particular string (then n to look for the next instance). Installed packages are shown in bold. To add a package for install, hit +; to remove an installed one, hit -, or _ to purge. Once you've done making changes, hit g to apply them, which will take you to a dependency resolution screen if necessary.
However, if you know what packages you're after, the command-line apt-get is your best bet. Here are the main commands you'll need:
To add a repository, edit /etc/apt/sources.list to add a couple of lines like this:
deb http://example.com/debian stable main deb-src http://example.com/debian stable mainThen run apt-get update to grab the information for the new repository.
Fedora (and other RPM systems): yum
Yum is the package manager used for RPM-based systems such as Fedora. (OpenSUSE uses RPMs, but the default tool is Zypper, which is covered in the next section). It's a command-line tool and here are the basic commands you'll need:
To add a repository, you should either edit /etc/yum.conf directly, or add an extra repository.repo file in /etc/yum.repos.d/, depending on your system setup. The file should look like this:
[reponame] name=Name RPM Repository baseurl=http://example.com/redhat/el$releasever/en/$basearch/repo gpgcheck=1 enabled=1You should be able to get this information from the repository webpage. If the gpgcheck parameter is switched on, you'll also need to grab the GPG key for the repository:
rpm --import http://example.com/packages/RPM-GPG-KEY.txt