root@ubuntu:/home/ubuntu# apt-cache policy apache2 apache2: Installed: (none) Candidate: 2.4.7-1ubuntu4.1 Version table: 2.4.7-1ubuntu4.1 0 500 http://nova.clouds.archive.ubuntu.com/ubuntu/ trusty-updates/main amd64 Packages 500 http://security.ubuntu.com/ubuntu/ trusty-security/main amd64 Packages 2.4.7-1ubuntu4 0 500 http://nova.clouds.archive.ubuntu.com/ubuntu/ trusty/main amd64 Packages
然後在知道版本名稱後,需要安裝特定版本的套件時,就可以透過指定版本來達成。
apt-get install apache2=2.4.7-1ubuntu4
不過以 Ubuntu 14.04 來說,想要安裝 Apache2 的 2.4.7-lubuntu4 版本會出現以下的錯誤
Reading package lists... Done Building dependency tree Reading state information... Done Some packages could not be installed. This may mean that you have requested an impossible situation or if you are using the unstable distribution that some required packages have not yet been created or been moved out of Incoming. The following information may help to resolve the situation: The following packages have unmet dependencies: apache2 : Depends: apache2-bin (= 2.4.7-1ubuntu4) but 2.4.7-1ubuntu4.1 is to be installed Depends: apache2-data (= 2.4.7-1ubuntu4) but 2.4.7-1ubuntu4.1 is to be installed Recommends: ssl-cert but it is not going to be installed E: Unable to correct problems, you have held broken packages.就是說相關的套件也必須特別指定對應的版本,才有辦法正常地完成安裝
因此就 Apache2 這個例子來說,必須要針對 apache2、apache2-bin 和 apache2-data 三個套件都指定版本:
apt-get install apache2=2.4.7-1ubuntu4 apache2-bin=2.4.7-1ubuntu4 apache2-data=2.4.7-1ubuntu4
參考資料:
1、How can I check the available version of a package in the repositories?
2、How to install specific Ubuntu packages, with exact version?
沒有留言:
張貼留言