TutorialsUbuntu

How To Delete Repository and GPG Key on Ubuntu Linux

Delete Repository and GPG Key on Ubuntu

In this tutorial, we will show you how to delete the repository and GPG key on Ubuntu Linux. For those of you who didn’t know, A repository is a collection of software packages that are stored on a remote server and can be downloaded and installed on a computer. In the case of Ubuntu Linux, a repository is a collection of packages that are maintained by the Ubuntu team and made available to users of the operating system. In addition to the official repositories provided by the Ubuntu team, users can also add third-party repositories to their system. This can be useful if you want to install software that is not included in the official repositories, or if you want to use a different version of a package than the one provided by the official repositories.

A GPG (GNU Privacy Guard) key is a digital signature that is used to authenticate the identity of the person or organization that created a piece of software. In the context of Ubuntu Linux, a GPG key is used to verify the authenticity of the packages in a repository.

This article assumes you have at least basic knowledge of Linux, know how to use the shell, and most importantly, you host your site on your own VPS. The installation is quite simple and assumes you are running in the root account, if not you may need to add ‘sudo‘ to the commands to get root privileges. I will show you the step-by-step remove of the repository and GPG key on Ubuntu 22.04 (Jammy Jellyfish). You can follow the same instructions for Ubuntu 22.04 and any other Debian-based distribution like Linux Mint, Elementary OS, Pop!_OS, and more as well.

Prerequisites

  • A server running one of the following operating systems: Ubuntu 22.04, 20.04, and any other Debian-based distribution like Linux Mint.
  • It’s recommended that you use a fresh OS install to prevent any potential issues.
  • SSH access to the server (or just open Terminal if you’re on a desktop).
  • A non-root sudo user or access to the root user. We recommend acting as a non-root sudo user, however, as you can harm your system if you’re not careful when acting as the root.

Delete Repository and GPG Key on Ubuntu

Step 1. Delete Repository on Ubuntu Linux.

First, find the repository then delete it as shown below:

sudo nano /etc/apt/sources.list

To delete a repository on Ubuntu Linux, follow these steps:

For example, if you want to remove the my-idroot-repo repository, you would use the following command:

sudo apt remove my-idroot-repo

After completing these steps, the repository will be removed from your system. This means that you will no longer be able to install packages from that repository.

Step 2. Delete GPG Key on Ubuntu Linux.

We use apt-key command to add and manage the repository keys. First, let us list the added keys using the command:

sudo apt-key list

This command will list all added repository keys:

/etc/apt/trusted.gpg.d/ubuntu-keyring-2022-archive.gpg
------------------------------------------------------
pub rsa4696 2022-12-16 [SC]
460B C727 8888 209C 42C8 4F93 3B4F E6AC C0B2 1F32
uid [ unknown] Ubuntu Archive Automatic Signing Key (2022) <ftpmaster@ubuntu.com>

 To remove the GPG key, use the following command, replacing GPG_KEY_ID with the actual ID of the GPG key:

sudo apt-key del GPG_KEY_ID

For example:

sudo apt-key del "460B C727 8888 209C 42C8 4F93 3B4F E6AC C0B2 1F32"

Update the package list on your system to reflect the changes you just made. This can be done with the following command:

sudo apt update

After completing these steps, the GPG key will be removed from your system. This means that the packages in the repository associated with the GPG key will no longer be trusted.

Note: If the GPG key you are removing is associated with a repository, you should also remove the repository. This can be done with the apt remove command. For more information, see the earlier explanation on repositories.

Congratulations! You have successfully deleted the repository and GPG key. Thanks for using this tutorial to remove the repository and GPG key on Ubuntu 22.04 LTS Jammy Jellyfish system. For additional help or useful information, we recommend you check the Ubuntu website.

VPS Manage Service Offer
If you don’t have time to do all of this stuff, or if this is not your area of expertise, we offer a service to do “VPS Manage Service Offer”, starting from $10 (Paypal payment). Please contact us to get the best deal!

r00t

r00t is an experienced Linux enthusiast and technical writer with a passion for open-source software. With years of hands-on experience in various Linux distributions, r00t has developed a deep understanding of the Linux ecosystem and its powerful tools. He holds certifications in SCE and has contributed to several open-source projects. r00t is dedicated to sharing her knowledge and expertise through well-researched and informative articles, helping others navigate the world of Linux with confidence.
Back to top button