0
点赞
收藏
分享

微信扫一扫

如何在 Ubuntu 和 Debian 上修复“找不到 add-apt-repository 命令”

陌岛 2022-02-17 阅读 117

在某些情况下,在 Linux MintLinux LiteZorin OSelementary OS 和其他基于 Ubuntu 的发行版以及 Ubuntu Debian 上,您会看到缺少add-apt-repository命令的错误。

$ sudo: add-apt-repository: command not found

本教程将向您展示如何快速修复 DebianUbuntu 和其他基于 Debian Linux 发行版上的“add-apt-repository command not found”错误。

什么是个人包裹档案

PPA 是个人存储库的 Web URL。存储库是一个文件集合,其中包含有关各种软件、它们的版本和一些其他详细信息(如校验和)的信息。每个 Ubuntu 版本都有自己的官方四个存储库集。

Ubuntu Debian 上安装软件的最常见方法是使用 PPA(个人软件包存档),如果软件包尚未在官方 repo 中。

add-apt-repository是一个命令行实用程序,用于在 Ubuntu Debian Linux 中添加 PPA(个人包存档)。

Ubuntu 中添加新的 PPA(个人软件包存档)

如果要添加新的 PPA 存储库,则必须使用add-apt-repository命令:

sudo add-apt-repository ppa:some/ppa

例如:

sudo add-apt-repository ppa:dr-akulavich/lighttable

sudo apt-get update

sudo apt-get install lighttable-installer

如果您看到缺少命令的错误,您必须首先安装包含add-apt-repository实用程序的软件包。

修复 add-apt-repository: command not found 错误

因此,较新系统上的add-apt-repository命令位于软件包software-properties-common下,您需要先安装该软件包才能安装add-apt-repository

Debian/Ubuntu LTS 上安装软件包

如果您使用的是 Debian / Ubuntu LTS 18.0416.04 14.04 系统,则安装software-properties-common包以获取add-apt-repository命令。

$ sudo apt-get install -y software-properties-common

Reading package lists... Done

Building dependency tree      

Reading state information... Done

The following NEW packages will be installed:

  software-properties-common

0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.

Need to get 9384 B of archives.

After this operation, 188 kB of additional disk space will be used.

Get:1 http://archive.ubuntu.com/ubuntu/ trusty-updates/main software-properties-common all 0.92.37.8 [9384 B]

Fetched 9384 B in 0s (47.0 kB/s)              

Selecting previously unselected package software-properties-common.

(Reading database ... 62966 files and directories currently installed.)

Preparing to unpack .../software-properties-common_0.92.37.8_all.deb ...

Unpacking software-properties-common (0.92.37.8) ...

Processing triggers for man-db (2.6.7.1-1ubuntu1) ...

Setting up software-properties-common (0.92.37.8) ...

注意:如果您看到错误提示未找到software-properties-common package,您应该运行sudo apt-get update然后再次尝试安装。

Ubuntu 13.10 和更早版本上安装软件包

如果您使用的是 Ubuntu v13.10 或更早版本,则可以在python-software-properties包下找到add-apt-repository命令。因此,请使用apt-get命令安装该软件包。

$ sudo apt-get install -y python-software-properties

根据您的系统安装了software-properties-commonpython-software-properties后,您现在可以轻松地使用add-apt-repositoryapt-add-repository命令来添加 PPA

让我们尝试添加本教程前面提到的示例 PPA

$ sudo add-apt-repository ppa:dr-akulavich/lighttable

 Light Table Installer: the package in this PPA downloads and installs the latest builds from http://lighttable.com/

 More info: https://launchpad.net/~dr-akulavich/+archive/ubuntu/lighttable

Press [ENTER] to continue or ctrl-c to cancel adding it

gpg: keyring `/tmp/tmpwybqddzt/secring.gpg' created

gpg: keyring `/tmp/tmpwybqddzt/pubring.gpg' created

gpg: requesting key 85C79C73 from hkp server keyserver.ubuntu.com

gpg: /tmp/tmpwybqddzt/trustdb.gpg: trustdb created

gpg: key 85C79C73: public key "Launchpad PPA for Anton Yakutovich" imported

gpg: Total number processed: 1

gpg:               imported: 1  (RSA: 1)

OK

$ sudo apt-get update

......

$ sudo apt-get install lighttable-installer

Reading package lists... Done

Building dependency tree      

Reading state information... Done

The following NEW packages will be installed:

  lighttable-installer

0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.

Need to get 4292 B of archives.

After this operation, 20.5 kB of additional disk space will be used.

Get:1 http://ppa.launchpad.net/dr-akulavich/lighttable/ubuntu/ trusty/main lighttable-installer amd64 0.8.0-1~ppa~3 [4292 B]

Fetched 4292 B in 0s (18.6 kB/s)        

.......

Download done.

Removing outdated cached downloads...

Unpacking lighttable-installer (0.8.0-1~ppa~3) ...

Processing triggers for mime-support (3.54ubuntu1.1) ...

Setting up lighttable-installer (0.8.0-1~ppa~3) ...

Successfully installed in /opt/LightTable

希望这可以帮助您解决 PPA 问题。如果没有,或者您还有其他问题,请在文章下方给我们留言。

 

 

举报

相关推荐

0 条评论