How to install Apache on Ubuntu 16.04?

This article discusses about Apache 2 and teaches you how to install Apache 2 on Ubuntu 16.04?

Ads


 

How to install Apache on Ubuntu 16.04?

This article discusses about Apache 2 and teaches you how to install Apache 2 on Ubuntu 16.04?

Apache 2 is very powerful http server for Linux and it is used most with LAMP stack for hosting variety of website in the world. Apache 2 with LAMP stack is open source, free and powerful enough to run web application handling millions of users per day.

In this article we are showing steps to install Apache 2 on Ubuntu 16.04 desktop. Steps of install Apache 2 on Ubuntu 16.04 is also valid for Ubuntu 16.04 LTS server.

What is Apache 2?

Apache 2 is HTTPD server written in c programming and its web server for serving the static content on internet. Majority of websites on the internet is hosted on Apache server.

For dynamic websites also Apache is used as front for handling client requests as Apache is developed to handle large number of HTTP requests very efficiently.

Apache cab be configured to run as front for web application and then pass the dynamic request to underline clustered servers such as Tomcat clusters to handle dynamic content.

Apache also well integrates with PHP and provides an ideal environment for deploying PHP based applications.

How to install Apache 2 on Ubuntu 16.04?

Step 1: Update system

The first step is to get the latest updates definition from the Ubuntu repositories. Run the following command to update your system:

sudo apt-get update

Step 2: install apache

After updating the system run the following command to install Apache 2 on Ubuntu 16.04 LTS:

apt install apache2

Here is sample output of the command:

root@deepak-VirtualBox:/home/deepak# sudo apt-get update
Hit:1 http://ppa.launchpad.net/webupd8team/java/ubuntu xenial InRelease        
Hit:2 http://security.ubuntu.com/ubuntu xenial-security InRelease              
Hit:3 http://in.archive.ubuntu.com/ubuntu xenial InRelease               
Hit:4 http://in.archive.ubuntu.com/ubuntu xenial-updates InRelease
Hit:5 http://in.archive.ubuntu.com/ubuntu xenial-backports InRelease
Reading package lists... Done                     
root@deepak-VirtualBox:/home/deepak# apt install apache2
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following additional packages will be installed:
  apache2-data apache2-utils
Suggested packages:
  apache2-doc apache2-suexec-pristine | apache2-suexec-custom
The following NEW packages will be installed:
  apache2 apache2-data apache2-utils
0 upgraded, 3 newly installed, 0 to remove and 216 not upgraded.
Need to get 330 kB of archives.
After this operation, 1,714 kB of additional disk space will be used.
Do you want to continue? [Y/n] y
Get:1 http://in.archive.ubuntu.com/ubuntu xenial-updates/main amd64 apache2-utils amd64 2.4.18-2ubuntu3.1 [81.3 kB]
Get:2 http://in.archive.ubuntu.com/ubuntu xenial-updates/main amd64 apache2-data all 2.4.18-2ubuntu3.1 [162 kB]
Get:3 http://in.archive.ubuntu.com/ubuntu xenial-updates/main amd64 apache2 amd64 2.4.18-2ubuntu3.1 [86.7 kB]
Fetched 330 kB in 3s (102 kB/s)    
Selecting previously unselected package apache2-utils.
(Reading database ... 222197 files and directories currently installed.)
Preparing to unpack .../apache2-utils_2.4.18-2ubuntu3.1_amd64.deb ...
Unpacking apache2-utils (2.4.18-2ubuntu3.1) ...
Selecting previously unselected package apache2-data.
Preparing to unpack .../apache2-data_2.4.18-2ubuntu3.1_all.deb ...
Unpacking apache2-data (2.4.18-2ubuntu3.1) ...
Selecting previously unselected package apache2.
Preparing to unpack .../apache2_2.4.18-2ubuntu3.1_amd64.deb ...
Unpacking apache2 (2.4.18-2ubuntu3.1) ...
Processing triggers for man-db (2.7.5-1) ...
Processing triggers for systemd (229-4ubuntu10) ...
Processing triggers for ureadahead (0.100.0-19) ...
Processing triggers for ufw (0.35-0ubuntu2) ...
Setting up apache2-utils (2.4.18-2ubuntu3.1) ...
Setting up apache2-data (2.4.18-2ubuntu3.1) ...
Setting up apache2 (2.4.18-2ubuntu3.1) ...
Enabling module mpm_event.
Enabling module authz_core.
Enabling module authz_host.
Enabling module authn_core.
Enabling module auth_basic.
Enabling module access_compat.
Enabling module authn_file.
Enabling module authz_user.
Enabling module alias.
Enabling module dir.
Enabling module autoindex.
Enabling module env.
Enabling module mime.
Enabling module negotiation.
Enabling module setenvif.
Enabling module filter.
Enabling module deflate.
Enabling module status.
Enabling conf charset.
Enabling conf localized-error-pages.
Enabling conf other-vhosts-access-log.
Enabling conf security.
Enabling conf serve-cgi-bin.
Enabling site 000-default.
Processing triggers for systemd (229-4ubuntu10) ...
Processing triggers for ureadahead (0.100.0-19) ...
Processing triggers for ufw (0.35-0ubuntu2) ...
root@deepak-VirtualBox:/home/deepak# service apache2 restart
root@deepak-VirtualBox:/home/deepak# 

After the completion of installation you can use following command to start Apache 2:

service apache2 restart

Now open the browser and browse http://localhost or your host name. Your browser will display the default home page of Apache 2.

**

In this tutorial we have installed Apache 2 on Ubuntu 16.04 LTS. Check more tutorial at devmanuals.net.

Ads