Installing from source used to be very common and also quite simple. You would download the source file, unpack it (with either zip or tar), then issue the commands to the the directory you want to install it.

Crons:
  1. Allows us to install required version.
  2. Customizing Modules.
  3. To configure and integrate with other source packages.

    In this articles we gonna install the Apache through source file on /usr/local/ directory.

Get the source file for the desired version from the official website of Apache, where you can find the latest version. click here to download latest package

You can either download or wget the file (tar.gz and tar.bz2 are available).

$ wget http://mirrors.estointernet.in/apache//httpd/httpd-2.4.37.tar.gz

Untar the package,

$ tar -xzf httpd-2.4.37.tar.gz

On default apache the portable runtime libraries are installed by default, when it comes to source installation you have to install it manually. To know more about APR click here

Download the apr and apr-util,

APR:

$ wget http://mirrors.estointernet.in/apache//apr/apr-1.6.5.tar.gz

APR-UTILS:

$ wget http://mirrors.estointernet.in/apache//apr/apr-util-1.6.1.tar.gz

Untar the packages,

$ tar -xzf apr-1.6.5.tar.gz

$ tar -xzf apr-util-1.6.1.tar.gz

Rename the packages to apr and apr-utils,

$ mv apr-1.6.5 apr

$ mv apr-util-1.6.1 apr-util


Move the directories to the the source library of the extracted apache directory,

$ mv apr apr-util /usr/local/src/httpd-2.4.37/srclib/

In Source installation there are 3 necessary commands to be used ./confgiure, make and make install.

On source installation apache should met some dependencies to be installed,

For Centos,

$ yum install pcre-devel zlib-devel openssl-devel gcc expat-devel

For Ubuntu,

$ apt-get install libpcre3 libpcre3-dev zlib1g-dev libssl-dev

Run the below ./configure command which installs apache on the desired path with the modules enabled for a basic installation.

$ ./configure --prefix=/usr/local/apache-2.4.37 --enable-so --enable-auth-digest --enable-rewrite --enable-setenvif --enable-mime --enable-deflate --enable-ssl --enable-headers --enable-proxy --enable-proxy-connect --enable-proxy-http --enable-unique-id --enable-disk-cache --enable-cache --enable-memory-cache --with-included-apr --enable-usertrack

    You can also add modules according to your setup, the above command enables basic modules for apache.

    Run make and make install once the configure is completed,

$ make


$ make install


The default conf file will be  /usr/local/apache-2.4.37/conf/httpd.conf

Now start the customized installed apache installed on your /usr/local/ directory.

$ /usr/local/apache-2.4.37/bin/apachectl/ start

To test your configuration you can use the below command,

$ /usr/local/apache-2.4.37/bin/apachectl/ -t

Enter the browser and enter the IP of the system or 127.0.0.1 if it is installed in local system. You can view the test page as It works on your browser.


Now you have successfully installed and configured customized apache on your system.

For older versions click Older Version


Feel free to ask if you have any questions.


Comments

  1. Be the first to add a comment.