Today we are going to install the latest version of Apache “Apache 2.4.23” on a new fresh updated CentOS 7. You can use this tutorial for CentOS 6 as well.
Make sure you have already installed following packages on your server.
yum install gcc
yum install make
yum install openssl-devel
yum install apr-devel
yum install apr-util-devel
yum install wget
Then, we will choose the latest version from Apache website. and download it.
An update: If you are using this article on CentOS 7, the APR version on yum won’t work for you, and you should compile the apr, and apr-util from source, so please remove it from your server if you installed it via yum, and try following:
tar xvfz apr-1.5.2.tar.gz
tar xvfz apr-util-1.5.4.tar.gz
make && make install
./configure –bindir=/usr/bin/ –with-apr=/usr/bin/apr-1-config
make && make install
Now you are able to continue with the rest of guide.
tar xvfz httpd-2.4.23.tar.gz
Now we will start building Apache from source and install it on our server.
We have to know which module of apache we want to install and include them on the ./configure command. It is really easy, as you only need to know the module name and type it with “–enable-(module-name)”. For example, we want to install apache with SSL module, so we will type “–enable-ssl”
By default, Apache will install all its architecture-independent files in “/usr/local/apache2”. If you want to change this directory we have to set the –prefix option in ./configure . I will use /etc/httpd/ for this option in this tutorial. But, make sure that you are not overwriting your old configuration if you already have installed apache before. I am also using “–sbindir” option to specify the directory where system administrator executables will be installed. Those are server programs like httpd, apachectl, suexec, etc. which are necessary to run the Apache HTTP Server.
./configure –prefix=/etc/httpd/ –sbindir=/sbin/ –enable-ssl –enable-so
Now we are ready to go, we can start Apache server and go ahead with configurations.
That’s it! should you have any question or problem regarding this post please leave a comment below.