自拍偷在线精品自拍偷,亚洲欧美中文日韩v在线观看不卡

如何從 Ubuntu 中刪除軟件倉庫

系統(tǒng) Linux
從 apt-add-repository 到“軟件及更新”工具,這里有幾種從 Ubuntu 移除軟件倉庫的方法。

你可以 在 Ubuntu 中添加外部倉庫 來訪問官方倉庫中不可用的軟件包。

例如,如果你 在 Ubuntu 中安裝 Brave 瀏覽器,則將其倉庫添加到你的系統(tǒng)中。如果你添加了一個 PPA,它也會添加為外部倉庫。

當(dāng)你不需要特定軟件時,請將其刪除。但是,外部倉庫仍然存在。你還可以也應(yīng)該將其刪除以保持系統(tǒng)原始狀態(tài)。

Ubuntu 可以讓你輕松刪除軟件倉庫。有不同的方法可以做到這一點:

  • 使用 apt-add-repository 命令刪除倉庫
  • 使用 GUI 刪除倉庫(對于桌面用戶)
  • 通過修改 /etc/apt/sources.list 文件的文件內(nèi)容(針對專家)

但在此之前,如果你對這個概念不熟悉,我強烈建議你 熟悉包管理器的概念 和倉庫。

方法 1、使用 apt 刪除倉庫??

你知道你還可以使用 apt 命令 來刪除倉庫嗎? 嗯,從技術(shù)上講,它不是核心 apt 命令的一部分,但它的工作方式類似。

在處理外部倉庫時,你可以使用 add-apt-repository 或者 apt-add-repository 命令(兩者是同一命令)。

首先,使用以下命令列出添加的倉庫:

apt-add-repository --list

list enabled repositories in Ubuntulist enabled repositories in Ubuntu

完成后,你可以按所示方式使用帶有 -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 UbuntuRemove repository using the apt-add-repository command in Ubuntu

按回車鍵進行確認。

接下來,使用以下命令更新倉庫:

sudo apt update

現(xiàn)在,如果你列出已啟用的倉庫,你將不會在此處找到已刪除的倉庫:

apt-add-repository --list

confirm repository removal process by listing enabled repositories in Ubuntuconfirm repository removal process by listing enabled repositories in Ubuntu

這就完成了!

方法 2、使用 GUI 刪除 Ubuntu 中的軟件倉庫???

?? 不建議刪除你一無所知的倉庫,因為它可能會限制你將來安裝你最喜歡的軟件包,因此請確保你知道自己在做什么。

作為 最適合初學(xué)者的發(fā)行版之一,你可以使用 GUI 來刪除倉庫,而無需使用終端。

為此,首先從系統(tǒng)菜單打開“軟件及更新software & updates”應(yīng)用:

search for software and updates from the system menusearch for software and updates from the system menu

現(xiàn)在,單擊“其他軟件Other Software”部分,它將列出系統(tǒng)中的 PPA 和外部倉庫。

列出中勾選的 ? 是已啟用的。

要刪除倉庫,你必須遵循三個簡單的步驟

  • 選擇需要刪除的倉庫
  • 點擊“刪除Remove”按鈕
  • 最后,點擊“關(guān)閉Close”按鈕

Disable repository from UbuntuDisable repository from Ubuntu

單擊關(guān)閉按鈕后,它將打開一個提示,要求你在進行更改時更新信息。

只需單擊 “重新載入Reload” 按鈕即可:

Click on reload to after removing repository from Ubuntu and save changesClick on reload to after removing repository from Ubuntu and save changes

或者,你可以從命令行更新倉庫以使更改生效:

sudo apt update

方法 3、通過目錄來刪除倉庫(對于專家????)

之前,我解釋了如何使用工具(GUI 和 CLI)來刪除倉庫。在這里,你將修改負責(zé)管理倉庫的系統(tǒng)目錄(/etc/apt/sources.list.d)。

