你如何告诉 apt 使用 /etc/apt/sources.list.d 中的文件

Jis*_*iot 16 apt repository

我通过放入一个文件添加了一个 repo

 /etc/apt/sources.list.d 
Run Code Online (Sandbox Code Playgroud)

然后我做了一个

 apt-get update.  
Run Code Online (Sandbox Code Playgroud)

但是它没有对那个回购做任何事情。然后我注意到它似乎没有包含该目录中的任何存储库。apt-get 似乎只注意到 /etc/apt/sources.list 中的内容。目录中的所有文件都以 .list 结尾并包含以下内容:

 virtualbox.list

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

 pj-assis-ppa-oneiric.list

      deb http://ppa.launchpad.net/pj-assis/ppa/ubuntu oneiric main
      deb-src http://ppa.launchpad.net/pj-assis/ppa/ubuntu oneiric main
Run Code Online (Sandbox Code Playgroud)

我是否需要在 /etc/apt/sources.list 中放入某种包含语句?

我正在使用 kubuntu 11.10。

gre*_*een 11

如果要包含在软件源/etc/sources.list.d.list,文件名必须以 结尾。

正如sources.list手册页所说:

描述

   The package resource list is used to locate archives of the package
   distribution system in use on the system. At this time, this manual
   page documents only the packaging system used by the Debian GNU/Linux
   system. This control file is /etc/apt/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 rest of
   the line can be marked as a comment by using a #.
Run Code Online (Sandbox Code Playgroud)

来源.列表.D

   The /etc/apt/sources.list.d directory provides a way to add
   sources.list entries in separate files. The format is the same as for
   the regular sources.list file. File names need to end with .list and
   may only contain letters (a-z and A-Z), digits (0-9), underscore (_),
   hyphen (-) and period (.) characters. Otherwise APT will print a notice
   that it has ignored a file if the file doesn't match a pattern in the
   Dir::Ignore-Files-Silently configuration list - in this case it will be
   silently ignored.
Run Code Online (Sandbox Code Playgroud)

本页为例,假设您想安装Chef (from opscode),您要做的是:

  • 创建并打开一个名为 的文件opscode.list
    须藤vim /etc/apt/sources.list.d/opscode.list
  • 添加所需的行并保存文件:
    deb http://apt.opscode.com/ oneiric main

以上步骤可以组合成一个命令:

sudo /bin/sh -c 'echo "deb http://apt.opscode.com/ onereic main" > /etc/apt/sources.list.d/opscode.list'
Run Code Online (Sandbox Code Playgroud)

注意:该命令包含,onereic因为您使用的 Ubuntu 的代号是Onereic。如果你一直在使用Precise (12.04),你就会有 .writter precise

  • 你读过OP吗?他完成所有这些步骤。 (5认同)

Jis*_*iot 3

所以问题似乎是我从普通 apt 存储库之一安装了一个软件包,并且我希望它使用新存储库之一的版本进行更新。显然这是不可能的。我必须卸载有问题的软件包,然后安装所有正常的存储库并注释掉。我仍然不确定为什么当您执行 apt-get 更新时,这些新存储库都没有显示其网址。

  • 我只能告诉你,这解决了我提出问题时遇到的问题。另一个“答案”显然没有阅读我的问题并且完全没有用。这对我有用。我不知道它是否对其他人有用。我认为 ubuntu 11 中的一些错误导致它不使用其他存储库中的更新包。在 ubuntu 12 或 13 中这似乎不是问题。 (3认同)