栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 系统运维 > 运维 > Linux

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

Linux 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

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

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

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

本教程将向您展示如何快速修复 Debian、Ubuntu 和其他基于 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.04、16.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 问题。如果没有,或者您还有其他问题,请在文章下方给我们留言。

 

 

转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/741352.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号