The Raspbian archives can be a little out of date, but they contain a huge collection of software packages.

A package is something like the installers you might download on other operating systems - it contains executable software, documentation, configuration files, and so on, along with instructions for where these files should go on the filesystem.

Packages also contain information about their dependencies, the other packages that they depend on in order to function.

sudo apt-get update

You'll want to remember a handful of commands. The first is apt-get, which updates the list of available packages and installs from it. First, let's make sure we're up-to-date. Because we're updating system-wide files, we'll need to use sudo apt-get update. This will take a while, depending on your network connection, and you'll probably get a few screens full of output.

[email protected] ~ $ sudo apt-get update
Get:1 http://mirrordirector.raspbian.org wheezy Release.gpg [490 B]
Get:2 http://archive.raspberrypi.org wheezy Release.gpg [490 B]
Get:3 http://raspberrypi.collabora.com wheezy Release.gpg [836 B]
...
Fetched 7,040 kB in 39s (180 kB/s)
Reading package lists... Done

sudo apt-get upgrade

Next, you can choose to upgrade any packages on the system that have new versions available. This is usually a good idea on freshly installed systems or machines you haven't used in a while. Again, you'll need to use sudo, and you may have to wait a while. If there are a lot of packages to be downloaded, you'll be prompted whether to continue. Hit "y" as long as  you're prepared to wait out the download and installation time.

[email protected] ~ $ sudo apt-get upgrade
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages will be upgraded:
  dbus dbus-x11 e2fslibs e2fsprogs krb5-locales libcomerr2 libdbus-1-3 li
  libraspberrypi-dev libraspberrypi-doc libraspberrypi0 libss2 libxml2 nt
  python3-rpi.gpio raspberrypi-bootloader sonic-pi sudo unzip wolfram-eng
31 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
Need to get 350 MB of archives.
After this operation, 6,007 kB disk space will be freed.
Do you want to continue [Y/n]? 
Get:1 http://archive.raspberrypi.org/debian/ wheezy/main wolfram-engine a
Get:2 http://mirrordirector.raspbian.org/raspbian/ wheezy/main e2fslibs a
Get:3 http://mirrordirector.raspbian.org/raspbian/ wheezy/main e2fsprogs
...

apt-cache

Next is apt-cache, which works with the cached list of packages. It's handy for figuring out what's available. Maybe your Pi has a real shortage of talking bovines - let's see if anything can help us with that, using apt-cache search cowsay.

In order to inspect the package, you can use apt-cache show cowsay. In particular, look for anything under the Description line:

[email protected] ~ $ apt-cache show cowsay
Package: cowsay
Version: 3.03+dfsg1-4
Installed-Size: 89
Maintainer: Francois Marier <[email protected]>
Architecture: all
Depends: perl
Suggests: filters
Size: 21850
SHA256: db58abec6da06b0114f8798ce77d6ff6ce7e7deb3c8cb8216c86740d1bbc0217
SHA1: 21de074e7e203d283020eb29ceb2840ab459cb46
MD5sum: c6346d681711471184bfa28dfd9754b1
Description: configurable talking cow
Homepage: http://www.nog.net/~tony/warez/cowsay.shtml
Description-md5: c312f9ae79aed8150f991fcfa3df1a03
Tag: game::toys, implemented-in::perl, interface::commandline, role::program,
 use::entertaining, works-with::text
Section: games
Priority: optional
Filename: pool/main/c/cowsay/cowsay_3.03+dfsg1-4_all.deb

sudo apt-get install [package]

So cowsay looks like a promising package - let's install with sudo apt-get install cowsay and see what happens.

Success!

dpkg

Finally, if you're working with individual Debian packages (.deb files) rather than downloading them from an apt repository, for example when installing a custom kernel, you can use dpkg.

To see Info on a package:

dpkg -I package.deb

To install a package:

sudo dpkg -i package.deb

This guide was first published on Feb 24, 2015. It was last updated on Feb 24, 2015.

This page (Learn How to Find and Install Packages) was last updated on Oct 22, 2021.

Text editor powered by tinymce.