如何在 Ubuntu 18.04 中添加或删除 PPA

[ad_1]

什么是 PPA?

PPA(或个人软件包存档)是由 Ubuntu Linux 社区成员提供的软件存储库。 PPA 中包含的软件可以通过 apt(Ubuntu 的默认包管理系统)下载和安装。

通常,PPA 将包含现有软件包的新软件或更新软件,这些软件包可能无法从官方 Ubuntu 软件包存储库中获得。 这使用户可以更精细地控制何时在其系统上更新特定软件包。 重要的是在使用 PPA 时辨别并仅添加来自可信来源的 PPA。

通过 PPA 添加软件的最佳原因是服务器将在运行更新时自动更新已安装的软件。

预检

  • 这些说明专门用于在 Ubuntu 18.04 上添加和删除 PPA。
  • 本教程以 root 用户身份在 Liquid Web 自我管理的 Ubuntu 18.04 LTS 服务器上执行。

句法

添加或删除 PPA 的命令行语法如下。

Add - [email protected]:~# apt-add-repository ppa:ppa/name
Remove - [email protected]:~# apt-add-repository --remove ppa:ppa/name

添加 PPA

Ubuntu 18.04 默认配备 Python 3.6。 出于本教程的目的,我们将要安装 Python 3.8。 为此,请运行以下命令以添加包含为 Ubuntu 构建的 Debian 软件包的 PPA:

[email protected]:~# add-apt-repository ppa:deadsnakes/ppa -y
Get:1 https://security.ubuntu.com/ubuntu bionic-security InRelease [88.7 kB]
Hit:2 https://dl.yarnpkg.com/debian stable InRelease
Hit:3 https://us.archive.ubuntu.com/ubuntu bionic InRelease
Get:4 https://us.archive.ubuntu.com/ubuntu bionic-updates InRelease [88.7 kB]
Get:5 https://ppa.launchpad.net/deadsnakes/ppa/ubuntu bionic InRelease [15.9 kB]
Hit:6 https://download.virtualbox.org/virtualbox/debian bionic InRelease
Get:7 https://us.archive.ubuntu.com/ubuntu bionic-backports InRelease [74.6 kB]
Get:8 https://security.ubuntu.com/ubuntu bionic-security/main amd64 Packages [709 kB]
Get:9 https://us.archive.ubuntu.com/ubuntu bionic-updates/main amd64 Packages [932 kB]
Get:10 https://security.ubuntu.com/ubuntu bionic-security/main i386 Packages [466 kB]
Get:11 https://security.ubuntu.com/ubuntu bionic-security/universe i386 Packages [621 kB]
Get:12 https://security.ubuntu.com/ubuntu bionic-security/universe amd64 Packages [662 kB]
Get:13 https://us.archive.ubuntu.com/ubuntu bionic-updates/main i386 Packages [675 kB]
Get:14 https://us.archive.ubuntu.com/ubuntu bionic-updates/universe i386 Packages [1014 kB]
Get:15 https://us.archive.ubuntu.com/ubuntu bionic-updates/universe amd64 Packages [1069 kB]
Get:16 https://ppa.launchpad.net/deadsnakes/ppa/ubuntu bionic/main i386 Packages [30.7 kB]
Get:17 https://ppa.launchpad.net/deadsnakes/ppa/ubuntu bionic/main amd64 Packages [30.7 kB]
Get:18 https://ppa.launchpad.net/deadsnakes/ppa/ubuntu bionic/main Translation-en [7064 B]
Fetched 6484 kB in 2s (4261 kB/s)
Reading package lists... Done
[email protected]:~#

从 Ubuntu 18.04 开始,运行 add-apt-repository 命令可以方便地包含 apt-update,如您在上面的输出中所见。 现在已经添加了 PPA,可以使用以下命令安装 Python 3.8。 (我们使用 -y 标志来自动接受任何安装提示。)

[email protected]:~# apt install python3.8 -y
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following additional packages will be installed:
  libpython3.8-minimal libpython3.8-stdlib python3.8-minimal
Suggested packages:
  python3.8-venv python3.8-doc binfmt-support
The following NEW packages will be installed:
  libpython3.8-minimal libpython3.8-stdlib python3.8 python3.8-minimal
0 upgraded, 4 newly installed, 0 to remove and 166 not upgraded.
Need to get 4740 kB of archives.
After this operation, 18.6 MB of additional disk space will be used.
Get:1 https://ppa.launchpad.net/deadsnakes/ppa/ubuntu bionic/main amd64 libpython3.8-minimal amd64 3.8.2-1+bionic1 [751 kB]
Get:2 https://ppa.launchpad.net/deadsnakes/ppa/ubuntu bionic/main amd64 python3.8-minimal amd64 3.8.2-1+bionic1 [1886 kB]
Get:3 https://ppa.launchpad.net/deadsnakes/ppa/ubuntu bionic/main amd64 libpython3.8-stdlib amd64 3.8.2-1+bionic1 [1694 kB]
Get:4 https://ppa.launchpad.net/deadsnakes/ppa/ubuntu bionic/main amd64 python3.8 amd64 3.8.2-1+bionic1 [409 kB]
Fetched 4740 kB in 3s (1425 kB/s)
Selecting previously unselected package libpython3.8-minimal:amd64.
(Reading database ... 150173 files and directories currently installed.)
Preparing to unpack .../libpython3.8-minimal_3.8.2-1+bionic1_amd64.deb ...
Unpacking libpython3.8-minimal:amd64 (3.8.2-1+bionic1) ...
Selecting previously unselected package python3.8-minimal.
Preparing to unpack .../python3.8-minimal_3.8.2-1+bionic1_amd64.deb ...
Unpacking python3.8-minimal (3.8.2-1+bionic1) ...
Selecting previously unselected package libpython3.8-stdlib:amd64.
Preparing to unpack .../libpython3.8-stdlib_3.8.2-1+bionic1_amd64.deb ...
Unpacking libpython3.8-stdlib:amd64 (3.8.2-1+bionic1) ...
Selecting previously unselected package python3.8.
Preparing to unpack .../python3.8_3.8.2-1+bionic1_amd64.deb ...
Unpacking python3.8 (3.8.2-1+bionic1) ...
Setting up libpython3.8-minimal:amd64 (3.8.2-1+bionic1) ...
Setting up python3.8-minimal (3.8.2-1+bionic1) ...
Setting up libpython3.8-stdlib:amd64 (3.8.2-1+bionic1) ...
Setting up python3.8 (3.8.2-1+bionic1) ...
Processing triggers for mime-support (3.60ubuntu1) ...
Processing triggers for man-db (2.8.3-2ubuntu0.1) ...
[email protected]:~#

