如何解决Ubuntu 12.10中的“ add-apt-repository:找不到命令”错误

时间:2020-03-21 11:46:50  来源:igfitidea点击:

众所周知,add-apt-repository是可用于在Ubuntu/Debian apt来源列表中添加新存储库的命令。
该命令将自动下载存储库的公钥并进行注册。

最近,当我尝试在Unbuntu 12.10服务器版本中添加新的存储库时,出现错误“ add-apt-repository:command not found”。

Hyman@theitroad:~$sudo add-apt-repository ppa:cherokee-webserver
[sudo] password for theitroad: 
sudo: add-apt-repository: command not found

我用谷歌搜索并找到了解决方案。
这就是我自己解决问题的方法。
像以前的Ubuntu版本一样,此命令“ add-apt-repository”不是软件包“ python-software-properties”的一部分。
但可以在“ software-properties-common”软件包中使用。

为了使用命令“ add-apt-repository”,我们应该安装“ software-properties-common”,如下所示。

Hyman@theitroad:~$sudo apt-get install software-properties-common
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following extra packages will be installed:
  python3-software-properties unattended-upgrades
Suggested packages:
  bsd-mailx mail-transport-agent
The following NEW packages will be installed:
  python3-software-properties software-properties-common unattended-upgrades
0 upgraded, 3 newly installed, 0 to remove and 61 not upgraded.
Need to get 55.3 kB of archives.
After this operation, 543 kB of additional disk space will be used.
Do you want to continue [Y/n]? y

下一步更新软件来源列表。

Hyman@theitroad:~$sudo apt-get update

现在,我们将能够使用命令“ add-apt-repository”添加新的存储库。

Hyman@theitroad:~$sudo add-apt-repository ppa:cherokee-webserver
You are about to add the following PPA to your system:
 Cherokee is a very fast, flexible and easy to configure Web Server. It supports the widespread technologies nowadays: FastCGI, SCGI, PHP, CGI, TLS and SSL encrypted connections, Virtual hosts, Authentication, on the fly encoding, Load balancing, Apache compatible log files, and much more.
 More info: https://launchpad.net/~cherokee-webserver/+archive/ppa
Press [ENTER] to continue or ctrl-c to cancel adding it
gpg: keyring `/tmp/tmp55xlve/secring.gpg' created
gpg: keyring `/tmp/tmp55xlve/pubring.gpg' created
gpg: requesting key EBA7BD49 from hkp server keyserver.ubuntu.com
gpg: /tmp/tmp55xlve/trustdb.gpg: trustdb created
gpg: key EBA7BD49: public key "Launchpad PPA for Cherokee Web Server" imported
gpg: Total number processed: 1
gpg:               imported: 1  (RSA: 1)
OK

再次更新软件源列表并安装所需的软件。

Hyman@theitroad:~$sudo apt-get update