
我正在尝试从自己的存储库安装 imagemagick 包。以下是我的分步说明:
我使用带有 conf 的 reprepro 实用程序创建了 apt 存储库:
Origin: custom-repo.s3.amazonaws.com
Label: custom-repo.s3.amazonaws.com
Codename: precise
Components: main
Architectures: i386 amd64
Description: Custom APT Repository
SignWith: 12312312
DebOverride: override.precise
DscOverride: override.precise
在目标实例上,我将这个自定义 repo 添加到 /etc/apt/sources.list.d/custom.list:
deb http://custom-repo.s3.amazonaws.com precise main
并改变 APT 偏好设置 (/etc/apt/preferences):
Package: *
Pin: release o=custom-repo.s3.amazonaws.com
Pin-Priority: 999
以下是 APT 政策(更新后):
imagemagick:
Installed: (none)
Candidate: 8:6.6.9.7-5ubuntu3.3
Version table:
8:6.6.9.7-5ubuntu3.3 0
500 http://archive.ubuntu.com/ubuntu/ precise-updates/main amd64 Packages
500 http://security.ubuntu.com/ubuntu/ precise-security/main amd64 Packages
999 http://custom-repo.s3.amazonaws.com/ precise/main amd64 Packages
8:6.6.9.7-5ubuntu3 0
500 http://archive.ubuntu.com/ubuntu/ precise/main amd64 Packages
现在我正尝试从我自己的存储库安装 imagemagick 包(但它是从 archive.ubuntu.com 安装的):
apt-get install imagemagick
Reading package lists... Done
Building dependency tree
Reading state information... Done
Suggested packages:
imagemagick-doc autotrace cups-bsd lpr lprng enscript ffmpeg gimp gnuplot grads hp2xx html2ps libwmf-bin mplayer povray radiance sane-utils texlive-base-bin transfig xdg-utils ufraw-batch
The following NEW packages will be installed:
imagemagick
0 upgraded, 1 newly installed, 0 to remove and 2 not upgraded.
Need to get 49.2 kB of archives.
After this operation, 213 kB of additional disk space will be used.
Get:1 http://archive.ubuntu.com/ubuntu/ precise-updates/main imagemagick amd64 8:6.6.9.7-5ubuntu3.3 [49.2 kB]
Fetched 49.2 kB in 0s (96.8 kB/s)
Selecting previously unselected package imagemagick.
(Reading database ... 94215 files and directories currently installed.)
Unpacking imagemagick (from .../imagemagick_8%3a6.6.9.7-5ubuntu3.3_amd64.deb) ...
Processing triggers for man-db ...
Setting up imagemagick (8:6.6.9.7-5ubuntu3.3) ...
答案1
我认为简短的回答是,apt 选择软件包版本,而不是存储库。
apt_preferences(1) 表示 apt 将“安装优先级最高的版本”,它确实在这么做。但它并没有说它将从优先级最高的存储库安装它。它可能只是在其列表中选择具有该版本的第一个存储库。
就 apt 所知,您的存储库和 archive.ubuntu.com 中的软件包版本是相同的,因为它们具有相同的版本号。如果它们相同,那么实际上没有问题,只是您无法测试您的存储库。如果它们不相同,那么您遇到了打包问题,应该更改软件包中的版本号。
如果您确实想强制 apt 使用您的存储库来测试它,您可以尝试将 imagemagick 的 Pin-Priority 提高到 1000 以上。这会触发 apt 中的不同逻辑,迫使它降级软件包,并且可能会让它选择您的存储库。或者,在您的存储库中安装不同版本的软件包,看看 apt 是否选择了正确的版本。