Installing Apache in Ubuntu

Apache is currently the most commonly used and trusted web server application. It has dominated as the primary web server software. In this lesson we will learn to install the application as well as setup firewall rules to allow it server web pages to clients.

Installing Apache

Before we install Apache, it will be a good idea to make sure your operating system has the updated information about software packages available in the repository. To do this, run the following command:

sudo apt update

To install Apache, issue the following command in the terminal:

sudo apt install apache2

This will install the Apache web server on the Ubuntu operating system. The operating system retrieves the files from the Internet, so a working network connection will be necessary.

Turn Apache On/Off

Once installed, Apache should already be turned on as a service. The view the status of Apache issue the following command:

sudo systemctl status apache2

If for some reason Apache is not running, you can start the service with the following command:

sudo systemctl start apache2

Similar to turning Apache on, Apache can be turned off by issuing the following command:

sudo systemctl stop apache2

Viewing your web pages

You may need to access another computer, or if you are using a virtual machine, your host computer may do, and navigate in your web browser to the IP address of your Ubuntu computer to view the web pages.