Caution

The Packaging and Development guide is currently undergoing a major overhaul to bring it up to date. The current state you are seeing now is a preview of this effort.

The current version is unstable (changing URLs can occur at any time) and most content is not in properly reviewed yet. Proceed with caution and be aware of technical inaccuracies.

If you are an experienced packager and would like to contribute, we would love for you to be involved! See our contribution page for details of how to join in.

Install built packages

You have a built binary packages of a source package and want to install it (e.g. to test the packages). This article demonstrates multiple ways how you can achieve that.

Using your package manager

You can use the apt(8), apt-get(8) or dpkg(1) package manager to install or uninstall packages on an Ubuntu installation.

Note

apt(8) is intended to be used interactively by humans and does not guarantee a stable command line interface (suitable for machine-readability) while apt-get(8) is intended for unattended usage, for example, in scripts.

dpkg(1) is a package manager for Debian-based systems. It can install, remove, and build packages, but unlike the APT package management systems, it cannot automatically download and install packages or their dependencies.

See also the package management guide from the Ubuntu Server documentation for more details.

Install .deb files

You can install one or multiple .deb files by using apt install command:

sudo apt install PACKAGE.deb...

For example, to install the hello_2.10-3_amd64.deb binary package file (version 2.10-3 of the hello package for the amd64 architecture) you need to run:

sudo apt install 'hello_2.10-3_amd64.deb'

You can install one or multiple .deb files by using apt-get install command:

sudo apt-get install PACKAGE.deb...

For example, to install the hello_2.10-3_amd64.deb binary package file (version 2.10-3 of the hello package for the amd64 architecture) you need to run:

sudo apt-get install hello_2.10-3_amd64.deb

You can install one or multiple .deb files by using dpkg --install command:

sudo dpkg --install PACKAGE.deb...

For example, to install the hello_2.10-3_amd64.deb binary package file (version 2.10-3 of the hello package for the amd64 architecture) you need to run:

sudo dpkg --install hello_2.10-3_amd64.deb

Uninstall packages

Installed packages often setup configuration files and create other data files. When you want to uninstall a package you have to decide if you want to keep these files or want to delete them too.

Keeping configuration files can be useful to avoid having to reconfigure a package if it is reinstalled later, but this may have side-effects when testing to install multiple packages.

Keep the configuration files

You can uninstall one or multiple packages and keep their configuration files by using the apt remove command:

sudo apt remove PACKAGE-NAME...

For example, to uninstall the currently installed hello package and keep its configuration files you need to run:

sudo apt remove hello

You can uninstall one or multiple packages and keep their configuration files by using the apt-get remove command:

sudo apt-get remove PACKAGE-NAME...

For example, to uninstall the currently installed hello package and keep its configuration files you need to run:

sudo apt-get remove hello

You can uninstall one or multiple packages and keep their configuration files by using the dpkg --remove command:

sudo dpkg --remove PACKAGE-NAME...

For example, to uninstall the currently installed hello package and keep its configuration files you need to run:

sudo dpkg --remove hello

Delete the configuration files

You can uninstall one or multiple packages and delete their configuration files by using the apt purge command:

sudo apt purge PACKAGE-NAME...

For example, to uninstall the currently installed hello package and delete its configuration files you need to run:

sudo apt purge hello

You can uninstall one or multiple packages and delete their configuration files by using the apt-get purge command:

sudo apt-get purge PACKAGE-NAME...

For example, to uninstall the currently installed hello package and delete its configuration files you need to run:

sudo apt-get purge hello

You can uninstall one or multiple packages and delete their configuration files by using the dpkg --purge command:

sudo dpkg --purge PACKAGE-NAME...

For example, to uninstall the currently installed hello package and delete its configuration files you need to run:

sudo dpkg --purge hello

Install packages from a PPA

Using add-apt-repository

The add-apt-repository command adds a Repository (e.g. a Personal Package Archive (PPA) from Launchpad) to the /etc/apt/sources.list.d directory (see the sources.list(5) manual page for more details), so you can install the packages provided by the repository like any other package from the Ubuntu Archive.

sudo add-apt-repository ppa:LP-USERNAME/PPA-NAME
LP-USERNAME

The username of the Launchpad user who owns the PPA.

PPA-NAME

The name of the PPA.

For example, to add the Launchpad PPA with the name hello of the Launchpad user dviererbe you need to run:

sudo add-apt-repository ppa:dviererbe/hello

Then, you can install, just as normal, the hello package contained in the PPA:

sudo apt install hello
sudo apt-get install hello

See the add-apt-repository(1) manual page for more details.

Add PPA manually

