安装不同版本的软件包

Mic*_*les 9 package-management apt tomcat tomcat6

我正在运行 lucid 服务器并安装了 tomcat。它安装的版本是6.0.24-2ubuntu1.6。

这是我绑定的版本吗?是否可以安装更新的版本?Maverick 提供的版本是 6.0.28。

也许我可以添加一个源来提供这个版本的 lucid 安装?在包管理器用户界面中,我可以“强制版本”。是否也可以从命令行替代强制版本?

Jay*_*yen 6

简短的回答:

使用固定,您可以选择哪些包来自特立独行,并自动获取它们的依赖项,并通过包管理器使它们保持最新状态。 https://help.ubuntu.com/community/PinningHowto

https://askubuntu.com/a/103338/42024复制的长答案:

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

因此,让我们假设您使用的是 Oneiric 并且您想从 Precise 获取这些软件包。

如果您阅读该人,您会看到我复制/粘贴了相关部分并修改了发布名称

/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

# 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
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 文件,请确保删除该 precision.list 源文件以及我们的系统将尝试更新到最新的软件包集。此外,如果您决定稍后进行 dist-upgrade,您将需要删除整个 prefs 文件,并且删除其他 source.list 可能是个好主意,因为优先级更高,升级将发现更少没有要更新的软件包。

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

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

也没有更多的编译包。

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

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