Build a Better Process

A Quick Summary of Linux Package Managers

Whether you are using a Debian-style or Fedora-style Linux distribution, a vital skill to master is installing software packages.
  1. Debian vs. Fedora - Discuss package managers for two branches of Linux distributions.
  2. Package management - Outline which 3 commands we will practice with here.
  3. Help and terms - Define new terms and learn how to find help.
  4. Practice - Try out commands apt-cache, apt-get and dpkg.
  5. Next: permissions - Introduce user permissions.
face pic by Paul Alan Davis, CFA
Updated: February 21, 2021
Package managers do most of the work for you. You just need to know where to look and how to kick them off.

Outline Back Tip Next

/ factorpad.com / tech / full-stack / linux-package-managers.html

An ad-free and cookie-free website.

Learn how to install software packages in Linux


Video Tutorial

Videos can also be accessed from our Full Stack Playlist 2 on YouTube.

A quick summary of Linux package managers | Linux Tutorial for Beginners (4:59)

Code Examples and Video Script

Welcome. Today's question: How do you install software in Linux?

I'm Paul, and for those of us coming from Windows and Mac, when faced with the command prompt, it's easy to feel uncertain.

So here, I'll simplify the installation process, starting with two forks of Linux distributions.

And because we have high aspirations here, we'll go beyond just installing software, and have a more holistic, yet brief, discussion about package management, a very complex subject.

I'll show you where to find help, and I'll also define terms and we'll practice a bit (with the commands below) before heading on to user permissions.

Step 1 - Package Managers for Debian and Fedora

Let's jump to the Linux command line on a local test server sitting in my office here in California. As I usually do, I'll use whatis to define the programs used, so pause if you want to check that out.

paul@fullstack:~$ whatis apt-cache apt-get dpkg whatis less wc apt-cache (8) - query the APT cache apt-get (8) - APT package handling utility - - command-line interface dpkg (1) - package manager for Debian whatis (1) - display one-line manual page descriptions less (1) - opposite of more wc (1) - print newline, word, and byte counts for each file paul@fullstack:~$ less notes/video0018.txt

Next, I'll open a text file using less to outline this discussion.

Package Management (video 18) Two forks Debian-style: Debian, Ubuntu, Mint > dpkg, apt and aptitude Fedora-style: Fedora, Red Hat, CentOS > rpm, yum Terms repositories - /etc/apt/sources.list package name - simple name like python3 or nano package file - a file in .deb or .rpm format package maintainer - responsible for compatibility dependencies - other required packages Command line programs on Debian-style distributions dpkg - for dowloaded files in .deb format apt (apt-get apt-cache) - using package name format aptitude - GUI-like interface Syntax for apt command -option(s) argument(s) command -option(s) action argument(s) $ sudo apt-get update $ sudo apt-get upgrade $ sudo apt-get install python3 notes/video0018.txt

Most popular Linux distributions fall in one of two camps, Debian-style and Fedora-style.

Debian, Ubuntu and Mint use programs like dpkg, apt and aptitude.

Fedora, Red Hat and CentOS use rpm and yum.

Step 2 - Package Management Programs We Use Here

In another window, I'll do a which on all five, showing program locations, confirming that my distribution is Debian-style.

paul@fullstack:~$ which apt aptitude dpkg rpm yum /usr/bin/apt /usr/bin/aptitude /usr/bin/dpkg

And quickly we're using the command line in this Playlist, and if you prefer a GUI, it will have its own package management system.

Step 3 - Finding Help and Defining Terms

Let's define terms.


Repositories are Internet locations where software is hosted.

For example Debian has 43,000 packages, and you can use the site's search functions, or search by section to find packages.

The file /etc/apt/sources.list points to sources where packages are found.

Package name

Next, package name is a simple name like python3 or nano.

Package file

The package file itself has a .deb or .rpm extension.

Package maintainer

The package maintainer ensures the software works properly.


Dependencies are other packages required to install a package.

Package managers for Debian-style distributions

Let's summarize three programs with use cases.

The advanced dpkg installs downloaded files in .deb format.

apt uses package names, instead of package files, making it easier for beginners, meaning it downloads files from repositories, installs packages, modifies configuration files and resolves dependencies automatically.

Last, aptitude offers a GUI-like interface.

Syntax for apt

I need to mention the apt syntax is a bit different.

