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

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

/etc/apt/sources.list.d 

然后我做了一个

  apt-get update. 

但是它没有对那个回购做任何事情。 然后我注意到它似乎没有包含该目录中的任何存储库。 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 

我需要在/etc/apt/sources.list中添加某种include语句吗?

我正在使用kubuntu 11.10。

/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 #. 

SOURCES.LIST.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 (az and AZ), 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. 

从这个页面举个例子 ,假设你想安装chef(来自opscode) ,你要做的是:

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

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

 sudo echo "deb http://apt.opscode.com/ onereic main" > /etc/apt/sources.list.d/opscode.list 

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

所以问题似乎是我从一个普通的apt repos安装了一个包,我希望它用一个新的repos版本更新。 显然这是不可能的。 我不得不卸载有问题的软件包,然后安装所有正常的repos注释掉。 我仍然不确定为什么当你做一个apt-get更新时,这些新的repos都没有显示他们的url。