假设您正在运行一台服务器,并且您不希望升级到测试(压缩)从稳定(Lenny)只是安装一个或两个所需的软件包。
从测试中只安装某些软件包的最佳方法是什么?
发布于 2009-06-09 08:04:43
在/etc/apt/preferences文件中定义系统应该“安全升级”到的默认级别:
你可以用apt_preferences做很多事情,但是为了简单.
我需要安装一个只能在测试中使用的软件包(autoMysqlBackup)。解决方案是在/etc/apt/preferences中添加以下内容:
Explanation: Uninstall or do not install any Debian-originated
Explanation: package versions other than those in the stable distro
Package: *
Pin: release a=stable
Pin-Priority: 900
Package: *
Pin: release o=Debian
Pin-Priority: -10通过将多个存储库添加到/etc/apt/stable中,列表智能现在只会升级到指定的版本,即使列出了后面的版本repos (在本例中是“稳定的”)。
deb http://mirror.aarnet.edu.au/debian/ lenny main
deb-src http://mirror.aarnet.edu.au/debian/ lenny main
deb http://mirror.aarnet.edu.au/debian/ squeeze main
deb-src http://mirror.aarnet.edu.au/debian/ squeeze main因此,要安装该软件包,您需要做的就是:
$ aptitude install -t testing packageName 发布于 2012-04-23 02:38:12
许多人似乎害怕将稳定与测试混为一谈,但坦率地说,测试本身是相当稳定的,通过适当的偏好和解决方案检查,您可以避免将核心包置于不稳定路径上的“稳定性漂移”。
“测试是相当稳定的??”,你问。是。为了使包从不稳定迁移到测试,它必须连续10天保持零打开错误。很有可能,特别是对于比较流行的软件包,如果有什么问题,有人会为不稳定的版本提交错误报告。
即使您不想混合这些环境,如果遇到比稳定版本更新的版本,仍然可以在那里有一个选项。
首先,在/etc/apt/preferences.d中创建以下文件:
stable.pref# 500 <= P < 990: causes a version to be installed unless there is a
# version available belonging to the target release or the installed
# version is more recent
Package: *
Pin: release a=stable
Pin-Priority: 900testing.pref# 100 <= P < 500: causes a version to be installed unless there is a
# version available belonging to some other distribution or the installed
# version is more recent
Package: *
Pin: release a=testing
Pin-Priority: 400unstable.pref# 0 < P < 100: causes a version to be installed only if there is no
# installed version of the package
Package: *
Pin: release a=unstable
Pin-Priority: 50experimental.pref# 0 < P < 100: causes a version to be installed only if there is no
# installed version of the package
Package: *
Pin: release a=experimental
Pin-Priority: 1(不要害怕这里不稳定的/实验的东西。它的优先级很低,所以它永远不会自动安装这些东西。甚至测试分支也会运行,因为它只安装您想要进行测试的包。)
现在,为/etc/apt/sources.list.d创建一个匹配集:
stable.list:从原来的/etc/apt/sources.list复制。将旧文件重命名为类似于sources.list.orig的文件。
testing.list:和stable.list一样,除了testing。
unstable.list:与stable.list相同,但unstable除外,并删除安全列表。
experimental.list:和unstable.list一样,除了experimental。
您还可以在oldstable和sources.lists.d中添加一个preferences.d (使用优先级为1),尽管这个名称在下一个稳定周期之前就会过期并消失。在这种情况下,您可以使用http://archive.debian.org/debian/和Debian版本的“硬编码”(etch、lenny等)。
要安装包的测试版本,只需使用aptitude install lib-foobar-package/testing,或跳转到aptitude并选择包详细信息中的版本(在您正在查看的包上按enter键)。
如果您收到有关包冲突的抱怨,请先看解决方案。在大多数情况下,第一个是“不要安装这个版本”。学习使用每个包接受/拒绝解析器选项。例如,如果您正在安装foobar包/测试,而第一个解决方案是“不要安装foobar包/测试”,那么将该选择标记为拒绝,其他解决方案将永远不会再转向该路径。在这种情况下,您可能需要安装一些其他测试包。
如果它变得过于毛茸茸(就像它试图升级libc、内核或其他大型核心系统一样),那么您可以拒绝这些升级路径,或者干脆退出最初的升级。记住,只有在允许的情况下,它才会升级到测试/不稳定。
编辑:修复了一些优先引脚,并更新了列表。
发布于 2009-06-09 07:57:22
在/etc/apt/apt.conf.d中添加以下文件
99defaultreleaseAPT::Default-Release "stable";在/etc/apt/sources.list.d中-添加用于测试/不稳定源的urls
stable.listdeb http://ftp.de.debian.org/debian/ stable main contrib non-free
deb-src http://ftp.de.debian.org/debian/ stable main contrib non-free
deb http://security.debian.org/ stable/updates main contrib non-freetesting.listdeb http://ftp.de.debian.org/debian/ testing main contrib non-free
deb-src http://ftp.de.debian.org/debian/ testing main contrib non-free
deb http://security.debian.org/ testing/updates main contrib non-free跑
apt-get update然后安装您需要的
apt-get -t testing install something如果您安装了大量依赖项,请非常小心。最好不要在生产中这样做。
您还可以在靠背或类似的存储库中试试运气。
https://serverfault.com/questions/22414
复制相似问题