我将使用该apt
系列中的其他方便的版本控制命令扩展先前的答案。要查看可用的版本,请运行apt-cache policy
:
# apt-cache policy apache2
apache2:
Installed: (none)
Candidate: 2.4.7-1ubuntu4.5
Version table:
2.4.10-1ubuntu1.1~ubuntu14.04.1 0
100 http://us.archive.ubuntu.com/ubuntu/ trusty-backports/main amd64 Packages
2.4.7-1ubuntu4.5 0
500 http://security.ubuntu.com/ubuntu/ trusty-security/main amd64 Packages
2.4.7-1ubuntu4 0
500 http://us.archive.ubuntu.com/ubuntu/ trusty/main amd64 Packages
然后,如其他地方所述,使用安装特定版本apt-get
:
# apt-get install apache2=2.4.7-1ubuntu4.5
...
现在,您可以通过apt-cache policy
再次运行来查看已安装的版本:
# apt-cache policy apache2
apache2:
Installed: 2.4.7-1ubuntu4.5
Candidate: 2.4.7-1ubuntu4.5
Version table:
2.4.10-1ubuntu1.1~ubuntu14.04.1 0
100 http://us.archive.ubuntu.com/ubuntu/ trusty-backports/main amd64 Packages
*** 2.4.7-1ubuntu4.5 0
500 http://security.ubuntu.com/ubuntu/ trusty-security/main amd64 Packages
100 /var/lib/dpkg/status
2.4.7-1ubuntu4 0
500 http://us.archive.ubuntu.com/ubuntu/ trusty/main amd64 Packages
如果您不希望在更新中安装较新的版本,请使用以下方式将该软件包固定apt-mark
:
# apt-mark hold apache2
apache2 set on hold.
假设新版本的apache2已添加到包索引中,并且您的计算机已与同步apt-get update
。下次运行时,您会看到以下内容apt-get upgrade
:
# apt-get upgrade
Reading package lists... Done
Building dependency tree
Reading state information... Done
Calculating upgrade... Done
The following packages have been kept back:
apache2
0 upgraded, 0 newly installed, 0 to remove and 1 not upgraded.