Tuesday, October 30, 2018

Install apache-2.4.37 in linux from source with APR and APR util


From the today tutorial, we are going to discuss how to install httpd-2.4.37(Apache-2.4.37) latest Apache stable version in Linux Cent/RHEL 7 OS with APR. 

If you are bored with reading, please skip "what is apr?" part. 

Please note that this all artical related to RHEL and CENT OS system. 


What is APR?

The Apache Portable Runtime (APR) is a supporting library for the Apache web server
It provides a set of APIs that map to the underlying operating system (OS).Where the OS does not support a particular function, APR will provide an emulation. Thus programmers can use the APR to make a program truly portable across platforms.
APR originally formed a part of Apache HTTP Server, but the Apache Software Foundation spun it off into a separate project. Other applications can use it to achieve platform independence.

Implementation with apache-2.4.37


1. Download needed packages from apache foundation. Use bellow commands to download needed sorce file. Please note that,this source packages will download your current working directory.

  • wget https://www-eu.apache.org/dist//httpd/httpd-2.4.37.tar.gz

  • wget https://www-eu.apache.org/dist//apr/apr-1.6.5.tar.gz

  • https://www-eu.apache.org/dist//apr/apr-util-1.6.1.tar.gz


In here APR util is dependency libraries for APR. You should download both APR and APR util for compile apache with APR.

Finally you can see downloaded files in location as bellow.



2. Untar apache (httpd-2.4.27.tar.gz) file(Extract file for installation).
  • tar -xzvf httpd-2.4.37.tar.gz
3.Move apr and apr utils to apache's include directory.
  • mv apr-1.6.5.tar.gz apr-util-1.6.1.tar.gz /opt/software/httpd-2.4.37/srclib/
4. Now go in to httpd's srclib location
  • cd /opt/software/httpd-2.4.37/srclib/
5.Untar apr and apr utiles in /opt/software/httpd-2.4.37/srclib/ location.
  • tar -xzvf apr-1.6.5.tar.gz
  • tar -xzvf apr-util-1.6.1.tar.gz
You can see as bellow of extracted files.


6. Rename apr-1.6.5 and apr-util-1.6.1 to apr and apr-util. Detailed screenshots below.
  • mv apr-1.6.5 apr
  • mv apr-util-1.6.1 apr-util


7. Now time to run compile command. Before run bellow commnd you should come back one directory from current location.Run bellow two commands.
  • cd ../
  • ./configure --with-included-apr
(If you getting any error when you run configure comman, you need to install required gcc packages for compile since APR is developed using C language. If error occur again,please install PCRE packages.Use below command if any error occure.
  • yum install gcc*(this will install all gcc packages. This will help for future since I install all gcc libraries)
  • yum install pcre*
 After installation done re-run above command. )

If you've done configure successfully, you'll see as following screenshot.




8. Now hard part of installation done. Now need to build apache in th system. use bellow commands to build and install apache in the system.
  • make
(If you getting error with make, most probably you are not installed expat and expat-devel package. intall them using bellow command.
  • yum install expat
  • yum install expat-devel 
  • make clean
  • make distclean
  • Now do again from step 7 again.)
Successful make.




9. So now all worst cases done. Finally run bellow command to install the apache.

  • make install
Successful make install




10. Now you've almost done your apache installation. So you need to getting live Apache now.
  • /usr/local/apache2/bin/apachectl start
You can check apache running status usin bellow command.
  • ps ax | grep http
  • lsof -i :80
  • netstat -tulpn | grep 80


Now you have successfully installed and running apache with apr on your RHEL/CENTOS server. This web server running with default apache configuration. From Next tutorial, Lets see how configure and customize apache for security and functioning purpose.

Enjoy with LINUX!!!

No comments:

Post a Comment