How to install and remove Apache webserver in Ubuntu and Debian

To install Apache web server in Ubuntu and Debian is easy task. If you have worked on any Red Hat based operating system ,you may find the Apache webserver package name is different.
In Red Hat based Operating System the package name is httpd.

In Debian based operating system like Ubuntu, Linux Mint etc. You can install apache web server by using below given command.

sudo apt-get install apache2

Important information related to Apache web server in Debian based Operating System

Apache User : www-data
Configuration Directory : /etc/apache2
By-Default configuration file : /etc/apache2/sites-enabled/000-default
By-Default Data Directory or Document Directory : /var/www
Logs Directory Path : /var/log/apache2

To start the apache webserver

/etc/init.d/apache2 start

OR

service apache2 start

After starting/restarting/reloading the Apache service,type the IP Address of Web server in Web browser. The first page will show you written “It Works!“.It means the apache service is running.

To stop the apache webserver

/etc/init.d/apache2 stop

OR

service apache2 stop

To restart the apache webserver

/etc/init.d/apache2 restart

OR

service apache2 restart

To check status of the apache webserver

/etc/init.d/apache2 status

OR

service apache2 status

To reload the apache webserver

/etc/init.d/apache2 reload

OR

service apache2 reload

With Apache service there are many usage, you can get the information by using command /etc/init.d/apache2 --help

/etc/init.d/apache2 –help
* Usage: /etc/init.d/apache2 {start|stop|graceful-stop|restart|reload|force-reload|start-htcacheclean|stop-htcacheclean|status}

To remove apache webserver in Debian and Ubuntu

To remove apache webserver in Debian based Operating System,use the given below command.

sudo apt-get remove apache2

After this,to completely remove the package

sudo apt-get --purge apache2

Note: In some cases,system will show message to run apt-get autoremove,hence run this command if face issue while removing the package

Apache Web Server Project Page URL : http://httpd.apache.org/

Note: We can also install the Apache Web Server by using the source tarball.We will also discuss about installing Apache web server by using source tarball in upcoming posts.


Posted

in

,

by

Comments

One response to “How to install and remove Apache webserver in Ubuntu and Debian”

  1. NoName Avatar
    NoName

    It’s really work. Thank you more and more..!

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: