How to install apache server source package on Linux server?

Step1 : Check if the package is installed or not

#find / -iname httpd.conf

If you did not find any thing related to apache by using above find command you can install the source package.

Step2 : We can install source package in /opt for our requirement. Download the package from apache software foundation site

#cd /opt


Step3 : Uncompress it and change the directory to source directory

#tar xvfz httpd-2.2.17.tar.gz

#cd httpd-2.2.17

Step4 : Now compile the source code


#make install


The above three commands can be clubbed together to save time

#./configure && make && make install

Note1 : All the configuration files related to apache are stored in /usr/local/apache2/ When we install the source package by default. But if we install it through package installation softwares such as rpm/yum/apt-get the configuration files are stored in /etc/httpd folder

Note2 : This is important and interview question too. Can we run two apache servers at a time? 

Ans : The answer to this question is yes. And it's possible if we use source package to install in two different locations say in /opt and /opt1 and the variable “Listen” is set to different. Ports for this two servers(Bit complex to understand. If you have any questions ask it at our new Linux/Unix forums not officially announced. 

Step5 : Now start the service.

#/usr/local/apache2/bin/apachectl start

Step6 : Check if the web server is running or not by accessing local host

#elinks localhost


Access localhost from browser