Home » Apache » Install Apache Web Server on Ubuntu System

Install Apache Web Server on Ubuntu System

Last updated Sep 4, 2021

Introduction: Apache Web Server

The Apache HTTP server is the most common and widely-used web server on the internet world. The most of the websites and web applications are hosted on Apache web server. It has many powerful features like dynamically loading modules, outstanding media support, and having large integration with other popular software.

In this article, we’ll explain the process to install the Apache web server on Ubuntu system or server.

Prerequisites: 

Before following the installation steps, make sure you should have the following:

  • An Ubuntu system or server
  • A non-root user with sudo privileges
  • Internet connection on Ubuntu system

When you have an account to log in on Ubuntu system with sudo privileges log in and follow the below steps to install Apache web server.

Step 1 – Installing Apache

The Apache server package is available within Ubuntu’s default software repository, so we can install it by using the package management tool which is apt.

First, update your local package index:
$ sudo apt update

Now install the apache2 using below command

$ sudo apt install apache2

Step 2 – Adjust Firewall rules for apache2

To check the available application profile in ufw firewall, use the below command:

$ sudo ufw app list

Output:

Available applications:
	Apache
	Apache Full
	Apache Secure
	OpenSSH

Here you can see there is two profile for Apache, one is just “Apache,” and another one is “Apache Full.” Where Apache is the most restrictive profile that allows port 80 to run Apache server and Apache Full allows to open 80 and 443 both port for Apache server.

Here, you can enable anyone as per your convenience, I am enabling most restrictive profile by using below command:

$ sudo ufw allow ‘Apache’

After enabling, you can verify it by the following command:

$ sudo ufw status

Output:

Status: active
To                         Action      From
--                         ------      ----
OpenSSH                    ALLOW       Anywhere
Apache                     ALLOW       Anywhere
OpenSSH (v6)               ALLOW       Anywhere (v6)
Apache (v6)                ALLOW       Anywhere (v6)

Step 3 – Checking your Web Server status

You can check Apache service is running or not with the system init system by using the command.

$ sudo systemctl status apache2

Output:

● apache2.service - The Apache HTTP Server
   Loaded: loaded (/lib/systemd/system/apache2.service; enabled; vendor preset: enabled)
  Drop-In: /lib/systemd/system/apache2.service.d
           └─apache2-systemd.conf
   Active: active (running) since Tue 2019-07-03 20:14:39 UTC; 9min ago
 Main PID: 2583 (apache2)
    Tasks: 55 (limit: 1153)
   CGroup: /system.slice/apache2.service
           ├─2583 /usr/sbin/apache2 -k start
           ├─2585 /usr/sbin/apache2 -k start
           └─2586 /usr/sbin/apache2 -k start

You can access the default apache landing page by using the Ubuntu system’s IP in the browser address bar.

http://your-server-IP

If the Apache2 service is running, you will get below the Apache web page in your browser.

Step 4 – Apache service Handling Commands

To check the Apache’s service demon status, use the following command:

$ sudo systemctl status apache2
Or
$ sudo service apache2 status
Or
$ sudo /etc/init.d/apache2 status

To check the Apache’s service demon status, use the following command:

$ sudo systemctl start apache2
Or
$sudo service apache2 start
Or
$ sudo /etc/init.d/apache2 start

To stop the Apache’s service demon use the following command:

$ sudo systemctl apache2 stop
Or
$ sudo service apache2 stop
Or
$ sudo /etc/init.d/apache2 stop

Conclusion:

Now your apache http server is installed and ready to serve various content or web application through the internet.

Related Posts

Apache Web Server Configuration Files

Apache Web Server Configuration Files

The Apache web server is file-based configuration system so it is very easy to configure and you can configure dynamically for any new configuration.

Install Apache web server on Windows

Install Apache web server on Windows

The Apache web server is the most common web server on the internet world. The most of the websites and web applications hosted on Apache webserver.

What is a web server?

What is a web server?

A server is known as a web server when it hosts files or application which will server on the internet using the HTTP protocol.

What is Apache HTTP Server?

What is Apache HTTP Server?

The Apache web server software is free and open-source, licensed under the Apache license that allows users to use this web server software with full fre..

Follow Us

Our Communities

More on Apache

The Ultimate Managed Hosting Platform
Load WordPress Sites in as fast as 37ms!

0 Comments

0 Comments

Submit a Comment

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

15 − eight =

Shares