Как удалить репозиторий в linux
Перейти к содержимому

Как удалить репозиторий в linux

  • автор:

How to apt-delete-repository? [duplicate]

where the command add-apt-repository is in the package software-properties-common . I could not find the systemback entry in /etc/apt/sources.list .

How can you run the reverse of the command?

Léo Léopold Hertz 준영's user avatar

1 Answer 1

To remove a repository, you have to do two things:

Remove it from sources.list .

If it was added by add-apt-repository then you will find it in its own file in /etc/apt/sources.list.d , not in the main sources.list .

Optional: Stop trusting the key

Use apt-key list to list trusted keys. Look for an entry like "Launchpad PPA for Kendek" in this case. Then use apt-key del to delete it:

How to Delete Repository And GPG Key In Ubuntu

Ubuntu has four official repositories namely Main, Universe, Restricted, and Multiverse. A repository (repo) is a central place where the developers keep the software packages.

Using the repository keys, we can ensure that we are getting the packages from the right person. However, sometimes we would like to delete a repository along with its GPG key when it’s no longer necessary in our ubuntu systems.

Here at Bobcares, we handle Ubuntu servers of our customers as a part of our Server Management Services.

Today let’s see how our Support Engineers delete the repository and GPG key in Ubuntu.

How to delete repository and GPG key in Ubuntu – Steps to follow

We will see the steps that our Support Engineers follow for deleting the repository and key in Ubuntu.

Deleting a repository in Ubuntu

When we add a repository using ‘add-apt-repository’ command, it will be stored in /etc/apt/sources.list file.

For deleting a software repository from Ubuntu and its derivatives we do the following:

First, open the /etc/apt/sources.list file and look for the repository entry.

We can do this using the following command:

And simply remove the entry to delete the repository.

After that, we can save and close the file.

However, if we have added PPA repositories, we must look into /etc/apt/sources.list.d/ directory and delete the respective entry.

Alternatively, we can delete the repository using ‘add-apt-repository’ command.

For example, we can delete the Systemback repository using the following command:

Finally, update the software sources list using the following command:

Listing Repository keys

‘apt-key’ is used to manage the list of keys used by ‘apt’ to authenticate packages.

Following are the paths where trusted keys are found:

We can use the following command to list trusted keys with fingerprints:

Delete repository keys in Ubuntu

We use “apt-key” command to add the repository keys.

First, we will list the added keys using the following command:

This command will list all added repository keys.

From the above output, the long (40 characters) hex value is the repository key.

If we want the APT package manager to stop trusting the key we can delete it using the following command:

Or, we can alternatively specify the last 8 characters:

Finally, we can run the following command to update the repository lists:

Conclusion

In short, we saw the steps that our Support Engineers follow to delete repository and GPG Key In Ubuntu.

PREVENT YOUR SERVER FROM CRASHING!

Never again lose customers to poor server speed! Let us help you.

Our server experts will monitor & maintain your server 24/7 so that it remains lightning fast and secure.

2 Comments

Thank you, after spending several hours trying to fix my issue, I landed on your page from google and solved it! I took the time to let you know, Thank You Bob, hope you receive this:)

How to Remove Software Repositories on Ubuntu

Streamline package management on Ubuntu by deleting old, unused software repositories from your computer.

The ability to add repositories on Linux is essential to get software from third-party sources other than the official repos. On Ubuntu, you can 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.

Deleting the Repository Entry From sources.list

The most convenient way to remove an unwanted package repository on Ubuntu is by editing the 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):

Find the repository you want to remove and delete the entire line. Save the file and exit Vim to 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.

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:

The second line in the pub entry is the actual key, while uid is 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:

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 remove PPAs 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.d directory using the ls command:

Once you've found the PPA you want to remove, use the -r flag with add-apt-repository:

If the output displays the "add-apt-repository: command not found" error, you'll have to install the tool first.

You can 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 click Settings.

Once launched, switch to the Other Software tab. 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 click Remove.

Finally, update the package sources using APT:

You can also edit or add a third-party repository on Ubuntu using the Software Updater app.

