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.
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.
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.
Do you really want to be running bleeding edge like that? I think even Fedoras development version is still running 2.2 (which is generally who gets bleeding edge first). I would give it some time before upgrading - there is a good reason why CentOS and RHEL wait until the new update is fully tested before releasing it.
I would strongly recommend you wait for a bit before updating.
The base install of CentOS is built with the idea of stability in mind over getting the latest version. See http://wiki.centos.org/FAQ/General#head-472ce8446ebcfc82ca1800f775ba0e629ac835c7
For this reason, Apache 2.4 is not available via the standard yum repositories.
However, you can do a manual install (which I try to avoid), or use a repository such as the one created by Jan Kaluza that allows you to install an instance of Apache 2.4 . For more information, see http://developerblog.redhat.com/2013/10/24/apache-httpd-2-4-on-red-hat-enterprise-linux-6/
There may be some other good repositories that you could use to get a clean version of 2.4 installed but this is what I know about.
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.
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 includeclean_requirements_on_remove=1
, see:man 5 yum.conf
Be sure to backup your configs!!
sudo cp -a /etc/httpd /etc/httpd.bak
Note: Removing httpd will also remove the
php
library required by the Apache 2.2mod_php
, but will retain thephp-cli
andphp-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.
Apache 2.4 CentOS 6 installation Guide
Install the Software Collections (SCL) repository [sic].
View available packages
Install Apache 2.4 and desired packages.
Note: All configuration files will be located in /opt/rh/root/etc/httpd
Add Apache 2.4 to the system environment $PATH.
Note: This will need to be repeated upon server restart. [sic]
Validate Apache service version and system environment $PATH.
Start Apache 2.4 and enable it to run at boot time.
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 asmod_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].
List available packages.
Install IUS Aapche 2.4 and desired packages.
Validate Apache service version and system environment $PATH.
Start IUS Apache 2.4 and enable it to run at boot time.
Explanation on SCL, IUS and Remi repositories: https://www.hogarthuk.com/?q=node/15
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.
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
Do you really want to be running bleeding edge like that? I think even Fedoras development version is still running 2.2 (which is generally who gets bleeding edge first). I would give it some time before upgrading - there is a good reason why CentOS and RHEL wait until the new update is fully tested before releasing it.
I would strongly recommend you wait for a bit before updating.