mirror of
https://github.com/LCTT/TranslateProject.git
synced 2024-12-26 21:30:55 +08:00
translated
This commit is contained in:
parent
6db0394a7b
commit
b000f2806e
@ -1,223 +0,0 @@
|
|||||||
[#]: subject: "How to Remove Software Repositories from Ubuntu"
|
|
||||||
[#]: via: "https://itsfoss.com/remove-software-repositories-ubuntu/"
|
|
||||||
[#]: author: "Sagar Sharma https://itsfoss.com/author/sagar/"
|
|
||||||
[#]: collector: "lkxed"
|
|
||||||
[#]: translator: "geekpi"
|
|
||||||
[#]: reviewer: " "
|
|
||||||
[#]: publisher: " "
|
|
||||||
[#]: url: " "
|
|
||||||
|
|
||||||
How to Remove Software Repositories from Ubuntu
|
|
||||||
======
|
|
||||||
|
|
||||||
You can [add external repositories in Ubuntu][1] to access packages unavailable in the official repositories.
|
|
||||||
|
|
||||||
For example, if you [install Brave browser in Ubuntu][2], you add its repository to your system. If you add a PPA, that is added as an external repository too.
|
|
||||||
|
|
||||||
When you don't need the specific software, you remove it. However, the external repository is still added. You can, and you should also remove it to keep your system pristine.
|
|
||||||
|
|
||||||
Ubuntu lets you remove a software repository easily. There are different ways to do that:
|
|
||||||
|
|
||||||
- **Using apt-add-repository command to remove the repository**
|
|
||||||
- **Using GUI to remove the repository (for desktop users)**
|
|
||||||
- **By modifying the file contents of the /etc/apt/sources.list file (for experts)**
|
|
||||||
|
|
||||||
But before that, I highly advise [getting familiar with the concept of package managers][3] and repositories if you are new to this concept.
|
|
||||||
|
|
||||||
### Method 1. Remove the repository using apt 🤖
|
|
||||||
|
|
||||||
Did you know you can also use the [apt command][4] to remove repositories? Well, technically, it's not part of the core apt command but it works in similar fashion.
|
|
||||||
|
|
||||||
You can use the `add-apt-repository` or `apt-add-repository` commands (both represent the same command) while dealing with external repositories.
|
|
||||||
|
|
||||||
First, list the added repositories using the following command:
|
|
||||||
|
|
||||||
```
|
|
||||||
apt-add-repository --list
|
|
||||||
```
|
|
||||||
|
|
||||||
![list enabled repositories in Ubuntu][5]
|
|
||||||
|
|
||||||
Once done, you can use the apt-add-repository command with the `-r` flag in shown manner to remove the directory:
|
|
||||||
|
|
||||||
```
|
|
||||||
sudo apt-add-repository -r repo_name
|
|
||||||
```
|
|
||||||
|
|
||||||
For example, if I want to remove the **yarn** repository, I would have to use the following command:
|
|
||||||
|
|
||||||
```
|
|
||||||
sudo add-apt-repository -r deb https://dl.yarnpkg.com/debian/ stable main
|
|
||||||
```
|
|
||||||
|
|
||||||
![Remove repository using the apt-add-repository command in Ubuntu][6]
|
|
||||||
|
|
||||||
Press the **Enter** key for confirmation.
|
|
||||||
|
|
||||||
Next, update the repositories using the following:
|
|
||||||
|
|
||||||
```
|
|
||||||
sudo apt update
|
|
||||||
```
|
|
||||||
|
|
||||||
And now, if you list enabled repositories, you won't find the removed repository here:
|
|
||||||
|
|
||||||
```
|
|
||||||
apt-add-repository --list
|
|
||||||
```
|
|
||||||
|
|
||||||
![confirm repository removal process by listing enabled repositories in Ubuntu][7]
|
|
||||||
|
|
||||||
There you have it!
|
|
||||||
|
|
||||||
### Method 2. Remove the software repository in Ubuntu using GUI 🖥️
|
|
||||||
|
|
||||||
> 🚧 Removing a repository you know nothing about is not recommended as it may restrict you from installing your favorite package in the future, so make sure you know what you are up to.
|
|
||||||
|
|
||||||
Being [one of the best distros for beginners,][8] You can use GUI to remove the repository without needing the terminal.
|
|
||||||
|
|
||||||
To do so, first, open the software and updates the app from the system menu:
|
|
||||||
|
|
||||||
![search for software and updates from the system menu][9]
|
|
||||||
|
|
||||||
Now, click on `Other Software` section, and it will list PPAs and external repositories in your system.
|
|
||||||
|
|
||||||
The ones listed as checked ✅ are enabled ones.
|
|
||||||
|
|
||||||
To remove a repository, you'd have to follow **three simple steps**:
|
|
||||||
|
|
||||||
- **Select a repository that needs to be removed**
|
|
||||||
- **Click on the remove button**
|
|
||||||
- **And finally, hit the close button**
|
|
||||||
|
|
||||||
![Disable repository from Ubuntu][10]
|
|
||||||
|
|
||||||
Once you click on the close button, it will open a prompt asking you to update the information as you make changes.
|
|
||||||
|
|
||||||
Simply click on the `Reload` button:
|
|
||||||
|
|
||||||
![Click on reload to after removing repository from Ubuntu and save changes][11]
|
|
||||||
|
|
||||||
Alternatively, you can update the repository from the command line to take effect from the changes:
|
|
||||||
|
|
||||||
```
|
|
||||||
sudo apt update
|
|
||||||
```
|
|
||||||
|
|
||||||
### Method 3. Remove the repository by removing its directory (for experts 🧑💻)
|
|
||||||
|
|
||||||
Previously, I explained how you could use tools (GUI and CLI) to remove a repository; here, you will modify the system directory (**/etc/apt/sources.list.d**) responsible for managing repositories.
|
|
||||||
|
|
||||||
So first, change your working directory to `sources.list.d` and list its contents:
|
|
||||||
|
|
||||||
```
|
|
||||||
cd /etc/apt/sources.list.d/ && ls
|
|
||||||
```
|
|
||||||
|
|
||||||
![list contents of sources.list.d directory][12]
|
|
||||||
|
|
||||||
Here, you will find the list of all the repositories.
|
|
||||||
|
|
||||||
If you notice carefully, there will be two files for one repo. Once with the `.list` extension and one with the `.save` extension.
|
|
||||||
|
|
||||||
You will have to remove the one having the `.list` extension:
|
|
||||||
|
|
||||||
```
|
|
||||||
sudo rm Repo_name.list
|
|
||||||
```
|
|
||||||
|
|
||||||
For example, here, I removed the **node repo** using the command below:
|
|
||||||
|
|
||||||
```
|
|
||||||
sudo rm nodesource.list
|
|
||||||
```
|
|
||||||
|
|
||||||
![remove repository by removing the repository directory in Ubuntu][13]
|
|
||||||
|
|
||||||
To take effect from the changes, update the repository index with:
|
|
||||||
|
|
||||||
```
|
|
||||||
sudo apt update
|
|
||||||
```
|
|
||||||
|
|
||||||
Want to know more about the [sources.list][14]? Read this article.
|
|
||||||
|
|
||||||
### Additional Step: Remove GPG keys after removing the repository (for advanced users)
|
|
||||||
|
|
||||||
If you wish to remove the GPG keys after removing the repository, here's how you do it.
|
|
||||||
|
|
||||||
First, list the existing GPG keys using the following command:
|
|
||||||
|
|
||||||
```
|
|
||||||
apt-key list
|
|
||||||
```
|
|
||||||
|
|
||||||
Now, the output may seem confusing to some users.
|
|
||||||
|
|
||||||
Here's what to remember:
|
|
||||||
|
|
||||||
- The GPG key name will be placed above the dashed line (----)
|
|
||||||
- The public key is in the second line
|
|
||||||
|
|
||||||
For example, here's the relevant data of the Chrome GPG key:
|
|
||||||
|
|
||||||
![list GPG keys in Ubuntu][15]
|
|
||||||
|
|
||||||
To remove the GPG key, you can use the last two strings of the public key (without any space).
|
|
||||||
|
|
||||||
For example, here's how I will remove the GPG key of the Chrome browser using the last two strings of its public key (D38B 4796):
|
|
||||||
|
|
||||||
```
|
|
||||||
sudo apt-key del D38B4796
|
|
||||||
```
|
|
||||||
|
|
||||||
![remove GPG key in Ubuntu][16]
|
|
||||||
|
|
||||||
Similarly, you can also use the entire public key. But this time, you have to include spaces between two strings, as shown:
|
|
||||||
|
|
||||||
```
|
|
||||||
sudo apt-key del "72EC F46A 56B4 AD39 C907 BBB7 1646 B01B 86E5 0310"
|
|
||||||
```
|
|
||||||
|
|
||||||
### Careful with what you add and what you remove
|
|
||||||
|
|
||||||
Especially when you are a new Linux user, you will encounter many exciting things and repositories you will add and remove.
|
|
||||||
|
|
||||||
While it is good to experiment, you should always be careful about anything you add/remove to your system. You should keep some things in mind, like: _Does it include updated packages? Is it a trusted or maintained repository?_
|
|
||||||
|
|
||||||
Being cautious will keep your system free from unnecessary repositories and packages.
|
|
||||||
|
|
||||||
**I hope this guide helps you remove the repository you do not want!**
|
|
||||||
|
|
||||||
_Feel free to let me know if you face any issues in the comments below, and consider joining our [It's FOSS Community forum][17] to get faster help!_
|
|
||||||
|
|
||||||
--------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
via: https://itsfoss.com/remove-software-repositories-ubuntu/
|
|
||||||
|
|
||||||
作者:[Sagar Sharma][a]
|
|
||||||
选题:[lkxed][b]
|
|
||||||
译者:[译者ID](https://github.com/译者ID)
|
|
||||||
校对:[校对者ID](https://github.com/校对者ID)
|
|
||||||
|
|
||||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
|
||||||
|
|
||||||
[a]: https://itsfoss.com/author/sagar/
|
|
||||||
[b]: https://github.com/lkxed/
|
|
||||||
[1]: https://itsfoss.com/adding-external-repositories-ubuntu/
|
|
||||||
[2]: https://itsfoss.com/brave-web-browser/
|
|
||||||
[3]: https://itsfoss.com/package-manager/
|
|
||||||
[4]: https://itsfoss.com/apt-command-guide/
|
|
||||||
[5]: https://itsfoss.com/content/images/2023/06/list-enabled-repositories-in-Ubuntu.png
|
|
||||||
[6]: https://itsfoss.com/content/images/2023/06/Remove-repository-using-the-apt-add-repository-command-in-Ubuntu.png
|
|
||||||
[7]: https://itsfoss.com/content/images/2023/06/confirm-repository-removal-process-by-listing-enabled-repositories-in-Ubuntu.png
|
|
||||||
[8]: https://itsfoss.com/best-linux-beginners/
|
|
||||||
[9]: https://itsfoss.com/content/images/2023/06/search-for-software-and-updates-from-the-system-menu.png
|
|
||||||
[10]: https://itsfoss.com/content/images/2023/06/remove-the-repository-from-Ubuntu-using-GUI-1.png
|
|
||||||
[11]: https://itsfoss.com/content/images/2023/06/Click-on-reload-to-after-removing-repository-from-Ubuntu-and-save-changes.png
|
|
||||||
[12]: https://itsfoss.com/content/images/2023/06/list-contents-of-sources.list.d-directory.png
|
|
||||||
[13]: https://itsfoss.com/content/images/2023/06/remove-repository-by-removing-the-repository-directory-in-Ubuntu.png
|
|
||||||
[14]: https://itsfoss.com/sources-list-ubuntu/
|
|
||||||
[15]: https://itsfoss.com/content/images/2023/06/list-GPG-keys-in-Ubuntu.png
|
|
||||||
[16]: https://itsfoss.com/content/images/2023/06/remove-GPG-key-in-Ubuntu.png
|
|
||||||
[17]: https://itsfoss.community:443/
|
|
@ -0,0 +1,223 @@
|
|||||||
|
[#]: subject: "How to Remove Software Repositories from Ubuntu"
|
||||||
|
[#]: via: "https://itsfoss.com/remove-software-repositories-ubuntu/"
|
||||||
|
[#]: author: "Sagar Sharma https://itsfoss.com/author/sagar/"
|
||||||
|
[#]: collector: "lkxed"
|
||||||
|
[#]: translator: "geekpi"
|
||||||
|
[#]: reviewer: " "
|
||||||
|
[#]: publisher: " "
|
||||||
|
[#]: url: " "
|
||||||
|
|
||||||
|
如何从 Ubuntu 中删除软件仓库
|
||||||
|
======
|
||||||
|
|
||||||
|
你可以[在 Ubuntu 中添加外部仓库][1]来访问官方仓库中不可用的软件包。
|
||||||
|
|
||||||
|
例如,如果你[在 Ubuntu 中安装 Brave 浏览器][2],则将其仓库添加到你的系统中。如果你添加 PPA,它也会添加为外部仓库。
|
||||||
|
|
||||||
|
当你不需要特定软件时,请将其删除。但是,仍然添加了外部仓库。你还可以也应该将其删除以保持系统原始状态。
|
||||||
|
|
||||||
|
Ubuntu 可以让你轻松删除软件仓库。有不同的方法可以做到这一点:
|
||||||
|
|
||||||
|
- **使用 apt-add-repository 命令删除仓库**
|
||||||
|
- **使用 GUI 删除仓库(对于桌面用户)**
|
||||||
|
- **通过修改 /etc/apt/sources.list 文件的文件内容(针对专家)**
|
||||||
|
|
||||||
|
但在此之前,如果你对这个概念不熟悉,我强烈建议你[熟悉包管理器的概念][3]和仓库。
|
||||||
|
|
||||||
|
### 方法 1. 使用 apt 删除仓库🤖
|
||||||
|
|
||||||
|
你知道你还可以使用 [apt 命令][4]来删除仓库吗? 嗯,从技术上讲,它不是核心 apt 命令的一部分,但它的工作方式类似。
|
||||||
|
|
||||||
|
在处理外部仓库时,你可以使用 `add-apt-repository` 或者 `apt-add-repository` 命令(两者代表相同的命令)。
|
||||||
|
|
||||||
|
首先,使用以下命令列出添加的仓库:
|
||||||
|
|
||||||
|
```
|
||||||
|
apt-add-repository --list
|
||||||
|
```
|
||||||
|
|
||||||
|
![list enabled repositories in Ubuntu][5]
|
||||||
|
|
||||||
|
完成后,你可以按所示方式使用带有 `-r` 标志的 apt-add-repository 命令来删除目录:
|
||||||
|
|
||||||
|
```
|
||||||
|
sudo apt-add-repository -r repo_name
|
||||||
|
```
|
||||||
|
|
||||||
|
例如,如果我想删除 **yarn** 仓库,我必须使用以下命令:
|
||||||
|
|
||||||
|
```
|
||||||
|
sudo add-apt-repository -r deb https://dl.yarnpkg.com/debian/ stable main
|
||||||
|
```
|
||||||
|
|
||||||
|
![Remove repository using the apt-add-repository command in Ubuntu][6]
|
||||||
|
|
||||||
|
按**回车**键进行确认。
|
||||||
|
|
||||||
|
接下来,使用以下命令更新仓库:
|
||||||
|
|
||||||
|
```
|
||||||
|
sudo apt update
|
||||||
|
```
|
||||||
|
|
||||||
|
现在,如果你列出已启用的仓库,你将不会在此处找到已删除的仓库:
|
||||||
|
|
||||||
|
```
|
||||||
|
apt-add-repository --list
|
||||||
|
```
|
||||||
|
|
||||||
|
![confirm repository removal process by listing enabled repositories in Ubuntu][7]
|
||||||
|
|
||||||
|
这就完成了!
|
||||||
|
|
||||||
|
### 方法 2. 使用 GUI 删除 Ubuntu 中的软件仓库🖥️
|
||||||
|
|
||||||
|
> 🚧 不建议删除你一无所知的仓库,因为它可能会限制你将来安装你最喜欢的软件包,因此请确保你知道自己在做什么。
|
||||||
|
|
||||||
|
作为[最适合初学者的发行版之一][8],你可以使用 GUI 来删除仓库,而无需使用终端。
|
||||||
|
|
||||||
|
为此,首先打开软件并从系统菜单更新应用:
|
||||||
|
|
||||||
|
![search for software and updates from the system menu][9]
|
||||||
|
|
||||||
|
现在,单击“其他软件”部分,它将列出系统中的 PPA 和外部仓库。
|
||||||
|
|
||||||
|
列出中勾选的 ✅ 是已启用的。
|
||||||
|
|
||||||
|
要删除仓库,你必须遵循**三个简单的步骤**:
|
||||||
|
|
||||||
|
- **选择需要删除的仓库**
|
||||||
|
- **点击删除按钮**
|
||||||
|
- **最后,点击关闭按钮**
|
||||||
|
|
||||||
|
![Disable repository from Ubuntu][10]
|
||||||
|
|
||||||
|
单击关闭按钮后,它将打开一个提示,要求你在进行更改时更新信息。
|
||||||
|
|
||||||
|
只需单击 `Reload` 按钮即可:
|
||||||
|
|
||||||
|
![Click on reload to after removing repository from Ubuntu and save changes][11]
|
||||||
|
|
||||||
|
或者,你可以从命令行更新仓库以使更改生效:
|
||||||
|
|
||||||
|
```
|
||||||
|
sudo apt update
|
||||||
|
```
|
||||||
|
|
||||||
|
### 方法 3. 通过删除目录来删除仓库(对于专家🧑💻)
|
||||||
|
|
||||||
|
之前,我解释了如何使用工具(GUI 和 CLI)来删除仓库。在这里,你将修改负责管理仓库的系统目录(**/etc/apt/sources.list.d**)。
|
||||||
|
|
||||||
|
首先,将工作目录更改为 `sources.list.d` 并列出其内容:
|
||||||
|
|
||||||
|
```
|
||||||
|
cd /etc/apt/sources.list.d/ && ls
|
||||||
|
```
|
||||||
|
|
||||||
|
![list contents of sources.list.d directory][12]
|
||||||
|
|
||||||
|
在这里,你将找到所有仓库的列表。
|
||||||
|
|
||||||
|
如果你仔细观察,一个仓库将有两个文件。一个带有 `.list` 扩展名,另一个带有 `.save` 扩展名。
|
||||||
|
|
||||||
|
你必须删除具有 `.list` 扩展名的文件:
|
||||||
|
|
||||||
|
```
|
||||||
|
sudo rm Repo_name.list
|
||||||
|
```
|
||||||
|
|
||||||
|
例如,在这里,我使用以下命令删除了 **node 仓库**:
|
||||||
|
|
||||||
|
```
|
||||||
|
sudo rm nodesource.list
|
||||||
|
```
|
||||||
|
|
||||||
|
![remove repository by removing the repository directory in Ubuntu][13]
|
||||||
|
|
||||||
|
要使更改生效,请使用以下命令更新仓库索引:
|
||||||
|
|
||||||
|
```
|
||||||
|
sudo apt update
|
||||||
|
```
|
||||||
|
|
||||||
|
想了解更多有关 [sources.list][14] 的信息吗? 阅读这篇文章。
|
||||||
|
|
||||||
|
### 附加步骤:删除仓库后删除 GPG 密钥(对于高级用户)
|
||||||
|
|
||||||
|
如果你希望在删除仓库后删除 GPG 密钥,请按以下步骤操作。
|
||||||
|
|
||||||
|
首先,使用以下命令列出现有的 GPG 密钥:
|
||||||
|
|
||||||
|
```
|
||||||
|
apt-key list
|
||||||
|
```
|
||||||
|
|
||||||
|
现在,输出可能会让某些用户感到困惑。
|
||||||
|
|
||||||
|
以下是要记住的事情:
|
||||||
|
|
||||||
|
- GPG 密钥名称将放置在虚线 (----) 上方
|
||||||
|
- 公钥在第二行
|
||||||
|
|
||||||
|
例如,以下是Chrome GPG密钥的相关数据:
|
||||||
|
|
||||||
|
![list GPG keys in Ubuntu][15]
|
||||||
|
|
||||||
|
要删除 GPG 密钥,你可以使用公钥的最后两个字符串(不带任何空格)。
|
||||||
|
|
||||||
|
例如,以下是我将如何使用 Chrome 浏览器公钥的最后两个字符串 (D38B 4796) 删除其 GPG 密钥:
|
||||||
|
|
||||||
|
```
|
||||||
|
sudo apt-key del D38B4796
|
||||||
|
```
|
||||||
|
|
||||||
|
![remove GPG key in Ubuntu][16]
|
||||||
|
|
||||||
|
同样,你也可以使用整个公钥。但这一次,你必须在两个字符串之间包含空格,如下所示:
|
||||||
|
|
||||||
|
```
|
||||||
|
sudo apt-key del "72EC F46A 56B4 AD39 C907 BBB7 1646 B01B 86E5 0310"
|
||||||
|
```
|
||||||
|
|
||||||
|
### 小心添加和删除的内容
|
||||||
|
|
||||||
|
特别是当你是 Linux 新用户时,你会遇到许多令人兴奋的事情以及你将添加和删除的仓库。
|
||||||
|
|
||||||
|
虽然尝试是件好事,但你应该始终小心添加/删除到系统中的任何内容。你应该记住一些事情,例如:_它包含更新的软件包吗? 它是受信任或维护的仓库吗?_
|
||||||
|
|
||||||
|
保持谨慎将使你的系统免受不必要的仓库和软件包的影响。
|
||||||
|
|
||||||
|
**我希望本指南可以帮助你删除不需要的仓库!**
|
||||||
|
|
||||||
|
_如果你在下面的评论中遇到任何问题,请随时告诉我,并考虑加入我们的 [It's FOSS 社区论坛][17]以获得更快的帮助!_
|
||||||
|
|
||||||
|
--------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
via: https://itsfoss.com/remove-software-repositories-ubuntu/
|
||||||
|
|
||||||
|
作者:[Sagar Sharma][a]
|
||||||
|
选题:[lkxed][b]
|
||||||
|
译者:[geekpi](https://github.com/geekpi)
|
||||||
|
校对:[校对者ID](https://github.com/校对者ID)
|
||||||
|
|
||||||
|
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||||
|
|
||||||
|
[a]: https://itsfoss.com/author/sagar/
|
||||||
|
[b]: https://github.com/lkxed/
|
||||||
|
[1]: https://itsfoss.com/adding-external-repositories-ubuntu/
|
||||||
|
[2]: https://itsfoss.com/brave-web-browser/
|
||||||
|
[3]: https://itsfoss.com/package-manager/
|
||||||
|
[4]: https://itsfoss.com/apt-command-guide/
|
||||||
|
[5]: https://itsfoss.com/content/images/2023/06/list-enabled-repositories-in-Ubuntu.png
|
||||||
|
[6]: https://itsfoss.com/content/images/2023/06/Remove-repository-using-the-apt-add-repository-command-in-Ubuntu.png
|
||||||
|
[7]: https://itsfoss.com/content/images/2023/06/confirm-repository-removal-process-by-listing-enabled-repositories-in-Ubuntu.png
|
||||||
|
[8]: https://itsfoss.com/best-linux-beginners/
|
||||||
|
[9]: https://itsfoss.com/content/images/2023/06/search-for-software-and-updates-from-the-system-menu.png
|
||||||
|
[10]: https://itsfoss.com/content/images/2023/06/remove-the-repository-from-Ubuntu-using-GUI-1.png
|
||||||
|
[11]: https://itsfoss.com/content/images/2023/06/Click-on-reload-to-after-removing-repository-from-Ubuntu-and-save-changes.png
|
||||||
|
[12]: https://itsfoss.com/content/images/2023/06/list-contents-of-sources.list.d-directory.png
|
||||||
|
[13]: https://itsfoss.com/content/images/2023/06/remove-repository-by-removing-the-repository-directory-in-Ubuntu.png
|
||||||
|
[14]: https://itsfoss.com/sources-list-ubuntu/
|
||||||
|
[15]: https://itsfoss.com/content/images/2023/06/list-GPG-keys-in-Ubuntu.png
|
||||||
|
[16]: https://itsfoss.com/content/images/2023/06/remove-GPG-key-in-Ubuntu.png
|
||||||
|
[17]: https://itsfoss.community:443/
|
Loading…
Reference in New Issue
Block a user