根据手册:
A note of caution: the keyword used here is "origin" which can be used to match a hostname. The following record will assign a high priority to all versions available from the server identified by the hostname "ftp.de.debian.org" Package: * Pin: origin "ftp.de.debian.org" Pin-Priority: 999
来源链接:http://manpages.ubuntu.com/manpages/zesty/man5/apt_preferences.5.html
有我的输出:
apt偏好是:
# more /etc/apt/preferences.d/default_source_list.pref
Package: *
Pin: origin "ubuntu-repository.youseeu.com"
Pin-Priority: 999
包mysql-server的策略:
# apt-cache policy mysql-server
mysql-server:
Installed: (none)
Candidate: 5.5.57-0ubuntu0.14.04.1
Version table:
5.5.57-0ubuntu0.14.04.1 0
500 http://us-east-2.ec2.archive.ubuntu.com/ubuntu/ trusty-updates/main amd64 Packages
500 http://security.ubuntu.com/ubuntu/ trusty-security/main amd64 Packages
999 https://ubuntu-repository.youseeu.com/ysu_ubuntu14/ trusty/main amd64 Packages
5.5.35+dfsg-1ubuntu1 0
500 http://us-east-2.ec2.archive.ubuntu.com/ubuntu/ trusty/main amd64 Packages
检查它的工作原理:
# apt-get install -d mysql-server
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following extra packages will be installed:
libaio1 libdbd-mysql-perl libdbi-perl libhtml-template-perl libmysqlclient18
libterm-readkey-perl mysql-client-5.5 mysql-client-core-5.5 mysql-common
mysql-server-5.5 mysql-server-core-5.5 perl perl-base perl-modules
Suggested packages:
libclone-perl libmldbm-perl libnet-daemon-perl libplrpc-perl
libsql-statement-perl libipc-sharedcache-perl tinyca mailx perl-doc
libterm-readline-gnu-perl libterm-readline-perl-perl libb-lint-perl
libcpanplus-dist-build-perl libcpanplus-perl libfile-checktree-perl
liblog-message-perl libobject-accessor-perl
The following NEW packages will be installed:
libaio1 libdbd-mysql-perl libdbi-perl libhtml-template-perl libmysqlclient18
libterm-readkey-perl mysql-client-5.5 mysql-client-core-5.5 mysql-common
mysql-server mysql-server-5.5 mysql-server-core-5.5
The following packages will be upgraded:
perl perl-base perl-modules
3 upgraded, 12 newly installed, 0 to remove and 195 not upgraded.
Need to get 16.1 MB of archives.
After this operation, 97.2 MB of additional disk space will be used.
Do you want to continue? [Y/n] y
Get:1 http://us-east-2.ec2.archive.ubuntu.com/ubuntu/ trusty-updates/main perl amd64 5.18.2-2ubuntu1.1 [2,648 kB]
Get:2 http://us-east-2.ec2.archive.ubuntu.com/ubuntu/ trusty-updates/main perl-base amd64 5.18.2-2ubuntu1.1 [1,146 kB]
Get:3 http://us-east-2.ec2.archive.ubuntu.com/ubuntu/ trusty-updates/main perl-modules all 5.18.2-2ubuntu1.1 [2,673 kB]
Get:4 http://us-east-2.ec2.archive.ubuntu.com/ubuntu/ trusty/main libaio1 amd64 0.3.109-4 [6,364 B]
Get:5 http://us-east-2.ec2.archive.ubuntu.com/ubuntu/ trusty-updates/main mysql-common all 5.5.57-0ubuntu0.14.04.1 [13.0 kB]
Get:6 http://us-east-2.ec2.archive.ubuntu.com/ubuntu/ trusty-updates/main libmysqlclient18 amd64 5.5.57-0ubuntu0.14.04.1 [596 kB]
Get:7 http://us-east-2.ec2.archive.ubuntu.com/ubuntu/ trusty/main libdbi-perl amd64 1.630-1 [879 kB]
Get:8 http://us-east-2.ec2.archive.ubuntu.com/ubuntu/ trusty-updates/main libdbd-mysql-perl amd64 4.025-1ubuntu0.1 [87.6 kB]
Get:9 http://us-east-2.ec2.archive.ubuntu.com/ubuntu/ trusty/main libterm-readkey-perl amd64 2.31-1 [27.4 kB]
Get:10 http://us-east-2.ec2.archive.ubuntu.com/ubuntu/ trusty-updates/main mysql-client-core-5.5 amd64 5.5.57-0ubuntu0.14.04.1 [707 kB]
Get:11 http://us-east-2.ec2.archive.ubuntu.com/ubuntu/ trusty-updates/main mysql-client-5.5 amd64 5.5.57-0ubuntu0.14.04.1 [1,588 kB]
Get:12 http://us-east-2.ec2.archive.ubuntu.com/ubuntu/ trusty-updates/main mysql-server-core-5.5 amd64 5.5.57-0ubuntu0.14.04.1 [3,766 kB]
Get:13 http://us-east-2.ec2.archive.ubuntu.com/ubuntu/ trusty-updates/main mysql-server-5.5 amd64 5.5.57-0ubuntu0.14.04.1 [1,866 kB]
Get:14 http://us-east-2.ec2.archive.ubuntu.com/ubuntu/ trusty/main libhtml-template-perl all 2.95-1 [65.5 kB]
Get:15 http://us-east-2.ec2.archive.ubuntu.com/ubuntu/ trusty-updates/main mysql-server all 5.5.57-0ubuntu0.14.04.1 [11.3 kB]
Fetched 16.1 MB in 0s (21.1 MB/s)
Download complete and in download only mode
检查政策:
# apt-cache policy | head -n 20
Package files:
100 /var/lib/dpkg/status
release a=now
999 https://ubuntu-repository.youseeu.com/ysu_ubuntu14/ trusty/main amd64 Packages
release o=ysu_ubuntu14 trusty,a=trusty,n=trusty,l=ysu_ubuntu14 trusty,c=main
origin ubuntu-repository.youseeu.com
500 http://security.ubuntu.com/ubuntu/ trusty-security/universe Translation-en
500 http://security.ubuntu.com/ubuntu/ trusty-security/main Translation-en
500 http://security.ubuntu.com/ubuntu/ trusty-security/universe amd64 Packages
release v=14.04,o=Ubuntu,a=trusty-security,n=trusty,l=Ubuntu,c=universe
origin security.ubuntu.com
500 http://security.ubuntu.com/ubuntu/ trusty-security/main amd64 Packages
release v=14.04,o=Ubuntu,a=trusty-security,n=trusty,l=Ubuntu,c=main
origin security.ubuntu.com
500 http://us-east-2.ec2.archive.ubuntu.com/ubuntu/ trusty-updates/universe Translation-en
500 http://us-east-2.ec2.archive.ubuntu.com/ubuntu/ trusty-updates/main Translation-en
500 http://us-east-2.ec2.archive.ubuntu.com/ubuntu/ trusty-updates/universe amd64 Packages
release v=14.04,o=Ubuntu,a=trusty-updates,n=trusty,l=Ubuntu,c=universe
origin us-east-2.ec2.archive.ubuntu.com
500 http://us-east-2.ec2.archive.ubuntu.com/ubuntu/ trusty-updates/main amd64 Packages
那么,为什么从主机us-east-2.ec2.archive.ubuntu.com下载包mysql-server?
为什么我的存储库ubuntu-repository.youseeu.com的优先级不高?
答案 0 :(得分:0)
可能有相同版本的软件包的几个实例 当sources.list(5)文件包含多个引用时 资源。在这种情况下,apt-get会下载最早列出的实例 sources.list(5)文件。 APT首选项不会影响选择 例如,只有版本的选择。 来源链接(您的链接):http://manpages.ubuntu.com/manpages/zesty/man5/apt_preferences.5.html
首先搜索可用的版本:
apt-cache policy mysql-server mysql-server:已安装:(无)候选:5.5.57-0ubuntu0.14.04.1版本表:
5.5.57-0ubuntu0.14.04.1 0 500 http://us-east-2.ec2.archive.ubuntu.com/ubuntu/ trusty-updates/main amd64 Packages 500 http://security.ubuntu.com/ubuntu/ trusty-security/main amd64 Packages 999 https://ubuntu-repository.youseeu.com/ysu_ubuntu14/ trusty/main amd64 Packages 5.5.35+dfsg-1ubuntu1 0 500 http://us-east-2.ec2.archive.ubuntu.com/ubuntu/ trusty/main amd64 Packages
版本5.5.57在3个来源中找到,优先级根据以下内容忽略:
在这种情况下,apt-get会下载最早列出的实例 sources.list(5)文件。 APT偏好不影响选择 例如,只选择版本。