我有一台运行 Debian Squeeze 的服务器,无法升级到 Wheezy。我需要安装 JRE 版本 7,因为其中有一些我需要的错误修复。我的选择是:
- 从 wheezy 软件包存储库安装 openjdk-7-jre
- 安装 oracle7jre
我们最好安装 openjdk,但我发现这非常困难。我尝试使用 apt-get openjdk-7-jre 安装并得到以下响应:
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:
The following packages have unmet dependencies:
openjdk-7-jre : Depends: openjdk-7-jre-headless (= 7u3-2.1.3-1) but it is not going to be installed
Depends: libfontconfig1 (>= 2.9.0) but 2.8.0-2.1 is to be installed
Depends: libgdk-pixbuf2.0-0 (>= 2.22.0) but it is not going to be installed
Depends: libjpeg8 (>= 8c) but 8b-1 is to be installed
Depends: libpulse0 (>= 0.99.1) but 0.9.21-3+squeeze1 is to be installed
Depends: libatk-wrapper-java-jni (>= 0.30.4-0ubuntu2) but it is not going to be installed
E: Broken packages
然后我尝试了 aptitude 并得到了以下回应:
0 packages upgraded, 76 newly installed, 0 to remove and 0 not upgraded.
Need to get 56.9 MB of archives. After unpacking 171 MB will be used.
The following packages have unmet dependencies:
libnss3: Conflicts: libnss3-1d (< 2:3.13.4-2) but 3.12.8-1+squeeze6 is installed.
openjdk-7-jre: Depends: libfontconfig1 (>= 2.9.0) but 2.8.0-2.1 is installed.
Depends: libjpeg8 (>= 8c) but it is not going to be installed.
Depends: libpulse0 (>= 0.99.1) but it is not going to be installed.
libgdk-pixbuf2.0-0: Depends: libglib2.0-0 (>= 2.31.18) but 2.24.2-1 is installed.
Depends: libjpeg8 (>= 8c) but it is not going to be installed.
Depends: libtiff4 (>= 3.9.5-2) but 3.9.4-5+squeeze8 is installed.
Breaks: libgtk2.0-0 (< 2.21.3) but 2.20.1-2 is installed.
Breaks: libgtk2.0-bin (< 2.21.3) but 2.20.1-2 is installed.
icedtea-7-jre-cacao: Depends: libstdc++6 (>= 4.6) but 4.4.5-8 is installed.
libatk-wrapper-java-jni: Depends: libglib2.0-0 (>= 2.31.8) but 2.24.2-1 is installed.
openjdk-7-jre-headless: Depends: libjpeg8 (>= 8c) but it is not going to be installed.
Depends: libfontconfig1 (>= 2.9.0) but 2.8.0-2.1 is installed.
Depends: libglib2.0-0 (>= 2.26.0) but 2.24.2-1 is installed.
The following actions will resolve these dependencies:
Keep the following packages at their current version:
1) icedtea-7-jre-cacao [Not Installed]
2) icedtea-7-jre-jamvm [Not Installed]
3) libatk-wrapper-java-jni [Not Installed]
4) libgdk-pixbuf2.0-0 [Not Installed]
5) libnss3 [Not Installed]
6) openjdk-7-jre [Not Installed]
7) openjdk-7-jre-headless [Not Installed]
8) openjdk-7-jre-lib [Not Installed]
Leave the following dependencies unresolved:
9) libatk-wrapper-java recommends libatk-wrapper-java-jni
Accept this solution? [Y/n/q/?]
接受解决方案的结束如下:
No packages will be installed, upgraded, or removed.
0 packages upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
Need to get 0 B of archives. After unpacking 0 B will be used.
抱歉,输出内容太冗长,我是这方面的新手。
无论如何,据我所知,在 squeeze 上安装 openjdk-7 相当困难 - 我猜我正在寻找灵丹妙药!有人这样做过吗?我应该放弃并获取 oracle 吗?
干杯,
詹姆士
答案1
我不知道您尝试失败的具体原因(可能与 APT conf 等有关),但我设法在 squeeze 上轻松安装了 openjdk7,到目前为止没有任何明显的副作用。
这里需要提醒一句:混合使用不同版本(例如稳定版和测试版)的软件包是有风险的。从其他版本安装的软件包可能与其他软件包不兼容,甚至可能破坏其他软件包。升级 libc 等关键软件包尤其危险,因为在这种情况下需要升级 libc。
首先,您需要设置软件包优先级,以便 APT 不会开始从测试中拉取所有内容。有关更多信息,您可以参考 apt_preferences(5) 手册页和Debian 管理员手册。
将 wheezy 包含在 sources.list 中(我假设您已经这样做了)
设置优先级
将 squeeze 设置为默认版本
$ cat /etc/apt/apt.conf.d/local APT::Default-Release "squeeze";
这有效地为挤压包设置了优先级 990。
通过进行模拟升级,我注意到 APT 正在尝试升级一些来自测试的软件包。
apt-cache policy
解释说这种情况发生在从 backport 安装的软件包上(安装的软件包优先级为 100,而测试中可用的软件包优先级为 500)。不确定这是否是最好的做法,但为了解决这个问题(避免使用来自测试的版本升级来自 backport 的软件包),我最小化了测试优先级(如果您不使用 backport,则不必这样做)$ cat /etc/apt/preferences.d/wheezy Package: * Pin: release n=wheezy Pin-Priority: 10
“10” 只是我选择的任意数字,小于 100。我猜想有了这个 pin,就不会获取从测试中安装的软件包的安全更新(尚未测试),解决这个问题也很有趣。
安装 openjdk7,选择 wheezy 作为目标版本
# apt-get install -t wheezy openjdk-7-jdk
由于在此过程中将升级必要的库,因此请准备好重新启动某些服务(将在您同意的情况下自动重新启动)。我不建议在图形会话中执行此操作 - 我被指示在升级 libc 之前停止显示管理器。