Install Apache on Ubuntu 18.04 - Step by Step Process ?

Apache is an open-source and most popular and used HTTP web server in the world. It powers a large number of websites among the world. Apache HTTP server is cross-platform, powerful, stable, reliable and free web server providing features which can be extended by the wide variety of modules.

Here at LinuxAPT, as part of our Server Management Services, we regularly help our Customers to perform related Apache queries.

In this context, we shall look into how to install Apache on Ubuntu 18.04.

How to Install Apache on Ubuntu ?

Before proceeding with this installation procedure, you need a non-root user account with sudo privileges.

Apache is available in the default Ubuntu software repositories so Apache installation is very easy and straightforward to install using apt package management tool.

i. Start by updating the package index and with the below commands:

$ sudo apt update

ii. On Debian and Ubuntu systems the Apache service and package is called apache2. To install apache2 execute below command :

$ sudo apt install apache2

iii. Once process is completed, Apache is installed in your Ubuntu server. Apache service will start automatically after installation. You can check Apache service status by typing:

$ sudo systemctl status apache2

It will show output like below:

● apache2.service - The Apache HTTP Server
    Loaded: loaded (/lib/systemd/system/apache2.service; enabled; vendor preset: enabled)
    Active: active (running) since Sat 2019-03-23 16:30:47 UTC; 13min ago
  Main PID: 491 (apache2)
    CGroup: /system.slice/apache2.service
            ├─ 491 /usr/sbin/apache2 -k start
            ├─1723 /usr/sbin/apache2 -k start
            └─1724 /usr/sbin/apache2 -k start

How to Configure Firewall for Apache ?

If your Ubuntu server is protected by firewall then make sure that your firewall allows HTTP and HTTPS traffic. You can check "Apache Full" profile enables traffic or not :

$ sudo ufw app info "WWW Full"
Profile: WWW Full
Title: Web Server (HTTP,HTTPS)
Description: Web Server (HTTP,HTTPS)

It should show that it enables traffic to ports 80 and 443 or you can Allow incoming HTTP and HTTPS traffic for this profile:

$ sudo ufw allow in "Apache Full"

How to Verify Apache Installation ?

To check that everything goes correctly, open your browser and visit your server IP address http://YOUR_SERVER_IP/

It should display a default Ubuntu 18.04 Apache web page.

This signifies that Apache Installation was done correctly.

How to Manage Apache Processes ?

Now Apache web server is installed on your machine and up to run so we will see few basic management commands.

You can stop Apache service by type:

$ sudo systemctl stop apache2

To start again Apache service type:

$ sudo systemctl start apache2

You can Restart (stop and start) the Apache service by:

$ sudo systemctl restart apache2

If you have need to make configuration changes, Apache can reload without dropping connections. For this, issue this command:

$ sudo systemctl reload apache2

Also, you can disable the Apache service by typing:

$ sudo systemctl disable apache2

Again, re-enable the service to start up at boot, type:

$ sudo systemctl enable apache2

Finally, you have successfully installed Apache on your Ubuntu 18.04 server.

[Need urgent assistance in fixing Apache errors? We can help you. ]

This article covers how to successfully install Apache on your Ubuntu 18.04 server. The Apache HTTP server is the most widely-used web server in the world. It provides many powerful features, including dynamically loadable modules, robust media support, and extensive integration with other popular software.

To install Apache on Ubuntu:

1. Update your local package index:

$ sudo apt update

2. Install the apache2 package:

$ sudo apt install apache2

Related Posts