When you visit the web interface of the Launchpad PPA you want to add, you can see a text reading something like “Technical details about this PPA”. When you click on the text, it will unfold and show the details you need to add the PPA.

Web-interface of the dviererbe/hello PPA; highlighting the technical details section.

The steps to add the PPA are as follows:

  1. Add the PPA entry to /etc/apt/sources.list.d directory

    sudo editor /etc/apt/sources.list.d/launchpad_ppa.sources
    

    Add the following lines (substituting LAUNCHPAD-USERNAME AND PPA-NAME for your own case) and save the file:

    deb https://ppa.launchpadcontent.net/LAUNCHPAD-USERNAME/PPA-NAME/ubuntu SERIES main
    deb-src https://ppa.launchpadcontent.net/LAUNCHPAD-USERNAME/PPA-NAME/ubuntu SERIES main
    
  2. Add the of the PPA Signing Key to /etc/apt/trusted.gpg.d directory.

    The following command will download the PPA signing key from the Ubuntu Keyserver and store it in the correct format in the /etc/apt/trusted.gpg.d directory. Substitute SIGNING_KEY with the Fingerprint (see picture above) of the PPA signing key.

    wget --quiet --output-document - \
    "https://keyserver.ubuntu.com/pks/lookup?op=get&search=0x${SIGNING_KEY,,}" \
    | sudo gpg --output /etc/apt/trusted.gpg.d/launchpad-ppa.gpg --dearmor -
    
  3. Update the package information:

    sudo apt update
    
    sudo apt-get update
    
  4. Install the package from the PPA:

    sudo apt install PACKAGE-NAME
    
    sudo apt-get PACKAGE-NAME
    

For example, here is the full script to add the Launchpad PPA named hello of the user dviererbe and install the hello package from it.

sudo sh -c 'cat <<EOF > /etc/apt/sources.list.d/launchpad_ppa2.sources
deb https://ppa.launchpadcontent.net/dviererbe/hello/ubuntu mantic main
deb-src https://ppa.launchpadcontent.net/dviererbe/hello/ubuntu mantic main
EOF'

SIGNING_KEY=C83A46831F1FE7AB597E95B9699E49957C59EA64
wget --quiet --output-document - \
"https://keyserver.ubuntu.com/pks/lookup?op=get&search=0x${SIGNING_KEY,,}" \
| sudo gpg --output /etc/apt/trusted.gpg.d/launchpad-ppa.gpg --dearmor -

sudo apt update
sudo apt install hello

Download the .deb files

You can also download binary packages (.deb files) from a Launchpad PPA and install them with a package manager (like demonstrated in the section Install .deb files).

Using pull-ppa-debs

The pull-ppa-debs command downloads the .deb files of one specific binary package or all binary packages, which are built by a source package in a Launchpad PPA.

pull-ppa-debs --ppa LP-USERNAME/PPA-NAME [--arch ARCH] PKG-NAME [SERIES|VERSION]
--ppa LP-USERNAME/PPA-NAME

The PPA to download the binary package(s) from.

LP-USERNAME

The username of the Launchpad user who owns the PPA.

PPA-NAME

The name of the PPA.

--arch ARCH

The architecture of the binary package(s) to download. Defaults to the system architecture of your host machine.

PKG-NAME

The name of the package to download. This can be the name of the source package to download all binary packages build by the source package or just the name of one specific binary package.

SERIES

Downloads the package with the latest version that targets the Ubuntu Series with the specified name. Defaults to the Current Release in Development.

VERSION

The version of the package to download.

The pull-ppa-debs command is part of the ubuntu-dev-tools package. You need to install it, before you can use it:

sudo apt install ubuntu-dev-tools

Tip

The ubuntu-dev-tools package also provides the commands:

  • pull-lp-debs (to download binary packages from Launchpad) and

  • pull-debian-debs (to download binary packages from the Debian archive).

For example, on an amd64 machine, the following command will download the binary package named hello and targeting amd64 from the Launchpad PPA named hello of the Launchpad user dviererbe:

pull-ppa-deb --ppa dviererbe/hello hello

The downloaded file will be hello_2.10-3_amd64.deb.

See the pull-pkg(1) manual page for more details.

Using the Launchpad web interface

You can download .deb files from a Launchpad PPA via the web interface like this:

  1. Go to the Launchpad PPA web interface and click on the link called “View package details”:

Web-interface of the dviererbe/hello PPA; highlighting the technical details section.
  1. Expand the details of the package you want to download by clicking on the little triangle next to the name of the package:

Web-interface of the dviererbe/hello PPA; highlighting the technical details section.
  1. Download the file(s) you need from the “Package files” section by clicking on the respective links:

Web-interface of the dviererbe/hello PPA; highlighting the technical details section.

Resources