How to install Apache Server in Linux
The Apache webserver is a open source HTTP Server for Linux and windows.
Debian and Ubuntu distributions refer to Apache as “Apache2” and the configuration file of Apache2 is /etc/apache2/apache2.conf.
CentOS/RHEL refer to Apache as httpd and configuration file of httpd is /etc/httpd/httpd.conf.
The default document root is
/var/www/htmlin all distributions.
For Cent OS / RHEL
Apache Installation
Run the below command for installation
# yum install httpd
Apache doesn’t start automatically. Run the below command for start the Apache Server.
# service httpd start
To check the current running status of the Apache server, Run the below command
# service httpd status
For Restart the Apache Server run the below command.
# service httpd restart
For Stop the Apache Server run the below command.
# service httpd stop
Ubuntu & Debian
Apache Installation
Run the below command for installation
# apt-get install apache2
Run the below command for start the Apache Process.
# /etc/init.d/apache2 start
To check the current running status of the Apache server, Run the below command
# /etc/init.d/apache2 status
For Restart the Apache Server run the below command.
# /etc/init.d/apache2 restart
For Stop the Apache Server run the below command.
# /etc/init.d/apache2 stop
