如何在Ubuntu和Debian上修复"未找到添加-Apt-reposory命令"

时间:2020-03-05 15:31:56  来源:igfitidea点击:

在Linux Mint,Linux Lite,Zorin OS,基于OS和其他基于Ubuntu的Distrs的某些情况下,以及Ubuntu和Debian,我们将看到缺少Add-APT-Repository命令的错误。

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

本教程将向我们展示如何快速修复Debian,Ubuntu和其他基于Debian的Linux发行版的"未找到添加-Pt-Repository命令"错误。

什么是个人包档案

PPA是个人存储库的Web URL。
存储库是有关各种软件,其版本和其他详细信息的文件集合,如校验和。
每个Ubuntu版本都有自己的四个存储库套装。

在Ubuntu或者Debian上安装软件的最常用方式,如果包尚未在官方仓库中,则是使用PPA(个人包归档)。

Add-Apt-repository是用于在Ubuntu和Debian Linux中添加PPA(Personal Package Archive)的命令行实用程序。

在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:找不到命令错误

因此,较新系统上的Add-APT-Repository命令是在包软件属性下常见的,并且我们需要先安装该包以便安装Add-APT存储库。

在Debian/Ubuntu LTS上安装包

如果我们使用Debian/Ubuntu LTS,例如18.04,16.04和14.04系统,则安装软件属性常用包以获取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) ...

注意:如果我们看到错误地说软件属性 - 常见包找不到,则应运行sudo apt-get更新,然后尝试再次安装它。

在Ubuntu 13.10及以上安装包装

如果我们使用的是Ubuntu v13.10或者旧,则Add-APT-Repository命令可在Python-software-properties包下找到。
因此,请使用APT-GET命令安装该包。

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

一旦安装了软件 - 属性 - 常见或者Python-Software-Properties,根据系统,我们现在可以舒适地使用Add-APT存储库或者APT-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