如何添加存储库,但仅适用于特定的包/版本及其依赖项?

6 package-management apt repository pinning

我想将 Natty Narwhal 存储库用于 puppet 包,但我不想升级我的整个服务器。那可能吗 ?

我目前的解决方案是手动获取 .deb 包

and*_*ing 6

固定是一种先进的包管理技术,允许您在从更新版本获取包的同时保持稳定的版本。不支持混合存储库,如果您想要的包是针对与系统上不同的库版本编译的,那么可能会给您带来麻烦。如果可能,您应该首先尝试从向后移植存储库(或者可能是受良好支持的 PPA)获取包。也就是说,您似乎已经知道puppetfrom Natty 在您的系统上运行良好。

为了固定puppet到整洁的版本,我们必须编辑一些文件。首先,您需要设置默认版本/etc/apt/apt.conf.d/01ubuntu(我假设您使用的是 lucid,显然替换了实际版本):

APT
{
Default-Release "lucid";
};
Run Code Online (Sandbox Code Playgroud)

接下来,您需要将 natty 添加到您的文件或使用以下源/etc/apt/sources.list创建一个新文件:/etc/apt/sources.list.d/natty.sources.list

deb http://archive.ubuntu.com/ubuntu natty main restricted universe multiverse
deb-src http://archive.ubuntu.com/ubuntu natty main restricted universe multiverse

deb http://archive.ubuntu.com/ubuntu natty-updates main restricted universe multiverse
deb-src http://archive.ubuntu.com/ubuntu natty-updates main restricted universe multiverse

deb http://archive.ubuntu.com/ubuntu natty-security main restricted universe multiverse
deb-src http://archive.ubuntu.com/ubuntu natty-security main restricted universe multiverse
Run Code Online (Sandbox Code Playgroud)

然后,您需要将puppetNatty 中的包的“Pin-Priority”设置为高于默认版本的优先级。设置默认版本实质上/etc/apt/apt.conf.d/01ubuntu是将源自该版本的所有包的优先级设置为 990。因此,我们需要使用更高的值/etc/apt/preferences来覆盖此设置,例如:puppet

Package: puppet
Pin: release n=natty
Pin-Priority: 995
Run Code Online (Sandbox Code Playgroud)

现在你只需要运行并apt-get update && apt-get upgrade