我正在配置 Debian 6 (Squeeze) x86 服务器,并希望在需要时安装一些测试或不稳定的软件包,因此我使用固定。
我已配置我的 /etc/apt/sources.list 如下:
deb http://ftp.br.debian.org/debian stable main
deb http://ftp.br.debian.org/debian stable-updates main
deb http://security.debian.org/ stable/updates main
deb http://backports.debian.org/debian-backports squeeze-backports main
deb http://ftp.br.debian.org/debian testing main
deb http://ftp.br.debian.org/debian testing-updates main
deb http://security.debian.org/ testing/updates main
deb http://ftp.br.debian.org/debian unstable main
我的 /etc/apt/preferences 如下:
Package: *
Pin: release a=stable
Pin-Priority: 700
Package: *
Pin: release a=stable-updates
Pin-Priority: 700
Package: *
Pin: release a=squeeze-backports
Pin-Priority: 675
Package: *
Pin: release a=testing
Pin-Priority: 650
Package: *
Pin: release a=testing-updates
Pin-Priority: 650
Package: *
Pin: release a=unstable
Pin-Priority: 600
执行 apt-cache 策略,我得到:
100 /var/lib/dpkg/status
release a=now
600 http://ftp.br.debian.org/debian/ unstable/main i386 Packages
release o=Debian,a=unstable,n=sid,l=Debian,c=main
origin ftp.br.debian.org
650 http://security.debian.org/ testing/updates/main i386 Packages
release o=Debian,a=testing,n=wheezy,l=Debian-Security,c=main
origin security.debian.org
650 http://ftp.br.debian.org/debian/ testing-updates/main i386 Packages
release o=Debian,a=testing-updates,n=wheezy-updates,l=Debian,c=main
origin ftp.br.debian.org
650 http://ftp.br.debian.org/debian/ testing/main i386 Packages
release o=Debian,a=testing,n=wheezy,l=Debian,c=main
origin ftp.br.debian.org
675 http://backports.debian.org/debian-backports/ squeeze-backports/main i386 Packages
release o=Debian Backports,a=squeeze-backports,n=squeeze-backports,l=Debian Backports,c=main
origin backports.debian.org
700 http://security.debian.org/ stable/updates/main i386 Packages
release v=6.0,o=Debian,a=stable,n=squeeze,l=Debian-Security,c=main
origin security.debian.org
700 http://ftp.br.debian.org/debian/ stable-updates/main i386 Packages
release o=Debian,a=stable-updates,n=squeeze-updates,l=Debian,c=main
origin ftp.br.debian.org
700 http://ftp.br.debian.org/debian/ stable/main i386 Packages
release v=6.0.6,o=Debian,a=stable,n=squeeze,l=Debian,c=main
origin ftp.br.debian.org
我面临的问题是,当我尝试安装一些测试包时。前任:
apt-get install ruby1.9.1-dev/testing
我收到包裹损坏的消息:
The following packages have broken dependencies:
ruby1.9.1-dev : Depends: libruby1.9.1 (= 1.9.3.194-5) but 1.9.2.0-2 is set to be installed
E: Broken Packages
这意味着我想从测试安装,但 Debian 尝试从稳定安装依赖项。我知道我能做到:
apt-get install -t testing ruby1.9.1-dev
它的工作原理是安装测试中的所有依赖项,但我想使用尽可能多的稳定包(如果可用,请从稳定版安装依赖项)。
我遇到的另一个问题是,如果我安装这样的包:
apt-get install -t testing ruby1.9.1-dev
然后尝试安装另一个依赖于测试中作为 ruby1.9.1-dev 依赖项安装的库的包:
apt-get install gcc
我还收到“损坏的包裹”错误。
所以问题是:
如何安装测试包,同时安装稳定版的尽可能多的依赖项?
当稳定版中不可用时,是否可以通过运行来自动安装测试包
apt-get install package_name
?
答案1
我找到了一个可能的解决方案
将我的 /etc/apt/preferences 更改为如下内容:
Package: *
Pin: release a=stable
Pin-Priority: 999
Package: *
Pin: release a=stable-updates
Pin-Priority: 999
Package: *
Pin: release a=squeeze-backports
Pin-Priority: 995
Package: *
Pin: release a=testing
Pin-Priority: 993
Package: *
Pin: release a=testing-updates
Pin-Priority: 993
Package: *
Pin: release a=unstable
Pin-Priority: 991
然后,我可以安装一个测试包,该包将在可能的情况下安装来自稳定版或反向移植的依赖项。为此,我必须执行:
apt-get -t stable install [PACKAGE NAME]/testing
例如,如果我运行:
apt-get -s -t stable install imagemagick/testing
我得到了将要安装的软件包列表:
Inst locales [2.11.3-4] (2.13-37 Debian:testing [all]) []
Inst libc-bin [2.11.3-4] (2.13-37 Debian:testing [i386]) [libc6:i386 ]
Inst libc6 [2.11.3-4] (2.13-37 Debian:testing [i386]) [libc6-i686:i386 on libc6:i386] [libc6-i686:i386 ]
Inst libc6-i686 [2.11.3-4] (2.13-37 Debian:testing [i386])
Inst libuuid-perl [0.02-4] (0.02-5 Debian:testing [i386]) []
Inst perl-base [5.10.1-17squeeze4] (5.14.2-16 Debian:testing [i386]) [liblocale-gettext-perl:i386 on perlapi-5.10.0:i386] [liblocale-gettext-perl:i386 libtext-charwidth-perl:i386 libtext-iconv-perl:i386 ]
Inst libtext-charwidth-perl [0.04-6] (0.04-7+b1 Debian:testing [i386]) [liblocale-gettext-perl:i386 on perlapi-5.10.0:i386] [liblocale-gettext-perl:i386 libtext-iconv-perl:i386 ]
Inst liblocale-gettext-perl [1.05-6] (1.05-7+b1 Debian:testing [i386]) [libtext-iconv-perl:i386 ]
Inst libtext-iconv-perl [1.7-2] (1.7-5 Debian:testing [i386])
Inst gcc-4.7-base (4.7.2-5 Debian:testing [i386])
Inst multiarch-support (2.13-37 Debian:testing [i386])
Inst libstdc++6 [4.4.5-8] (4.7.2-5 Debian:testing [i386])
Inst libattr1 [1:2.4.44-2] (1:2.4.46-8 Debian:testing [i386])
Inst liblzma5 (5.1.1alpha+20120614-2 Debian:testing [i386])
Inst libcap2 (1:2.22-1.2 Debian:testing [i386])
Inst libdb5.1 (5.1.29-5 Debian:testing [i386])
Inst libgpg-error0 (1.10-3.1 Debian:testing [i386])
Inst libgcrypt11 (1.5.0-3 Debian:testing [i386])
Inst libp11-kit0 (0.12-3 Debian:testing [i386])
Inst libtasn1-3 (2.13-2 Debian:testing [i386])
Inst libgnutls26 (2.12.20-2 Debian:testing [i386])
Inst libgssapi-krb5-2 [1.8.3+dfsg-4squeeze6] (1.10.1+dfsg-3 Debian:testing [i386]) []
Inst libk5crypto3 [1.8.3+dfsg-4squeeze6] (1.10.1+dfsg-3 Debian:testing [i386]) []
Inst libkrb5-3 [1.8.3+dfsg-4squeeze6] (1.10.1+dfsg-3 Debian:testing [i386]) []
Inst libkrb5support0 [1.8.3+dfsg-4squeeze6] (1.10.1+dfsg-3 Debian:testing [i386])
Inst libidn11 (1.25-2 Debian:testing [i386])
Inst libpcre3 (1:8.30-5 Debian:testing [i386])
Inst libxml2 (2.8.0+dfsg1-7 Debian:testing [i386])
Inst imagemagick-common (8:6.7.7.10-5 Debian:testing [all])
Inst libavahi-common-data (0.6.31-1 Debian:testing [i386])
Inst libavahi-common3 (0.6.31-1 Debian:testing [i386])
Inst libdbus-1-3 (1.6.8-1 Debian:testing [i386])
Inst libavahi-client3 (0.6.31-1 Debian:testing [i386])
Inst libffi5 (3.0.10-3 Debian:testing [i386])
Inst libglib2.0-0 (2.33.12+really2.32.4-3 Debian:testing [i386])
Inst libcroco3 (0.6.6-2 Debian:testing [i386])
Inst libcups2 (1.5.3-2.13 Debian:testing [i386])
Inst libjpeg8 (8d-1 Debian:testing [i386])
Inst libpng12-0 (1.2.49-1 Debian:testing [i386])
Inst libjbig0 (2.0-2 Debian:testing [i386])
Inst libtiff4 (3.9.6-10 Debian:testing [i386])
Inst libcupsimage2 (1.5.3-2.13 Debian:testing [i386])
Inst libdatrie1 (0.2.5-3 Debian:testing [i386])
Inst libdjvulibre-text (3.5.25.3-1 Debian:testing [all])
Inst libdjvulibre21 (3.5.25.3-1 Debian:testing [i386])
Inst ttf-dejavu-core (2.33-3 Debian:testing [all])
Inst fontconfig-config (2.9.0-7.1 Debian:testing [all])
Inst libfontconfig1 (2.9.0-7.1 Debian:testing [i386])
Inst libjasper1 (1.900.1-13 Debian:testing [i386])
Inst libxau6 (1:1.0.7-1 Debian:testing [i386])
Inst libxdmcp6 (1:1.1.1-1 Debian:testing [i386])
Inst libxcb1 (1.8.1-2 Debian:testing [i386])
Inst libx11-data (2:1.5.0-1 Debian:testing [all])
Inst libx11-6 (2:1.5.0-1 Debian:testing [i386])
Inst libgdk-pixbuf2.0-common (2.26.1-1 Debian:testing [all])
Inst libgdk-pixbuf2.0-0 (2.26.1-1 Debian:testing [i386])
Inst libgomp1 (4.7.2-5 Debian:testing [i386])
Inst x11-common (1:7.6+8~bpo60+1 Debian Backports:squeeze-backports [all])
Inst libice6 (2:1.0.8-2 Debian:testing [i386])
Inst liblcms1 (1.19.dfsg-1.2 Debian:testing [i386])
Inst liblqr-1-0 (0.4.1-2 Debian:testing [i386])
Inst libltdl7 (2.4.2-1.1 Debian:testing [i386])
Inst liblcms2-2 (2.2+git20110628-2~bpo60+1 Debian Backports:squeeze-backports [i386])
Inst libsm6 (2:1.2.1-2 Debian:testing [i386])
Inst libxext6 (2:1.3.1-2 Debian:testing [i386])
Inst libxt6 (1:1.1.3-1 Debian:testing [i386])
Inst libmagickcore5 (8:6.7.7.10-5 Debian:testing [i386])
Inst libpixman-1-0 (0.24.0-1~bpo60+1 Debian Backports:squeeze-backports [i386])
Inst libxcb-render0 (1.8.1-2 Debian:testing [i386])
Inst libxcb-shm0 (1.8.1-2 Debian:testing [i386])
Inst libxrender1 (1:0.9.7-1 Debian:testing [i386])
Inst libcairo2 (1.10.2-7~bpo60+1 Debian Backports:squeeze-backports [i386])
Inst libilmbase6 (1.0.1-4 Debian:testing [i386])
Inst libmagickwand5 (8:6.7.7.10-5 Debian:testing [i386])
Inst libopenexr6 (1.6.1-6 Debian:testing [i386])
Inst libthai-data (0.1.18-2 Debian:testing [all])
Inst libthai0 (0.1.18-2 Debian:testing [i386])
Inst libxft2 (2.3.1-1 Debian:testing [i386])
Inst fontconfig (2.9.0-7.1 Debian:testing [i386])
Inst libpango1.0-0 (1.30.0-1 Debian:testing [i386])
Inst librsvg2-2 (2.36.1-1 Debian:testing [i386])
Inst libwmf0.2-7 (0.2.8.4-10.2 Debian:testing [i386])
Inst libmagickcore5-extra (8:6.7.7.10-5 Debian:testing [i386])
Inst libpaper1 (1.1.24+nmu2 Debian:testing [i386])
Inst poppler-data (0.4.5-10 Debian:testing [all])
Inst libsystemd-login0 (44-7 Debian:testing [i386])
Inst krb5-locales (1.10.1+dfsg-3 Debian:testing [all])
Inst libclass-isa-perl (0.36-3 Debian:testing [all])
Inst perl-modules (5.14.2-16 Debian:testing [all]) []
Inst perl (5.14.2-16 Debian:testing [i386]) []
Inst libswitch-perl (2.16-2 Debian:testing [all])
Inst dbus (1.6.8-1 Debian:testing [i386])
Inst fonts-droid (20101110+git-3~bpo60+1 Debian Backports:squeeze-backports [all])
Inst libijs-0.35 (0.35-8 Debian:testing [i386])
Inst libjbig2dec0 (0.11+20120125-1 Debian:testing [i386])
Inst libgs9-common (9.05~dfsg-6.3 Debian:testing [all])
Inst libgs9 (9.05~dfsg-6.3 Debian:testing [i386])
Inst gsfonts (1:8.11+urwcyr1.0.7~pre44-4.2 Debian:6.0.6/stable, Debian:testing, Debian:unstable [all])
Inst ghostscript (9.05~dfsg-6.3 Debian:testing [i386])
Inst hicolor-icon-theme (0.12-1 Debian:6.0.6/stable, Debian:testing, Debian:unstable [all])
Inst imagemagick (8:6.7.7.10-5 Debian:testing [i386])
Inst libexiv2-12 (0.23-1 Debian:testing [i386])
Inst libglib2.0-data (2.33.12+really2.32.4-3 Debian:testing [all])
Inst libnetpbm10 (2:10.0-15+b1 Debian:testing [i386])
Inst libpaper-utils (1.1.24+nmu2 Debian:testing [i386])
Inst librsvg2-common (2.36.1-1 Debian:testing [i386])
Inst netpbm (2:10.0-15+b1 Debian:testing [i386])
Inst sgml-base (1.26+nmu3 Debian:testing [all])
Inst shared-mime-info (1.0-1+b1 Debian:testing [i386])
Inst liblensfun-data (0.2.5-2 Debian:testing [all])
Inst liblensfun0 (0.2.5-2 Debian:testing [i386])
Inst ufraw-batch (0.18-2 Debian:testing [i386])
Inst xml-core (0.13+nmu2 Debian:testing [all])
请注意,将安装一些稳定的和向后移植的软件包(并且它们确实按照我的测试安装)。
现在,如果我想从稳定版安装软件包,我会执行以下命令:
apt-get -t stable install [PACKAGE NAME]/stable
我执行此操作是因为问题 2 中描述的问题(安装另一个依赖于作为测试依赖项安装的库的包)。
如果我通过测试安装 ruby1.9.1-dev:
apt-get -t stable install --no-install-recommends ruby1.9.1-dev/testing
它将安装一些库,包括测试中的 libc6,但不安装 gcc。然后,如果我想从稳定版安装 gcc,我只需运行:
apt-get install gcc
我会收到Broken package
错误。如果我尝试:
apt-get -t stable install gcc
它将通过测试安装 gcc。要从稳定版安装 gcc,我必须运行:
apt-get -t stable install gcc/stable
注意它可能会降级软件包,但在这种情况下它不会降级任何包:
These extra packages will be installed:
binutils cpp cpp-4.4 cpp-4.7 gcc gcc-4.4 gcc-4.4-base gcc-4.7-base libgcc1 libgmp10 libgomp1 libmpc2 libmpfr4 libstdc++6
Suggested packages:
binutils-doc cpp-doc gcc-4.4-locales gcc-4.7-locales gcc-multilib make manpages-dev autoconf automake1.9 libtool flex bison gdb gcc-doc gcc-4.4-multilib
libmudflap0-4.4-dev gcc-4.4-doc libgcc1-dbg libgomp1-dbg libmudflap0-dbg libcloog-ppl0 libppl-c2 libppl7
The following NEW packages will be installed:
binutils cpp cpp-4.4 cpp-4.7 gcc gcc-4.4 gcc-4.7-base libgmp10 libgomp1 libmpc2 libmpfr4
The following packages will be updated:
gcc-4.4-base libgcc1 libstdc++6
3 updated packages, 11 new installed packages, 0 to be removed and 159 not updated.
Inst gcc-4.7-base (4.7.2-5 Debian:testing [i386])
Inst libgcc1 [1:4.4.5-8] (1:4.7.2-5 Debian:testing [i386])
Inst libstdc++6 [4.4.5-8] (4.7.2-5 Debian:testing [i386])
Inst libgmp10 (2:5.0.5+dfsg-2 Debian:testing [i386])
Inst libgomp1 (4.7.2-5 Debian:testing [i386])
Inst libmpfr4 (3.1.0-5 Debian:testing [i386])
Inst libmpc2 (0.9-4 Debian:testing [i386])
Inst binutils (2.22-7.1 Debian:testing [i386])
Inst cpp-4.7 (4.7.2-5 Debian:testing [i386])
Inst cpp (4:4.7.2-1 Debian:testing [i386])
Inst gcc-4.4-base [4.4.5-8] (4.4.7-2 Debian:testing [i386])
Inst cpp-4.4 (4.4.7-2 Debian:testing [i386])
Inst gcc-4.4 (4.4.7-2 Debian:testing [i386])
Inst gcc (4:4.4.5-1 Debian:6.0.6/stable [i386])
请注意,gcc 将从稳定版安装。
另请注意,如果您将
APT::Default-Release "stable";
在 /etc/apt/apt.conf.d/70debconf 上,您似乎不需要使用-t stable
.前任:
Instead of
apt-get -t stable install gcc/stable
I could just run
apt-get install gcc/stable
这是因为我已经指定我的目标在 上稳定70debconf
。
我想知道是否有其他/更好的解决方案,因为这个更像是一种黑客攻击。