我正在运行 Ubuntu 14.04.5 和 Apache 2.4.7。我希望在 LocationMatch 指令中获得对命名组和反向引用的支持,该指令是(未发布)的一部分2.4.8。看来我应该能够安装 2.4.10,但我还没搞清楚如何安装。我发现类似问题这里,但我对版本控制和 APT 不够熟悉,无法弄清楚如何让它做我想做的事情。我该如何升级 Apache 才能获得这些功能?这与优先级数字有关吗?是否有令人信服的理由不这样做?
ubuntu@server:/$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 14.04.5 LTS
Release: 14.04
Codename: trusty
ubuntu@server:/$ apt-cache policy apache2
apache2:
Installed: 2.4.7-1ubuntu4.20
Candidate: 2.4.7-1ubuntu4.20
Version table:
2.4.10-1ubuntu1.1~ubuntu14.04.2 0
100 http://us-east-1.ec2.archive.ubuntu.com/ubuntu/ trusty-backports/main amd64 Packages
*** 2.4.7-1ubuntu4.20 0
500 http://us-east-1.ec2.archive.ubuntu.com/ubuntu/ trusty-updates/main amd64 Packages
500 http://security.ubuntu.com/ubuntu/ trusty-security/main amd64 Packages
100 /var/lib/dpkg/status
2.4.7-1ubuntu4 0
500 http://us-east-1.ec2.archive.ubuntu.com/ubuntu/ trusty/main amd64 Packages
ubuntu@server:/$ apt-cache madison apache2
apache2 | 2.4.10-1ubuntu1.1~ubuntu14.04.2 | http://us-east-1.ec2.archive.ubuntu.com/ubuntu/ trusty-backports/main amd64 Packages
apache2 | 2.4.7-1ubuntu4.20 | http://us-east-1.ec2.archive.ubuntu.com/ubuntu/ trusty-updates/main amd64 Packages
apache2 | 2.4.7-1ubuntu4.20 | http://security.ubuntu.com/ubuntu/ trusty-security/main amd64 Packages
apache2 | 2.4.7-1ubuntu4 | http://us-east-1.ec2.archive.ubuntu.com/ubuntu/ trusty/main amd64 Packages
apache2 | 2.4.7-1ubuntu4 | http://us-east-1.ec2.archive.ubuntu.com/ubuntu/ trusty/main Sources
apache2 | 2.4.7-1ubuntu4.20 | http://us-east-1.ec2.archive.ubuntu.com/ubuntu/ trusty-updates/main Sources
apache2 | 2.4.10-1ubuntu1.1~ubuntu14.04.2 | http://us-east-1.ec2.archive.ubuntu.com/ubuntu/ trusty-backports/main Sources
apache2 | 2.4.7-1ubuntu4.20 | http://security.ubuntu.com/ubuntu/ trusty-security/main Sources
ubuntu@server:/$ sudo apt-get install apache2=2.4.10-1ubuntu1.1~ubuntu14.04.2
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following extra packages will be installed:
apache2
Suggested packages:
apache2-doc
0 upgraded, 0 newly installed, 0 to remove and 11 not upgraded.
ubuntu@server:/$ sudo apt-get -s upgrade
Reading package lists... Done
Building dependency tree
Reading state information... Done
Calculating upgrade... Done
The following packages have been kept back:
linux-headers-generic linux-headers-virtual linux-image-virtual
linux-virtual
The following packages will be upgraded:
libapache2-mod-php5 php5-cli php5-common php5-gd php5-ldap php5-mysqlnd
php5-readline
7 upgraded, 0 newly installed, 0 to remove and 4 not upgraded.
Inst php5-readline [5.5.9+dfsg-1ubuntu4.24] (5.5.9+dfsg-1ubuntu4.25 Ubuntu:14.04/trusty-updates [amd64]) []
Inst php5-cli [5.5.9+dfsg-1ubuntu4.24] (5.5.9+dfsg-1ubuntu4.25 Ubuntu:14.04/trusty-updates [amd64]) []
Inst php5-ldap [5.5.9+dfsg-1ubuntu4.24] (5.5.9+dfsg-1ubuntu4.25 Ubuntu:14.04/trusty-updates [amd64]) []
Inst libapache2-mod-php5 [5.5.9+dfsg-1ubuntu4.24] (5.5.9+dfsg-1ubuntu4.25 Ubuntu:14.04/trusty-updates [amd64]) []
Inst php5-mysqlnd [5.5.9+dfsg-1ubuntu4.24] (5.5.9+dfsg-1ubuntu4.25 Ubuntu:14.04/trusty-updates [amd64]) []
Inst php5-gd [5.5.9+dfsg-1ubuntu4.24] (5.5.9+dfsg-1ubuntu4.25 Ubuntu:14.04/trusty-updates [amd64]) []
Inst php5-common [5.5.9+dfsg-1ubuntu4.24] (5.5.9+dfsg-1ubuntu4.25 Ubuntu:14.04/trusty-updates [amd64])
Conf php5-common (5.5.9+dfsg-1ubuntu4.25 Ubuntu:14.04/trusty-updates [amd64])
Conf php5-cli (5.5.9+dfsg-1ubuntu4.25 Ubuntu:14.04/trusty-updates [amd64])
Conf php5-readline (5.5.9+dfsg-1ubuntu4.25 Ubuntu:14.04/trusty-updates [amd64])
Conf php5-ldap (5.5.9+dfsg-1ubuntu4.25 Ubuntu:14.04/trusty-updates [amd64])
Conf libapache2-mod-php5 (5.5.9+dfsg-1ubuntu4.25 Ubuntu:14.04/trusty-updates [amd64])
Conf php5-mysqlnd (5.5.9+dfsg-1ubuntu4.25 Ubuntu:14.04/trusty-updates [amd64])
Conf php5-gd (5.5.9+dfsg-1ubuntu4.25 Ubuntu:14.04/trusty-updates [amd64])
答案1
正如您在 madison 输出中看到的,2.4.10
可以在 Backports 存储库中使用。
您需要指定从 Backports 存储库安装apt-get install apache2/trusty-backports
。这里棘手的部分是,与主存储库相比,Backports 存储库在错误修复和安全更新方面不太受支持。
我的第一个建议是升级到较新版本的操作系统,因为 Trusty 已经过时了。
我的第二个建议是使用上述命令从 backport 安装。但是,如果软件包需要较旧版本的 Apache 且未针对“较新”的 Apache 进行重建,则可能会出现版本不匹配错误。
答案2
对我有用的解决方案是添加 ppaondrej/apache2. 它有适用于 14.04 的版本 2.4.33-1。
从 ppa 获取软件总是存在一些风险,但这个似乎很受尊重,而且我已经使用了好几年,没有发生任何事故。
注意:据我所知,当我第一次添加这个 ppa 时,它为我设置了对当时正在使用的 apache2 版本的重大升级,并且花了一段时间才让我的网站再次运行。