首先,將工作目錄更改為 sources.list.d 并列出其內(nèi)容:

cd /etc/apt/sources.list.d/ && ls

list contents of sources.list.d directorylist contents of sources.list.d directory

在這里,你將找到所有倉庫的列表。

如果你仔細觀察,一個倉庫將有兩個文件。一個帶有 .list 擴展名,另一個帶有 .save 擴展名。

你必須刪除具有 .list 擴展名的文件:

sudo rm Repo_name.list

例如,在這里,我使用以下命令刪除了 node 倉庫

sudo rm nodesource.list

remove repository by removing the repository directory in Ubunturemove repository by removing the repository directory in Ubuntu

要使更改生效,請使用以下命令更新倉庫索引:

sudo apt update

想了解更多有關(guān) sources.list 的信息嗎?閱讀 這篇文章。

附加步驟:刪除倉庫后刪除 GPG 密鑰(對于高級用戶)

如果你希望在刪除倉庫后刪除 GPG 密鑰,請按以下步驟操作。

首先,使用以下命令列出現(xiàn)有的 GPG 密鑰:

apt-key list

現(xiàn)在,輸出可能會讓某些用戶感到困惑。

以下是要記住的事情:

  • GPG 密鑰名稱將放置在虛線(----)上方
  • 公鑰在第二行

例如,以下是 Chrome GPG 密鑰的相關(guān)數(shù)據(jù):

list GPG keys in Ubuntulist GPG keys in Ubuntu

要刪除 GPG 密鑰,你可以使用公鑰的最后兩個字符串(不帶任何空格)。

例如,以下是我將如何使用 Chrome 瀏覽器公鑰的最后兩個字符串(D38B 4796)刪除其 GPG 密鑰:

sudo apt-key del D38B4796

remove GPG key in Ubunturemove GPG key in Ubuntu

同樣,你也可以使用整個公鑰。但這一次,你必須在兩個字符串之間包含空格,如下所示:

sudo apt-key del "72EC F46A 56B4 AD39 C907  BBB7 1646 B01B 86E5 0310"

小心添加和刪除的內(nèi)容

特別是當(dāng)你是 Linux 新用戶時,你會遇到許多感興趣的軟件,對倉庫添加了又刪除。

雖然嘗試是件好事,但你應(yīng)該始終小心添加/刪除到系統(tǒng)中的任何內(nèi)容。你應(yīng)該記住一些事情,例如:它包含更新的軟件包嗎? 它是受信任或維護的倉庫嗎?

保持謹慎將使你的系統(tǒng)免受不必要的倉庫和軟件包的影響。

我希望本指南可以幫助你刪除不需要的倉庫!

責(zé)任編輯:龐桂玉 來源: Linux中國
相關(guān)推薦

2019-07-18 09:20:53

Ubuntu倉庫GPG

2022-11-13 19:46:49

Ubuntu

2019-12-04 09:50:11

Windows 10刪除過時軟件

2022-01-28 08:15:36

UbuntuAPT軟件包

2021-03-26 23:41:19

JavaScript對象開發(fā)

2022-03-18 12:39:57

UbuntuChrome

2023-05-25 14:06:45

ChatGPT人工智能工具

2018-09-06 13:10:12

Windows 10Windows磁盤分區(qū)

2021-10-09 11:10:25

LinuxJavaUbuntu

2020-10-25 17:48:54

LVM系統(tǒng)運維

2023-05-29 15:16:42

2018-08-28 10:10:30

LinuxUbuntuWindows

2015-10-08 14:35:55

書簽UbuntuLinux

2011-09-01 16:11:43

ubuntu消息菜單

2012-12-12 09:49:41

2017-01-12 09:57:04

2019-02-26 15:05:54

Windows 10Internet Ex

2018-08-24 09:20:18

MacWindows 10Boot camp

2011-09-15 11:31:21

linux軟件倉庫

2024-09-26 17:32:24

點贊
收藏

51CTO技術(shù)棧公眾號