Install Apache Web Server on Ubuntu System

May 5, 2019

Comments

Adsense

Adsense

Adsense

Adsense

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.

Satish Kumar

Satish Kumar

I am Satish Kumar, Founder of LinuxConcept. Linux and F.O.S.S enthusiast, love to work on open source platform and technologies.

Adsense

Adsense

Adsense

Adsense

Adsense

Adsense

Adsense

Adsense

Adsense

Related Posts

How to add swap space on Ubuntu 20.04 Operating System

How to add swap space on Ubuntu 20.04 Operating System

The swap space is a unique space on the disk that is used by the system when Physical RAM is full. When a Linux machine runout the RAM it use swap space to move inactive pages from RAM. Swap space can be created into Linux system in two ways,...

0 Comments

0 Comments

Submit a Comment

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

2 × one =

News & Updates

Join Our Newsletter

Adsense

Adsense

Adsense

Adsense