我正在尝试从 nginx.org 上的最新版本安装 Nginx,但是未选取最新的软件包:
$ apt-get install nginx
Reading package lists... Done
Building dependency tree
Reading state information... Done
nginx is already the newest version.a
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
看起来 Apt 可以看到该包,但是没有选择它:
$ apt-cache policy nginx
nginx:
Installed: 1.2.1-2.2+wheezy3
Candidate: 1.2.1-2.2+wheezy3
Version table:
1.6.2-2 0
300 http://ftp.nl.debian.org/debian/ sid/main amd64 Packages
1.6.2-1 0
300 http://ftp.nl.debian.org/debian/ sid/main amd64 Packages
400 http://ftp.nl.debian.org/debian/ testing/main amd64 Packages
1.6.2-1~wheezy 0 ## <<-- WANT THIS ONE
800 http://nginx.org/packages/debian/ wheezy/nginx amd64 Packages
*** 1.2.1-2.2+wheezy3 0
900 http://security.debian.org/ wheezy/updates/main amd64 Packages
100 /var/lib/dpkg/status
1.2.1-2.2+wheezy2 0
900 http://ftp.nl.debian.org/debian/ wheezy/main amd64 Packages
在/etc/apt/sources.list.d/nginx.list
:
deb http://nginx.org/packages/debian/ wheezy nginx
deb-src http://nginx.org/packages/debian/ wheezy nginx
这可能和我的 apt-preferences 有关吗?
在/etc/apt/preferences.d/base
:
# Install stable unless installed version is more recent.
Package: *
Pin: release o=Debian,a=stable
Pin-Priority: 900
# Allow to install testing, unless there is a stable release.
Package: *
Pin: release o=Debian,a=testing
Pin-Priority: 400
# Allow to install unstable, unless there is a stable release
Package: *
Pin: release o=Debian,a=unstable
Pin-Priority: 300
# Never install other packages from Debian
Package: *
Pin: release o=Debian
Pin-Priority: -1
在/etc/apt/preferences.d/nginx
:
# Install Nginx unless installed version is more recent.
Package: *
Pin: release o=nginx
Pin-Priority: 800