当前位置: 首页>>技术问答>>正文


为什么我收到“命令’deb’未找到”?

, ,

问题描述

我遇到了几个包含命令deb的安装说明。但似乎我的安装中没有此命令。

我在哪里可以得到这个命令?有work-around吗?

最佳解决方法

‘deb’不是命令。它在sources.list文件中用于指示Debian软件存储库。

来自Ubuntu Manpage – sources.list

The source list is designed to support any number of active sources and a variety of source media. The file lists one source per line, with the most preferred source listed first. The format of each line is: type uri args. The first item, type determines the format for args. uri is a Universal Resource Identifier (URI), which is a superset of the more specific and well-known Universal Resource Locator, or URL.

The deb type describes a typical two-level Debian archive, distribution/component. The format for a sources.list entry using the deb and deb-src types is:

deb [ options ] uri distribution [component1] [component2] [...] 

The URI for the deb type must specify the base of the Debian distribution, from which APT will find the information it needs. distribution can specify an exact path, in which case the components must be omitted and distribution must end with a slash (/). This is useful for when the case only a particular sub-section of the archive denoted by the URI is of interest. If distribution does not specify an exact path, at least one component must be present.

所以,如果我在sources.list中有deb http://archive.ubuntu.com/ubuntu/ quantal main restricted,它说我有一个基于“http://archive.ubuntu.com/ubuntu/”的Debian存档,分发是”quantal”,组件是”main”和”restricted”。

次佳解决方法

@Eric Carvalho的答案deb不是命令行如果你有deb那么url像这样:

deb http://download.virtualbox.org/virtualbox/debian trusty contrib 

编辑

@muru的提交一样,您需要在/etc/apt/source.list.d/文件夹中创建扩展名为.list的新文件:

示例:我想下载Oracle virtualbox,创建新文件:

sudo gedit /etc/apt/sources.list.d/oracle-virtualbox-trusty.list 

然后将deb行复制并粘贴到此文件中

第三种解决方法

deb不是unix命令。如果您有如下所示的行(docker的来源):

deb https://apt.dockerproject.org/repo ubuntu-xenial main

它是一个必须在您的ubuntu sources.list中可用的行,以便apt-get可以从这个新源找到未来的包。

但是,直接编辑/etc/apt/sources.list文件不是一个好习惯。而是将deb行添加为/etc/apt/sources.list.d/目录中新.list文件的条目。我们将创建一个docker.list文件,如下所示:

echo "deb https://apt.dockerproject.org/repo ubuntu-xenial main" | sudo tee /etc/apt/sources.list.d/docker.list

完成后,请记住执行sudo apt-get update,您现在应该可以轻松地从此源中找到新包。

第四种方法

Deb实际上并不是一个命令(起初我也这么认为) – 假设您正在尝试下载/安装deb,请执行此操作(例如):

wget http://whatever.com/whatever.deb

然后是dpkg -i whatever.deb

然后运行命令:

sudo apt-get update

参考资料

本文由Ubuntu问答整理, 博文地址: https://ubuntuqa.com/article/1249.html,未经允许,请勿转载。