Our normal convention for commands goes like this, command -option(s) argument(s) but apt-cache and apt-get have actions.

(Below are three examples)

$ sudo apt-get update $ sudo apt-get upgrade $ sudo apt-get install python3
Find help for the command apt-cache

Let's explore that, showing you commands every beginner should know.

Start with --help or use the man page for help.

paul@fullstack:~$ apt-cache --help apt for amd64 compiled on Dec 11 2016 09:48:19 Usage: apt-cache [options] command apt-cache [options] showpkg pkg1 [pkg2 ...] apt-cache [options] showsrc pkg1 [pkg2 ...] apt-cache is a low-level tool used to query information from APT's binary cache files Commands: gencaches - Build both the package and source cache showpkg - Show some general information for a single package showsrc - Show source records stats - Show some basic statistics dump - Show the entire file in a terse form dumpavail - Print an available file to stdout unmet - Show unmet dependencies search - Search the package list for a regex pattern show - Show a readable record for the package depends - Show raw dependency information for a package rdepends - Show reverse dependency information for a package pkgnames - List the names of all packages in the system dotty - Generate package graphs for GraphViz xvcg - Generate package graphs for xvcg policy - Show policy settings Options: -h This help text. -p=? The package cache. -s=? The source cache. -q Disable progress indicator. -i Show only important deps for the unmet command. -c=? Read this configuration file -o=? Set an arbitrary configuration option, eg -o dir::cache=/tmp See the apt-cache(8) and apt.conf(5) manual pages for more information. paul@fullstack:~$

First, apt-cache has 15 actions to query a local cache file downloaded during the last apt-get update.

Let's use apt-cache to search the cache for nano in the name field.

paul@fullstack:~$ apt-cache -n search nano science-nanoscale-physics - Debian Science Nanoscale Physics packages science-nanoscale-physics-dev - Debian Science Nanoscale Physics development packages kiki-the-nano-bot - 3D puzzle game, mixing Sokoban and Kula-World kiki-the-nano-bot-data - Kiki the nano bot - game data libnanoxml2-java - small XML parser for Java libnanoxml2-java-doc - documentation for libnanoxml2-java nano - small, friendly text editor inspired by Pico nano-tiny - small, friendly text editor inspired by Pico - tiny build nanoblogger - Small weblog engine for the command line nanoblogger-extra - Nanoblogger plugins nanoc - static site generator written in Ruby nanoc-doc - static site generator written in Ruby - documentation libnanomsg-dev - nanomsg development files libnanomsg0 - high-performance implementation of scalability libraries libnanomsg0-dbg - high-performance implementation of scalability libraries - debug symbols paul@fullstack:~$ clear

And apt-cache stats for a summary of the cache.

paul@fullstack:~$ apt-cache -n search nano Total package names: 54242 (1,085 k) Total package structures: 54255 (3,038 k) Normal packages: 41905 Pure virtual packages: 392 Single virtual packages: 4725 Mixed virtual packages: 450 Missing: 6783 Total distinct versions: 43562 (3,136 k) Total distinct descriptions: 84892 (2,037 k) Total dependencies: 269895 (7,557 k) Total ver/file relations: 45114 (1,083 k) Total Desc/File relations: 84892 (2,037 k) Total Provides mappings: 7622 (152 k) Total globbed strings: 75 (568 ) Total dependency version space: 1,102 k Total slack space: 36.6 k Total space accounted for: 15.0 M paul@fullstack:~$ clear
Find help on the command apt-get

Next, apt-get has 15 actions, the most important being: update, upgrade and install.

paul@fullstack:~$ apt-get --help apt for amd64 compiled on Dec 11 2016 09:48:19 Usage: apt-get [options] command apt-get [options] install|remove pkg1 [pkg2 ...] apt-get [options] source pkg1 [pkg2 ...] apt-get is a simple command line interface for downloading and installing packages. The most frequently used commands are update and install. Commands: update - Retrieve new lists of packages upgrade - Perform an upgrade install - Install new packages (pkg is libc6 not libc6.deb) remove - Remove packages autoremove - Remove automatically all unused packages purge - Remove packages and config files source - Download source archives build-dep - Configure build-dependencies for source packages dist-upgrade - Distribution upgrade, see apt-get(8) dselect-upgrade - Follow dselect selections clean - Erase downloaded archive files autoclean - Erase old downloaded archive files check - Verify that there are no broken dependencies changelog - Download and display the changelog for the given package download - Download the binary package into the current directory Options: -h This help text. -q Loggable output - no progress indicator -qq No output except for errors -d Download only - do NOT install or unpack archives -s No-act. Perform ordering simulation -y Assume Yes to all queries and do not prompt -f Attempt to correct a system with broken dependencies in place -m Attempt to continue if archives are unlocatable -u Show a list of upgraded packages as well -b Build the source package after fetching it -V Show verbose version numbers -c=? Read this configuration file -o=? Set an arbitrary configuration option, eg -o dir::cache=/tmp See the apt-get(8), sources.list(5) and apt.conf(5) manual pages for more information and options. This APT has Super Cow Powers.

