Need to configure Apache on your Debian Server?
This guide is for you.
Apache is the most commonly used Web server on Linux systems. Web servers are used to serve Web pages requested by client computers.
This configuration is termed LAMP (Linux, Apache, MySQL and Perl/Python/PHP) and forms a powerful and robust platform for the development and deployment of Web-based applications.
In this context, we shall look into how to install and configure Apache on Linux server.
How to install Apache on Ubuntu ?
Apache is the most popular web server developed by Apache Software Foundation. It offers several features that make it very useful for websites. Apache HTTP server is supported on all operating systems including Linux, Windows, MacOS, FreeBSD, etc. It is also a part of the web service stack-LAMP stack.
Apache is available in the official repositories of Linux Ubuntu. Therefore, we can easily install it using the apt-get install command.
Following are the steps to install Apache on Linux.
1. Update System Repositories
First, Login into your Server as the root user or with sudo privileges update the system repositories using the following command in Terminal:
$ sudo apt-get update
2. Install Apache
Now in order to install Apache, issue the following command in Terminal:
$ sudo apt-get install apache2
When prompted for confirmation, hit y, after which the installation of Apache will be started on your system.
Depending on your network connection, the installation of Apache may take some time.
3. Verify Apache Installation
Once the installation of Apache is completed, you can verify it using the following command in Terminal:
$ apache2 -v
Now the version of Apache installed will be displayed as an output to the above command.
You can also view the status of Apache service to verify if it is properly running. Issue the following command in Terminal to do so:
$ systemctl status apache2
The active (running) status in the output shows that the Apache service is active and running.
In case, the service is not started automatically, you can start it using the below command:
$ sudo systemctl start apache2
How to Access Apache Default Webpage ?
You can also confirm if the Apache service is successfully running by accessing the Apache default webpage. To do so, type your system's hostname or IP address in the location bar of any browser.
http://<host_name or ip_address>
You will see a page which shows that Apache has been successfully installed on your system.
If you want to access the Apache from another system on the network, you will need to configure a rule in the firewall settings.
How to Remove Apache from Ubuntu ?
In case, you no longer need Apache server on your system, you can easily remove it using the below command:
$ sudo apt-get remove apache2
When prompted for confirmation, hit y, after which the system will remove Apache.