Compiling and Installing Apache with APR

Compiling and Installing Apache is always useful if your Linux box doesn't have direct access to Internet. There are situation that might due  to security reason.

 Before installation of apache we will first start with installation of APR and APR-UTIL. You can download the APR and APR-UTIL from Apache Site.  After download extract the zip folder with tar command.

For tar.tg extension use command.
tar -xzf  apr-1.4.6.tar.gz

For tar.bz2 extension use command
tar -xjf   apr-1.4.6.tar.bz2

After extraction a folder apr-1.4.6 will be created. Go to the folder and check configure file. Check the permission whether it has execute permission. Then run the command.
./configure --prefix=/usr/local/

Check for any error after running the command , you can ignore the warning if any.
make install.
You have successfully installed apr.

For APR-UTILS download the apr-util zip file from Apache Site. The latest may be apr-util-1.5.1.tar.gz. The file may have the tar.gz or tar.bz2 use above mentioned tar command for their respective file extension.

After extraction go the folder apr-util-1.5.1 and check for configure file and execute permission is present. Then run the command.
./configure --prefix=/usr/local/apr-util  --with-apr=/usr/local/apr/

Download the source code from the Apache Site. Download version which you want. The latest version of httpd is  httpd-2.0.64.tar.gz. Unzip the file and folder httpd-2.0.64 will created. Go the folder check for file permission of the configure file. Run the following command.

 ./configure --prefix=/root/Apache --enable-authn-anon --enable-proxy --enable-proxy-ajp --enable-proxy-balancer --with-apr=/usr/local/apr --with-apr-util=/usr/local/apr --with-ssl=/usr/local/ssl

Check for any error and you can ignore the warning.
Run the following command.
make install. 

The apache will be install in the /root/Apache folder. Create a user apache for running the Apache server.
Simple command to add user is
useradd apache 

Go to Apache/conf/httpd.conf file. Search for user you will find user=daemon change to apache. Then change owner of the insalled Apache to apache.

Before starting check if the port is occupied. You can check port using netstat command.
netstat -lnpt

Now to run the httpd server. Go Apache/bin
./httpd -k start. 

Now go the browser and hit the address http://your-machineip/hostname/
Then you will a page showing 'It Works'.


You installation is Done.

No comments:

Post a Comment