Step 4 - Practice With apt-get update and dpkg

Update the local package cache with apt-get update

Let's kick off an apt-get update that accesses the sources.list file, I mentioned, and finds the download location then updates that local cache with the latest from Debian.

paul@fullstack:~$ sudo apt-get update Hit http://security.debian.org jessie/updates InRelease Ign http://ftp.us.debian.org jessie InRelease Hit http://ftp.us.debian.org jessie-updates InRelease Hit http://security.debian.org jessie/updates/main Sources Hit http://ftp.us.debian.org jessie Release.gpg Hit http://security.debian.org jessie/updates/main amd64 Packages Hit http://security.debian.org jessie-updates/main Translation-en Hit http://ftp.us.debian.org jessie-updates/main Sources Get:1 http://ftp.us.debian.org jessie-updates/main amd64 Packages/DiffIndex [6,916 B] Get:2 http://ftp.us.debian.org jessie-updates/main Translation-en/DiffIndex [2,704 B] Hit http://ftp.us.debian.org jessie Release Hit http://ftp.us.debian.org jessie/main Sources Hit http://ftp.us.debian.org jessie/main Translation-en Fetched 9,620 B in 2s (4,524 B/s) Reading package lists... Done paul@fullstack:~$

Always do an apt-get update before an apt-get upgrade or apt-get install.

Here is how you would upgrade all of your installed packages as a superuser (using sudo).

paul@fullstack:~$ sudo apt-get update paul@fullstack:~$ sudo apt-get upgrade

We will do the official install of python3 later, but this is how we would kick that off.

paul@fullstack:~$ sudo apt-get update paul@fullstack:~$ sudo apt-get install python3

Pretty easy huh?

Update the local package cache with apt-get update

Are you curious about what's installed on your system?

We can use dpkg and do a count.

paul@fullstack:~$ dpkg -l | wc -l 489

To see the status of the package less, use dpkg -s, offering status, maintainer, version and dependencies.

paul@fullstack:~$ dpkg -s less Package: less Status: install ok installed Priority: important Section: text Installed-Size: 253 Maintainer: Anibal Monsalve Salazar Architecture: amd64 Multi-Arch: foreign Version: 458-3 Depends: libc6 (>= 2.14), libtinfo5, debianutils (>= 1.8) Description: pager program similar to more This package provides "less", a file pager (that is, a memory-efficient utility for displaying text one screenful at a time). Less has many more features than the basic pager "more". As part of the GNU project, it is widely regarded as the standard pager on UNIX-derived systems. . Also provided are "lessecho", a simple utility for ensuring arguments with spaces are correctly quoted; "lesskey", a tool for modifying the standard (vi-like) keybindings; and "lesspipe", a filter for specific types of input, such as .doc or .txt.gz files. Homepage: http://www.greenwoodsoftware.com/less/ paul@fullstack:~$

In future Intermediate videos, we'll answer:

Step 5 - Next: Install Software Packages

So I covered a lot here, just so you've seen it and shortly we'll close out this project on Linux For Beginners, then jump to the software layer, install Python 3, cover the basics and get right to some math.

(Here is the beginning of our software stack)

Coming up next is user permissions.

Have a nice day.

What's Next?

Check out other free opportunities to learn on our YouTube Channel. And follow @factorpad on Twitter and join our no-spam email list for updates.

Outline Back Tip Next

/ factorpad.com / tech / full-stack / linux-package-managers.html

linux package manager
fedora package manager
linux install software
how to install linux software
package installer
debian install deb package
ubuntu list installed packages
rpm package
linux repository
redhat package manager
what is a linux package manager
linux install package
ubuntu install deb package
linux tutorial

A newly-updated free resource. Connect and refer a friend today.