Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Upgrade Apache 2.2 -> 2.4

Tags:

apache

yum

We have currently installed Apache 2.2. Now, is there a Yum repository with Apache 2.4 on it?

Regards, Kevin

like image 719
www.data-blogger.com Avatar asked Mar 03 '12 10:03

www.data-blogger.com


2 Answers

While it is not known which distro of Linux is being used by the OP, this may be useful to others running CentOS 6 who are wanting to use yum to upgrade from Apache 2.2 to 2.4.

There are two repository based methods of upgrading to Apache 2.4, SCL and IUS. I cover both methods in this post.

First you will need to prepare your current server environment.

If you have Apache 2.2 currently installed, shutdown the service and disable it from running at boot time.

sudo service httpd stop 
sudo chkconfig httpd off

Remove Apache 2.2 (optional for SCL method)

Note: if you want to remove any residual unused dependencies, be sure to alter your /etc/yum.conf to include clean_requirements_on_remove=1, see: man 5 yum.conf

Be sure to backup your configs!! sudo cp -a /etc/httpd /etc/httpd.bak

sudo yum remove httpd

Note: Removing httpd will also remove the php library required by the Apache 2.2 mod_php, but will retain the php-cli and php-common libraries and extensions.


Software Collections (SCL) Method

With the release of CentOS 6 Software Collections, the ability to install and run applications of differing versions alongside the defaults from a repository is now available. [sic]

Out of the two options (SCL vs IUS) the SCL method is the most compatible/safe with non-matching dependencies, in that the dependencies required for any of the SCL packages are maintained separately from the core packages and will generally not cause conflicts.

Enter Software Collections, also known as SCLs. As an example, SCLs allow you to run the default python that comes with CentOS (so yum and other system tools in CentOS work), while also allowing a newer version of python to be installed alongside the default python for use creating and running software with newer requirements.

Apache 2.4 CentOS 6 installation Guide

Install the Software Collections (SCL) repository [sic].

 sudo yum install centos-release-scl

View available packages

sudo yum --disablerepo="*" --enablerepo="centos-sclo-rh" list available httpd24\*

Install Apache 2.4 and desired packages.

sudo yum --enablerepo=centos-sclo-rh -y install httpd24

Note: All configuration files will be located in /opt/rh/root/etc/httpd

Add Apache 2.4 to the system environment $PATH.

sudo scl enable httpd24 bash

Note: This will need to be repeated upon server restart. [sic]

Validate Apache service version and system environment $PATH.

which httpd
httpd -V

Start Apache 2.4 and enable it to run at boot time.

sudo service httpd24-httpd start
sudo chkconfig httpd24-httpd on

IUS Method

Alternatively to replace Apache 2.2 with Apache 2.4, so that the paths and service commands work identically, you can use the IUS repository instead.

Note: This method conflicts with the default CentOS Apache 2.2 packages and their dependencies. In addition you must run PHP through php-fpm service as mod_php is not compatible. Please consider carefully any dependencies you may have and the order you must load them before choosing this option. [sic]

Follow the step above to Shutdown, Backup and Remove Apache 2.2. Skip All of the Software Collections (SCL) steps as they are replaced with the IUS steps below.

Install IUS repository [sic].

sudo yum install https://centos6.iuscommunity.org/ius-release.rpm

List available packages.

sudo yum --disablerepo="*" --enablerepo="ius" list available httpd24u\*

Install IUS Aapche 2.4 and desired packages.

sudo yum --enablerepo=ius install -y httpd24u

Validate Apache service version and system environment $PATH.

which httpd
httpd -V

Start IUS Apache 2.4 and enable it to run at boot time.

sudo service httpd start
sudo chkconfig httpd on

Explanation on SCL, IUS and Remi repositories: https://wiki.centos.org/HowTos/NewerApps


Disclaimer This post only describes the methods of installing Apache 2.4 on CentOS 6. It is outside the scope of these instructions to update the configuration settings or modules that have been changed or removed between the different versions. Please see the upgrading 2.4 documentation on the Apache website to update your configuration settings.

like image 191
Will B. Avatar answered Oct 05 '22 05:10

Will B.


Apache 2.4 is pretty much a production-ready release now. You will probably have to build it from source. Here is a tutorial for installing Apache 2.4.2 from Source on CentOS

like image 25
delimited Avatar answered Oct 05 '22 05:10

delimited