Skip to main content
Most of the software you need is available in Ubuntu’s official repositories. You can check the default repositories configured on your system by examining the appropriate file location for your release. In Ubuntu 22.04—the latest release at the time of this article—the repository configuration file may differ from previous versions. Older Ubuntu versions stored the file in a different path and even included comments referencing a new filename. Let’s examine the repository configuration in detail. Below is an excerpt from the file “/etc/apt/sources.list.d/ubuntu.sources”:

Breaking Down the Repository Configuration

  1. Types:
    The first line identifies the type of repository
Types:
The first line identifies the type of repository. Here, deb indicates a Debian-style repository, signifying that the package manager (e.g., apt) will work with Debian package files (with the .deb extension) containing executable programs, configuration files, documentation, and scripts.
  1. URIs:
    The next line specifies the Uniform Resource Identifier (URI) of the repository. In this instance, it points to the Ubuntu archive mirror in the United States (us.archive.ubuntu.com), with /ubuntu indicating the repository’s content. This URI directs the package manager to the correct source for downloading packages.
  2. Suites:
    This field outlines the suites or release components provided in the repository. In Ubuntu, a suite represents a set of packages tied to a specific release. For the current release codenamed “noble,” three suites are defined:
  3. Components:
    This line categorizes packages based on licensing and functionality:
    On servers, you typically primarily use packages from “Main” (and possibly “Universe” if needed). By default, Ubuntu enables all four components.

Working with Additional Repositories

Sometimes, the required software may not be available in the official Ubuntu repositories or may be outdated. In these situations, you can add third-party repositories—maintained by external teams or companies—that remain compatible with your system. For instance, if you need the latest stable version of Docker, begin by downloading the public key for Docker’s repository. Docker signs its packages with a private key; using the public key ensures the integrity of the packages by verifying their signatures.

Downloading the Docker Public Key

Execute the following command to download the Docker public key and save it as docker.key:
After downloading, verify the file by listing the directory contents:
Next, convert the key to a binary format using the gpg --dearmor command:
Then, move the dearmored key into the apt keyrings directory:
This method organizes third-party keys separately, making them easier to manage. If you ever need to disable a repository, simply remove its configuration file.

Adding the Docker Repository

Rather than altering the main sources file, create a new configuration file in the sources.list.d directory. For Docker, create a file named docker.list and insert the following configuration:
This configuration line includes:
  • deb: Specifies a Debian-style repository.
  • The Docker repository URL.
  • The distribution codename (noble).
  • The component (stable) indicating the stable Docker software version.
  • The [signed-by=...] option that points to the trusted public key.
After saving the file, update the package manager’s database with:
The output should indicate that the Docker repository is being queried:
If you encounter errors related to package signatures, ensure that the dearmored public key is correctly located in /etc/apt/keyrings/docker.key.gpg.

Using Personal Package Archives (PPAs)

Ubuntu supports Personal Package Archives (PPAs) as a convenient method for adding third-party repositories. PPAs simplify the process and even allow you to create your own. For example, to add a PPA for the latest graphics drivers, use:
This command structure is simple:
  • The ppa: prefix indicates a Personal Package Archive.
  • It is followed by the username (e.g., graphics-drivers) and the repository name (ppa).
After executing the command, confirm the change by pressing Enter when prompted. This utility will handle key management, update repository configuration files, and refresh the package database automatically. To list all enabled PPAs, run:
To remove a PPA, use:
A prompt will appear asking for confirmation before removal.

Final Steps

After configuring repositories—whether they are official, third-party, or PPAs—it is important to update the package database one final time:
This ensures that your system is aware of all available packages and updates. With the repositories correctly configured and verified, you are now ready to install software and manage your Ubuntu system effectively. Now, let’s move on to the next lesson.

Watch Video