Saturday, October 31, 2020

Install Apache Web Server on Ubuntu System

Must read

How to Setup a Firewall with UFW on Ubuntu 20.04

Nowadays, a Firewall is an essential utility and property of any system for security; by default Ubuntu Operating system having a firewall...

How to Install Ruby on Ubuntu 20.04 Linux

Nowadays, Ruby is the most popular language, especially for SaaS application development. It has a perfect and elegant syntax structure, and it...

How to Install Eclipse IDE on Ubuntu 20.04 Linux

Eclipse is the most famous and widely used Java integrated development environment (IDE). It supports many plugins to enhance the capabilities to...

The 30 most useful Linux commands

This article will introduce some practical and common Linux or Unix command , which is the Linux system administrators normally use the command . This article is not a...
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.
- Advertisement -

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: 

- Advertisement -

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

- Advertisement -
$ 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
- Advertisement -

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.

- Advertisement -
- Advertisement -

More articles

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Subscribe to our newsletter

To be updated with all the latest news, offers and special announcements.

Latest article

How to Setup a Firewall with UFW on Ubuntu 20.04

Nowadays, a Firewall is an essential utility and property of any system for security; by default Ubuntu Operating system having a firewall...

How to Install Ruby on Ubuntu 20.04 Linux

Nowadays, Ruby is the most popular language, especially for SaaS application development. It has a perfect and elegant syntax structure, and it...

How to Install Eclipse IDE on Ubuntu 20.04 Linux

Eclipse is the most famous and widely used Java integrated development environment (IDE). It supports many plugins to enhance the capabilities to...

The 30 most useful Linux commands

This article will introduce some practical and common Linux or Unix command , which is the Linux system administrators normally use the command . This article is not a...

How to Reset the MySQL Root Password

Do you want to reset the MySQL root password? Sometimes we forget the root password and not able to log in on...