How to Install Apache in 4 Steps


Apache is a free and open-source web server that is one of the most used web servers of all time. Due to its efficiency and easy usage, it is used a lot by all. Apache is developed and maintained by Apache Foundation.

Apache is one of the earliest and most reliable web servers as it is being used for the past 20 years. So, the main job of the Apache HTTP web server is to make a connection between a browser and a server. Here we will learn how easy is to install and configure an Apache web server on an Ubuntu instance.

Step 1. Install Apache

Update the package list:

$ sudo apt update

Install Apache:

$ sudo apt install apache2

Step 2. Start the Apache webserver

 In most cases, Apache starts automatically.

Verify if the webserver has started

$ sudo systemctl status apache2
● 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
   Active: active (running) since Sun 2021-02-07 06:38:17 UTC; 31min ago
  Process: 16195 ExecStop=/usr/sbin/apachectl stop (code=exited, status=0/SUCCESS)
  Process: 16200 ExecStart=/usr/sbin/apachectl start (code=exited, status=0/SUCCESS)
 Main PID: 16214 (apache2)
    Tasks: 55 (limit: 1108)
   CGroup: /system.slice/apache2.service
           ├─16214 /usr/sbin/apache2 -k start
           ├─16218 /usr/sbin/apache2 -k start
           └─16219 /usr/sbin/apache2 -k start
Feb 07 06:38:17 localhost systemd[1]: Starting The Apache HTTP Server...
Feb 07 06:38:17 localhost apachectl[16200]: AH00558: apache2: Could not reliably determine the server's fully qualified domain name,
Feb 07 06:38:17 localhost systemd[1]: Started The Apache HTTP Server.

To start Apache run:

$ sudo systemctl start apache2

Step 3. Enable Apache

$ sudo systemctl enable apache2

By enabling an Apache, it will start automatically after a restart or Ubuntu server.

Step 4. Access the Apache Webserver

The default port of apache is 80, so, just access it on localhost or on your server’s IP.


Further, you can change the default port of Apache. Check the steps here.

You can create a virtual host for apache. Check the steps here.

Leave a Reply

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