How to Remove Software Repositories on Ubuntu

The ability to add repositories on Linux is essential to get software from third-party sources other than the official repos. On Ubuntu, it’s possible to add a repository using the add-apt-repository command or by editing the sources.list file.

But how do you remove the added repository once you’re done with it? Deleting a repository entry on Ubuntu is even easier than adding one, and there are multiple ways to do the same.

4

Deleting the Repository Entry From sources.list

The most convenient way to remove an unwanted package repository on Ubuntu is by editingthe sources.list file. The sources file lists all the configured repositories on your system. You can view the contents of the file using any of the file-viewing Linux programs.

Start by opening the file with a text editor of your choice (for this guide, we’ll use Vim):

remove package repositories on ubuntu

Find the repository you want to remove and delete the entire line.Save the file and exit Vimto proceed. Now, update the package sources with:

After removing a repository from the sources.list file, you won’t receive any package updates from it.

contents of sources.list file

The sources.list file is a root-owned file and it can break repository configuration if not modified properly.

Removing the GPG Key for the Repository

Packages in a repository are signed with a pair of keys: public and private. When you add a repository, you ask the package manager (APT) to trust the packages found in that repo. After deleting the repository entry from your sources file, you should also delete the GPG key associated with it.

To do so, first, list all the trusted keys with:

apt keys for repositories in ubuntu

The second line in thepubentry is the actual key, whileuidis the repository name. Find the repository you just deleted, then copy the last eight characters of its key.

Enter the following to remove the key, replacing the hex value at the end with the characters you copied:

software updater ubuntu remove repositories

You can also specify the entire key in the command if you want:

Remove a PPA Using add-apt-repository

When it comes to removing a PPA, the best—and safest—way is to use add-apt-repository. It’s the only command you need to add as well as removePPAs on Ubuntu. Don’t let its name fool you into thinking otherwise.

Get a list of all configured PPAs by listing the contents of the/etc/apt/sources.list.ddirectory usingthe ls command:

Once you’ve found the PPA you want to remove, use the-rflag with add-apt-repository:

If the output displaysthe “add-apt-repository: command not found” error, you’ll have to install the tool first.

you’re able to also delete the PPA folder from the sources.list.d directory and it’ll remove the repository from your system.

Use the Ubuntu Software Updater to Remove a Repository

Ubuntu offers a graphical way to manage software repositories and third-party PPAs using the Software Updater app. To begin, launch Software Updater from the applications menu and clickSettings.

Once launched, switch to theOther Softwaretab. You’ll see a list of all the third-party software sources configured on your computer. To disable a repository, uncheck the box corresponding to the repo and enter the administrator password.

If you’ve decided to remove the package repository, highlight the entry and clickRemove.

Finally, update the package sources using APT:

you’re able to also edit oradd a third-party repository on Ubuntuusing the Software Updater app.

Software Management on Ubuntu Made Easy

Adding and deleting repositories is another aspect of package management on Ubuntu and other Linux distros. To maintain your system security, you should always check if a repository or PPA is genuine, and doesn’t offer any malicious software.

Ubuntu comes with a few repositories preconfigured. These are the official repositories from where you may download trusted packages to install.

If you’ve used Ubuntu, you might have noticed a variety of different software repositories. Here’s an explanation of them.

Who asked for these upgrades?

Anyone with more than a passing interest in motorsports must see these films.

You’re not getting the most out of what you pay for iCloud+.

I plugged random USB devices into my phone and was pleasantly surprised by how many actually worked.

Tor spoiled me forever.

Technology Explained

PC & Mobile