Gar*_*eth 236 linux package-management debian aptitude
假设您正在运行一个服务器,并且您不想从 Stable (Lenny) 升级到 Testing (Squeeze) 以安装一两个必需的软件包。
仅安装来自测试的某些软件包的最佳方法是什么?
Sin*_*per 202
许多人似乎害怕将稳定与测试混为一谈,但坦率地说,测试本身是相当稳定的,通过适当的偏好和解决方案检查,您可以避免“稳定性漂移”,从而使您的核心包走上不稳定的道路。
“测试还算稳定??” , 你问。是的。为了让一个包从不稳定迁移到测试,它必须连续 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: 900
Run Code Online (Sandbox Code Playgroud)
testing.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: 400
Run Code Online (Sandbox Code Playgroud)
unstable.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: 50
Run Code Online (Sandbox Code Playgroud)
experimental.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
Run Code Online (Sandbox Code Playgroud)
(不要害怕这里不稳定/实验性的东西。优先级足够低,它永远不会自动安装任何这些东西。即使是测试分支也会表现出来,因为它只会安装你想要的包在测试中。)
现在,创建一个匹配集/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。
您还可以添加oldstablein sources.lists.dand preferences.d(使用优先级 1),尽管此名称往往会在下一个稳定周期之前过期并消失。在这种情况下,您可以使用http://archive.debian.org/debian/和“硬编码”Debian 版本(etch、lenny 等)。
要安装包的测试版本,只需使用aptitude install lib-foobar-package/testing,或者直接跳到 aptitude 的 GUI 并在包详细信息中选择版本(在您正在查看的包上按回车键)。
如果您收到包冲突的投诉,请先查看解决方案。在大多数情况下,第一个是“不要安装此版本”。学习使用每个包的接受/拒绝解析器选项。例如,如果您正在安装 foobar-package/testing,并且第一个解决方案是“不安装 foobar-package/testing”,则将该选项标记为已拒绝,其他解决方案将永远不会再转向该路径。在这种情况下,您可能需要安装一些其他测试包。
如果它变得太麻烦(比如它试图升级 libc 或内核或其他一些巨大的核心系统),那么您可以拒绝这些升级路径,或者完全退出初始升级。请记住,如果您允许,它只会将东西升级到测试/不稳定。
编辑:修复了一些优先级引脚,并更新了列表。
pQd*_*pQd 115
在/etc/apt/apt.conf.d添加以下文件
99defaultrelease:
APT::Default-Release "stable";
Run Code Online (Sandbox Code Playgroud)
in /etc/apt/sources.list.d- 添加用于测试/不稳定源的 url
stable.list:
deb 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-free
Run Code Online (Sandbox Code Playgroud)
testing.list:
deb 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
Run Code Online (Sandbox Code Playgroud)
跑
apt-get update
Run Code Online (Sandbox Code Playgroud)
然后安装你需要的东西
apt-get -t testing install something
Run Code Online (Sandbox Code Playgroud)
如果您安装具有大量依赖项的东西,请务必非常小心。最好不要在生产中这样做。
您也可以在backports或类似的存储库中试试运气。
Gar*_*eth 51
apt_preferences
在 /etc/apt/preferences 文件中定义系统应该“安全升级”到的默认级别:
man 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
Run Code Online (Sandbox Code Playgroud)
将多个存储库添加到 /etc/apt/sources.list aptitude 现在只会升级到您指定的版本,即使列出了更高版本的存储库(在本例中为“稳定”)。
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
Run Code Online (Sandbox Code Playgroud)
因此,要安装该软件包,您只需:
$ aptitude install -t testing packageName
Run Code Online (Sandbox Code Playgroud)
Tel*_*hus 16
就其价值而言,我一直看到的一般建议是“不要将稳定版与任何东西混合”。大多数混合系统教程都是针对混合测试和不稳定的。
原因似乎是,如果您将稳定版与测试混合在一起,非常基本的包(如 libc6)将需要更新(以便从测试中安装软件),一旦这些基本包转移到测试中,整个系统就会朝着那个方向漂移。
这里有两种选择:
另一种可以防止从 Testing 或 Sid 安装太多依赖项的方法是:您告诉 apt-get 从 Testing 或 Sid 获取软件包的源并使用 Debian 工具为您的系统创建一个软件包(无需手动修补与来源)。
从这里引用:https :
//wiki.debian.org/DebianUnstable#How_do_I_backport_a_sid_package_to_testing_or_stable.3F
如何将 sid 包向后移植到测试或稳定版?
安装 Debian 源代码(以及开发工具,尤其是 debhelper、devscripts 和 build-essential),然后构建软件包。
一步步:
Run Code Online (Sandbox Code Playgroud)add a deb-src line for sid to your sources.list apt-get update apt-get build-dep PACKAGE_NAME apt-get -b source PACKAGE_NAME生成的 debs 应该在当前目录中,并且可以使用 dpkg -i the.deb 进行安装。