从较新版本安装软件包而无需构建(apt pinning)

Jan*_*ing 38 package-management pinning

我需要这些带有为 ubuntu/natty 反向移植的最新上游版本的软件包

  • libccid_1.4.5-0ubuntu1_amd64.deb
  • libpcsclite1_1.8.1-0ubuntu1_amd64.deb
  • libpcsclite-dev_1.8.1-0ubuntu1_amd64.deb
  • libusb-1.0-0_1.0.9-0ubuntu1_amd64.deb
  • libusb-1.0-0-dev_1.0.9-0ubuntu1_amd64.deb
  • opensc_0.12.2-1ubuntu1ppa1~natty1_amd64.deb
  • pcscd_1.8.1-0ubuntu1_amd64.deb pcsc-tools_1.4.18-0ubuntu1_amd64.deb

我试图通过更新从源代码构建它们,但它失败了。我不是包装专家,那里有很多教程和食谱。

你知道一个很好的和最新的向后移植 Ubuntu 包的教程吗?

如何从其他版本获取包而不必自己构建它们?

ppe*_*aki 38

探索 apt pinning 会更好,请参阅man apt_preferences

假设您在使用 Oneiric 并且想要从 Precise 获取这些软件包。

如果你阅读了man你会看到我复制/粘贴了相关部分,只是修改了发布名称

/etc/apt/preferences

Package: libccid
Pin: release n=precise
Pin-Priority: 990

Package: libpcsclite*
Pin: release n=precise
Pin-Priority: 990

Package: libusb*
Pin: release n=precise
Pin-Priority: 990

Package: opensc
Pin: release n=precise
Pin-Priority: 990

Package: pcscd
Pin: release n=precise
Pin-Priority: 990


Explanation: Uninstall or do not install any Ubuntu-originated
Explanation: package versions other than those in the oneiric release
Package: *
Pin: release n=oneiric
Pin-Priority: 900

Package: *
Pin: release o=Ubuntu
Pin-Priority: -10
Run Code Online (Sandbox Code Playgroud)

然后,我复制了我的/etc/apt/sources.listto/etc/apt/sources.list.d/precise.list并用精确替换了所有 oneiric 。然后跑了apt-get update,终于apt-get upgrade

$ sudo apt-get upgrade
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following packages will be upgraded:
  libpcsclite1 libusb-0.1-4 libusb-1.0-0 libusbmuxd1
4 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
Need to get 86.0 kB of archives.
After this operation, 88.1 kB disk space will be freed.
Do you want to continue [Y/n]? y
Get:1 http://us.archive.ubuntu.com/ubuntu/ precise/main libusb-0.1-4 amd64 2:0.1.12-20 [17.6 kB]
Get:2 http://us.archive.ubuntu.com/ubuntu/ precise/main libusb-1.0-0 amd64 2:1.0.9~rc3-2 [30.9 kB]
Get:3 http://us.archive.ubuntu.com/ubuntu/ precise/main libpcsclite1 amd64 1.7.4-2ubuntu1 [23.5 kB]
Get:4 http://us.archive.ubuntu.com/ubuntu/ precise/main libusbmuxd1 amd64 1.0.7-2 [14.1 kB]
 Fetched 86.0 kB in 0s (124 kB/s) 
Run Code Online (Sandbox Code Playgroud)

出于某种原因, pcscd 和 opensc 没有安装,可能是因为它没有安装,所以没有什么要升级的,没什么大不了的,我可以像这样使用精确作为参考来安装那个版本。

apt-get install opensc pcscd -t precise
Run Code Online (Sandbox Code Playgroud)

注意使用-t,packagename/precise也可以。

有你想要的包,从最新版本开始,只有那些包,它们也会自动更新。如果您不再需要它们,只需从中删除条目,/etc/apt/preferences下次运行时apt-get upgrade它们将被删除。如果您删除整个 prefs 文件,请务必删除该precise.list源文件,我们的系统将尝试更新到最新的软件包集。此外,如果您决定稍后进行 dist-upgrade,您将需要删除整个 prefs 文件,并且删除其他 source.list 可能是个好主意,因为优先级更高,升级将发现更少没有要更新的软件包。

Apt pinning 并不难,您只需要深入研究并进行实验。所有的n=等动词都是通过检查找到的apt-cache policy

这就是为什么经验丰富的管理员对 apt 和 yum 大喊大叫的原因。您可以简洁地更新服务并以干净、确定性和可维护的方式使它们保持最新状态。

也没有更多的编译包。

我强烈建议你阅读整个手册页并熟悉这个概念,并在继续这个建议之前阅读其他关于 apt pinning 的指南。祝好运并玩得开心点!

https://help.ubuntu.com/community/PinningHowto