4 Easy Methods To Remove an APT Repository in Ubuntu

Remove Repository Featured Image

In this article, we’ll cover the simple steps to remove an apt repository in Ubuntu. While updating the Ubuntu system using the apt command, we may come across a scenario where some old repositories cause errors. The only feasible option that remains is to remove such repositories. In this article, we will demonstrate command-line as well as GUI methods to remove an apt repository or PPAs (Personal Package Archives).

How to remove an apt repository in Ubuntu

Let’s go over the steps that you’d need to take to remove an apt repository.

1. Using the apt command

This might not come as a surprise to any Ubuntu user that this task can be achieved by using the all powerful apt command. It can be done by:

Remove Repository Apt

Remove PPA using ‘apt’ command

To remove a specific repository, we need to know the exact name of the PPA involved. Not every user is aware of the names of the repository present on the system, therefore Ubuntu has a command to list the repositories.

Remove Repository Apt Policy

Remove Repository Apt Policy

The number before the name of repository is a priority number.

2. Using the ppa-purge command

As the name of the command name suggests, it specifically deals with removing repositories in Linux systems. Since this is not a system built-in function, we’ll install the package using the apt command:

After installing the tool, we can run:

Remove Repository Purge

Removing repository by ‘ppa-purge’

3. Removing a repository from ‘apt directory’

Like every other configuration in Linux, repositories are stored in the system as a file. Instead of using predefined commands, we can remove these repositories manually.

These repositories are stored in ‘etc/apt/source.list.d/’ in the form of ‘.list’ files. Before removing any repository, we can list the contents of the directory by using the ls command:

Remove Repo Source Ls

Files inside ‘source.list.d’

The ‘ls’ command is used to display the contents of any directory in a Linux system. We have a complete documentation on ls command. From the repository files, we can choose the ones we wish to remove.

According to the permissions displayed at the start of each line, we need elevated privileges to remove these files:

Remove Repo Source File

Removing repository manually

The ‘rm’ command is responsible for removing files from command line.

This basically sums up all the ways to remove repositories using the command-line.

4. Removing a repository using ‘Software and Updates’

There is no easier method to remove a repository than using a GUI-based application. To do the required, we open “Software and Updates” in Ubuntu.

In the “Other Software” section of the application, we can see a list of repositories in Ubuntu.

Remove Repo GUI1

Software and Updates application

Selecting and pressing the “Remove” button will bring up the “Authentication” screen.

Remove Repo GUI2

Authentication Screen

After entering the password and clicking “Authenticate,” we are done with dealing with the specific repository.

Note on removing apt repository by deleting its keys

Ubuntu does not advocate removing an apt repository by deleting its keys. The keys are used for authentication and verification, and deleting them may result in system issues. That being said, if it is absolutely necessary, the following procedures can be taken and don’t say we didn’t warn you in case of a system failure due to this procedure:

  • To launch the terminal, press “Ctrl + Alt + T” on the keyboard
  • Execute the following command to list the repository-associated keys on your system:
  • Locate the key associated with the repository you wish to delete, and record its ID
  • Execute the command below to delete the key:
  • Replace <key-id> with the ID of the key to be removed
  • Run the following command to remove the repository item from the sources.list file:
  • This will allow access to the sources.list file in the nano text editor. Delete the line containing the repository you wish to delete, and then save the file by hitting “Ctrl + X,” “Y,” and “Enter.”

Here’s in-depth documentation on apt-key, the APT key management utility tool that you can educate yourself with if you are still planning to go with the procedure above.

Summary

The task of removing any repository is not difficult. The Graphic-based method is very convenient and saves time. Whether you use the apt command, ppa-purge, manually delete repository files, or the GUI-based approach, the process is straightforward and accessible to all users. Yet, there is no harm in learning about new things and commands in Linux. By eliminating obsolete or unnecessary repositories, you may be sure of a seamless and error-free update of the Ubuntu operating system.

Добавить комментарий

Ваш адрес email не будет опубликован. Обязательные поля помечены *