How To Delete A Repository And GPG Key In Ubuntu In 2024

How To Delete A Repository And GPG Key In Ubuntu

In this tutorial, we will show you the tutorial to delete a repository and GPG key in Ubuntu and it’s derivatives.

How To Delete A Repository And GPG Key In Ubuntu In 2024

What Is Repository In Linux?

Repository or Repos are the place where the all software packages are stored.  Linux users can easily download these packages using  Apt package manager or via Software center.  There are basically 4 repos in Ubuntu and they are Main, Universe, Restricted and Multiverse.

How To Delete Repository In Ubuntu?

Repos added  using add-apt-repositoryare stored in /etc/apt/sources.list file. So, If you want to remove or delete Repository in Ubuntu then open the /etc/apt/sources.list file and look for the repository entry that you want to delete. To delete the repository, simply remove the entry from the file and you need to save and close the file.

sudo nano /etc/apt/sources.list

If you have added PPA repositories, search into the /etc/apt/sources.list.d/ directory and delete the repos that you want to remove.
Finally, run the following command to update the software sources list:

sudo apt update

How To Delete Repository keys in Ubuntu?

Run the following command to list down the added keys. The following command will list down the added repository keys from your Ubuntu.

sudo apt-key list

You can simply remove the keys using the following command by mentioning the long (40 characters) hex value or the 8 characters.

sudo apt-key del "3820 03C2 C8B7 B4AB 813E 915B 14E4 9429 73C6 2A1B"

Or,

sudo apt-key del 90A52C1D

Run the following command to update the repository lists:

sudo apt update

Leave a Comment