20

I need Apache 2.4 in CentOS because with Apache 2.2 mod_proxy_wstunnel is not possible. I have tried this, but unfortunately its for RHEL. After installing, I can't execute the Apache 2.4.

Can anyone show me how to install a complete working Apache 2.4 in CentOS, please?

EDIT:

# yum list installed | grep httpd
Failed to set locale, defaulting to C
httpd.x86_64                         2.2.15-30.el6.centos       @updates        
httpd-tools.x86_64                   2.2.15-30.el6.centos       @updates        
httpd24.x86_64                       1-6.el6                    @epel-httpd24   
httpd24-apr.x86_64                   1.4.8-2.el6                @epel-httpd24   
httpd24-apr-util.x86_64              1.5.2-5.el6                @epel-httpd24   
httpd24-httpd.x86_64                 2.4.6-5.el6                @epel-httpd24   
httpd24-httpd-tools.x86_64           2.4.6-5.el6                @epel-httpd24   
httpd24-mod_ssl.x86_64               1:2.4.6-5.el6              @epel-httpd24   
httpd24-runtime.x86_64               1-6.el6                    @epel-httpd24   
roaima
  • 107,089
  • 14
  • 139
  • 261
  • 1
    Try http://unix.stackexchange.com/questions/121001/how-to-upgrade-apache-2-2-15-to-2-4-4-in-centos – garethTheRed Jun 24 '14 at 08:55
  • Thank you. See my answer please, they way i requested, cause the original link is still confusing for someone to get started. –  Jun 24 '14 at 09:10
  • you'll need to run yum install httpd24-httpd how do you install this to replace the Apache 2.2.15 that comes with the distro so I can install the update and use `httpd` instead of `httpd24-httpd` with the `service start` and `stop` commands? –  Nov 25 '14 at 18:26
  • 1
    The easiest way is to install the SCL version, as described here: https://unix.stackexchange.com/questions/412122/how-to-update-apache-to-2-4-29-using-scl – CpnCrunch Apr 10 '18 at 20:45

1 Answers1

24

Apache 2.4 on CentOS:

Step 1:

cd /etc/yum.repos.d/
wget http://repos.fedorapeople.org/repos/jkaluza/httpd24/epel-httpd24.repo

Step 2:

yum install httpd24.x86_64

Step 3:

$ /opt/rh/httpd24/root/usr/sbin/httpd -version
Server version: Apache/2.4.6 (Red Hat)
Server built:   Sep 25 2013 05:25:46

NOTE: config files are in: /opt/rh/httpd24/root/etc/httpd

$ ls
conf  conf.d  conf.modules.d  logs  modules  run

EDIT: in case you want to switch off Apache 2.2

$ chkconfig httpd off
$ chkconfig --list | grep httpd
httpd           0:off   1:off   2:off   3:off   4:off   5:off   6:off
httpd24-httpd   0:off   1:off   2:off   3:off   4:off   5:off   6:off

EDIT 2: http://wiki.apache.org/httpd/PHP-FPM

yum install php-fpm
/etc/init.d/php-fpm start
Kevdog777
  • 3,194
  • 18
  • 43
  • 64
  • 6
    You should be able to start the service with `# service httpd24-httpd start`. Before that you must either stop the original httpd service (apache 2.2) or configure your apache 2.4 to listen on an alternative port (not port 80). – garethTheRed Jun 24 '14 at 09:32
  • @garethTheRed: how to get ECDHE-RSA-AES256-SHA? with this its not available as a result you cant use SSLCiperSuite ECHDE.. is there any other repo which has this fixed? –  Aug 21 '14 at 21:03
  • I'm not certain of the details of indivdual repos. If you can't find what you need, you could always compile the correct version for your system. If you don't want to do that on the actual server, you could also consider using the copr build system and use a CentOS 7 rpm source as a starting point. – garethTheRed Aug 22 '14 at 05:24
  • 1
    Using that repo I'm getting this error: http://repos.fedorapeople.org/repos/jkaluza/httpd24/epel-6/x86_64/repodata/repomd.xml: [Errno 14] problem making ssl connection – poisa Jan 16 '15 at 16:51
  • 3
    The repo for me is quite useless. It still contains Apache/2.4.6 from 2013. That's quite disappointing that apache can't maintain its own repository... – szymond Jul 07 '15 at 07:07
  • 1
    Being an older version of apache isn't a problem. The 2.2.15 apache in Centos 6 is from 2010 after all. What is more of a problem is that it isn't updated with bugfixes and security fixes. – CpnCrunch Jul 21 '16 at 23:27
  • How can you tell the version number stored in the repository? I need to get 2.4.28. – UncaAlby Oct 12 '17 at 14:25
  • 1
    Here is the best answer: https://unix.stackexchange.com/questions/412122/how-to-update-apache-to-2-4-29-using-scl – CpnCrunch Apr 10 '18 at 20:46
  • Please note that if you are using php, httpd24-httpd works best with rh-php## from the Red Hat Software Collections. I had php installed from the remi repository and it was not working as smoothly together. – Mike Godin Oct 09 '20 at 13:04
  • Hello, I found this link very helpful nowadays: https://www.linode.com/community/questions/18167/how-do-i-install-a-newer-version-of-apache-on-centos-7 – aniskh Nov 10 '21 at 08:56