How to install LAMP (Linux Apache MySQL PHP) on Ubuntu 16.04

July 28, 2016 | By | Reply More

This tutorial will show you how to install LAMP (Linux, Apache, MySQL and PHP) on Ubuntu 16.04. As you know, Apache, MySQL and PHP is an essential application to build a powerful web server on top of the most popular Linux distribution, Ubuntu. Installing LAMP on Ubuntu 16.04 is not difficult. With some easy instructions, you can have a powerful web server on your Ubuntu 16.04.

Steps to install LAMP Server on Ubuntu 16.04.

A. Install Apache web server on Ubuntu 16.04

First thing, we need to install Apache web server on our Ubuntu 16.04. For example, I am installing Apache on my Ubuntu 16.04 droplet hosted on DigitalOcean. You may have a cloud computer/server at a low price ($5 per month) on DigitalOcean.

Open Terminal and login as root then execute this command to install Apache web server

After installing apache2, we need to configure the ufw firewall. This to make sure that the firewall allows http and https traffic to our server. Execute this command to view ufw profile available

You will see available applications such as:
Available applications:
Apache
Apache Full
Apache Secure
OpenSSH

Now try to look at the Apache Full profile

Output

Profile: Apache Full
Title: Web Server (HTTP,HTTPS)
Description: Apache v2 is the next generation of the omnipresent Apache web
server.

Ports:
80,443/tcp

Now enable the profile:

Now check if the web server is ready.

Open web browser and type:

http://your-ip-address/

Output:

apache on ubuntu 16.04

Congratulation, the web server is now running on Ubuntu 16.04.

B. Install MySQL Server

Next step is to install MySQL Server, the most popular relational databases out there. Installing MySQL Server on Ubuntu 16.04 is pretty easy. Still in Terminal console, execute this command to install MySQL Server on Ubuntu 16.04.

During installation you will be asked to create a new password for MySQL root user.

mysql-ubuntu-16.04

Next step is to secure our MySQL installation. Execute this command below:

You will be asked to enter the root password and also, you will be asked to enable the validate password plugin. Its not mandatory, as long as your password is strong enough.

mysql-ubuntu-16.04 validation

Once finished, you can check if MySQL Server is ready. Make sure its active, indicate that our MYSQL Server is up and running.

mysql status

C. Install PHP

To install php, use this command below

Restart Apache web server to complete

Now, LAMP server is up and running on Ubuntu 16.04. Start build your website!

Tags: , , , ,

Category: Server, Ubuntu

Leave a Reply