Linux software package management

Linux software package management. How to install, remove and update packages on Ubuntu and OpenSUSE. Usage notes for dpkg, zypper, apt-get.

Published: Sunday, 6 March 2011

Listing installed packages

In Ubuntu, use dpkg -l to list all installed packages.

In OpenSUSE, use zypper pa | grep ^i to list all installed packages.

Searching for packages

In Ubuntu, use apt-cache search PACKAGE, where PACKAGE is a pattern.

In OpenSUSE, use zypper search PACKAGE/

In CentOS, use yum search PACKAGE.

Display info about a package

In Ubuntu, use apt-cache show PACKAGE. This will display the version and description of the package.

Installing a package

In Ubuntu, use apt-get install PACKAGE.

In CentOS, use yum install PACKAGE. You can use the -y option to answer “yes” to all questions.

Removing or uninstalling a package

In Ubuntu, use apt-get remove PACKAGE.

Updating and upgrading packages

Out of date software can pose a security risk, but upgrading can also introduce bugs. Remember to backup your data and configuration before upgrading packages.

In Ubuntu, use apt-get update to retrieve a new list of packages. Then run apt-get upgrade to upgrade packages to newer versions. Some packages, like the kernel, won’t be upgraded automatically. To update these run apt-get dist-upgrade instead.