删除 PPA

现在安装了 Python 3.8,为了删除 PPA,我们将运行以下命令。

[email protected]:~# add-apt-repository --remove ppa:deadsnakes/ppa -y
[email protected]:~#

注意:上面的 PPA 去除方法只会去除 PPA。 通过该 PPA 安装的软件包将继续安装在系统上,您将不再收到来自该 PPA 的更新。 此外,如果您要删除通过 PPA 安装的应用程序,请确保在删除 PPA 之前使用“apt remove packagename”命令删除软件本身。

要查看系统上当前启用了哪些 PPA,您可以在 /etc/apt/sources.list 文件。

[email protected]:~# cat /etc/apt/sources.list

#

# deb cdrom:[Ubuntu-Server 18.04 LTS _Bionic Beaver_ - Beta amd64 (20180404)]/ bionic main restricted

# deb cdrom:[Ubuntu-Server 18.04 LTS _Bionic Beaver_ - Beta amd64 (20180404)]/ bionic main restricted

# See https://help.ubuntu.com/community/UpgradeNotes for how to upgrade to
# newer versions of the distribution.
deb https://us.archive.ubuntu.com/ubuntu/ bionic main restricted
# deb-src https://us.archive.ubuntu.com/ubuntu/ bionic main restricted

## Major bug fix updates produced after the final release of the
## distribution.
deb https://us.archive.ubuntu.com/ubuntu/ bionic-updates main restricted
# deb-src https://us.archive.ubuntu.com/ubuntu/ bionic-updates main restricted

## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu
## team. Also, please note that software in universe WILL NOT receive any
## review or updates from the Ubuntu security team.
deb https://us.archive.ubuntu.com/ubuntu/ bionic universe
# deb-src https://us.archive.ubuntu.com/ubuntu/ bionic universe
deb https://us.archive.ubuntu.com/ubuntu/ bionic-updates universe
# deb-src https://us.archive.ubuntu.com/ubuntu/ bionic-updates universe

## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu
## team, and may not be under a free licence. Please satisfy yourself as to
## your rights to use the software. Also, please note that software in
## multiverse WILL NOT receive any review or updates from the Ubuntu
## security team.
deb https://us.archive.ubuntu.com/ubuntu/ bionic multiverse
# deb-src https://us.archive.ubuntu.com/ubuntu/ bionic multiverse
deb https://us.archive.ubuntu.com/ubuntu/ bionic-updates multiverse
# deb-src https://us.archive.ubuntu.com/ubuntu/ bionic-updates multiverse

## N.B. software from this repository may not have been tested as
## extensively as that contained in the main release, although it includes
## newer versions of some applications which may provide useful features.
## Also, please note that software in backports WILL NOT receive any review
## or updates from the Ubuntu security team.
deb https://us.archive.ubuntu.com/ubuntu/ bionic-backports main restricted universe multiverse
# deb-src https://us.archive.ubuntu.com/ubuntu/ bionic-backports main restricted universe multiverse

## Uncomment the following two lines to add software from Canonical's
## 'partner' repository.
## This software is not part of Ubuntu, but is offered by Canonical and the
## respective vendors as a service to Ubuntu users.
# deb https://archive.canonical.com/ubuntu bionic partner
# deb-src https://archive.canonical.com/ubuntu bionic partner

deb https://security.ubuntu.com/ubuntu bionic-security main restricted
# deb-src https://security.ubuntu.com/ubuntu bionic-security main restricted
deb https://security.ubuntu.com/ubuntu bionic-security universe
# deb-src https://security.ubuntu.com/ubuntu bionic-security universe
deb https://security.ubuntu.com/ubuntu bionic-security multiverse
deb https://download.virtualbox.org/virtualbox/debian bionic contrib
# deb-src https://download.virtualbox.org/virtualbox/debian bionic contrib
# deb-src https://security.ubuntu.com/ubuntu bionic-security multiverse
[email protected]:~#

无论官方 Ubuntu 软件包存储库中提供了什么,PPA 都可以保持在各种软件包的最前沿。 此选项有多种用途,包括持续开发。 为了使项目保持最新状态,可能有必要拉下某些依赖项的最新版本,以验证事情是否按预期工作。

如果您想安装新的 PPA 或在删除 PPA 时遇到问题,请拨打 800.580.4985 给我们打电话,或打开一个 聊天 或与我们联系,与我们知识渊博的 Linux 系统管理员之一交谈,今天为您提供帮助!

[ad_2]

Related Posts