JH
Joe Harris
March 29 2020
Updated February 16 2026

Configure APT Repositories on Ubuntu 20.04: Add/Remove Repos, PPAs, and GPG Keys

Linux Ubuntu

Using another OS?

Select the desired version or distribution.

Software installation on Linux systems is performed from repositories, which by default contain a large number of packages. But sometimes there are situations when the necessary software is not included, or the version is too old. In this case, you can add the necessary repository and install from it.

How to configure repositories on Ubuntu 20.04:

Be careful when performing this operation, because sometimes such builds contain experimental versions of system software and even the Linux kernel. Therefore, you should carefully study the information about the third-party repository in its description and update manager.

In this tutorial, we will configure repositories on Ubuntu server 20.04.

List of repositories in Ubuntu

To view all repositories in the system:

nano /etc/apt/sources.list

They can also be located in one of the files in the /etc/apt/sources.list.d/ folder.

To disable one of the repositories, just comment out its line.

# deb http://archive.ubuntu.com/ubuntu focal multiverse

Adding repositories in Ubuntu

To add a repository you need to find out its address from the software developer and use the apt-add-repository command with the following syntax:

apt-add-repository ‘deb http://repository_address version branch’

Sometimes you need to install the GPG security key first. Let's take MariaDB as an example.

apt-key adv --fetch-keys 'https://mariadb.org/mariadb_release_signing_key.asc'

Adding repository:

add-apt-repository 'deb [arch=amd64,arm64,ppc64el] http://mirror.mephi.ru/mariadb/repo/10.5/ubuntu focal main'

Removing repositories

To remove a repository use this command:

add-apt-repository --remove 'deb [arch=amd64,arm64,ppc64el] http://mirror.mephi.ru/mariadb/repo/10.5/ubuntu focal main'

PPA repository in Ubuntu

During the installation of the PPA repository, the system automatically recognizes the repository and downloads the necessary keys.

apt-add-repository ppa:repository/ppa

To remove PPA repository:

apt-add-repository --remove ppa:repository/ppa

After editing the list of repositories, don't forget to update the list of packages in the system.

apt update

Conclusion

In this guide, we covered the core ways to manage software repositories on Ubuntu 20.04: where APT repository entries are stored, how to review and disable them, how to add and remove third-party repositories, and how PPAs work. After any repository change, always run apt update to refresh package indexes and confirm the source is valid. Since third-party repositories can introduce unexpected package versions (including core system components), it’s best to add only trusted sources, keep repository entries clean and well-documented, and remove unused repos to reduce update errors and security risks.

FAQ: Ubuntu 20.04 Repositories

  • Q1: Where does Ubuntu 20.04 store the list of repositories?
    A: Repository entries are stored in /etc/apt/sources.list and, more commonly for third-party sources, as separate files inside /etc/apt/sources.list.d/.
  • Q2: How do I quickly disable a repository without deleting it?
    A: Comment out the repository line by adding # at the beginning of the line in the .list file (or in sources.list). This keeps the entry for later but prevents APT from using it.
  • Q3: What’s the safest way to add a third-party repository?
    A: Use the repository line provided by the vendor and ensure it’s signed with a trusted key. Prefer repository-specific signing (keyring) rather than trusting a key globally, and only use repositories from reputable sources.
  • Q4: What is a PPA and when should I use it?
    A: A PPA (Personal Package Archive) is a Launchpad-hosted repository commonly used to distribute newer versions of software for Ubuntu. Use PPAs when you trust the maintainer and need a version that isn’t available in official Ubuntu repositories.
  • Q5: How do I remove a repository or PPA correctly?
    A: Remove it using add-apt-repository --remove ... (for repos or PPAs) or delete the corresponding .list file from /etc/apt/sources.list.d/. After removal, run apt update to refresh package indexes.
  • Q6: After adding a repository, why does apt update fail with a key error (NO_PUBKEY)?
    A: That means APT can’t verify the repository signature because the signing key is missing or incorrect. Install the correct vendor key and ensure the repository line matches the key being used.
  • Q7: What does “Release file not found” mean during apt update?
    A: Usually the repository URL is wrong, the Ubuntu codename (like focal) doesn’t match what the repository supports, or the repository structure has changed. Double-check the repo line and vendor documentation.
  • Q8: Do I need to run anything after adding or removing repositories?
    A: Yes — run apt update to refresh the package list. If you’re installing from the new repository right away, follow it with apt install for the package you need.
  • Q9: Can adding third-party repositories affect system stability?
    A: Yes. Some repositories include newer or experimental builds that may upgrade core libraries or dependencies. It’s best to add only what you need, avoid mixing many third-party sources, and review what will be upgraded before confirming updates.
Vote:
4 out of 5
Аverage rating : 4
Rated by: 17
1101 CT Amsterdam The Netherlands, Herikerbergweg 292
+31 20 262-58-98
700 300
ITGLOBAL.COM NL
700 300

You might also like...

We use cookies to make your experience on the Serverspace better. By continuing to browse our website, you agree to our
Use of Cookies and Privacy Policy.