Check LAMP stack Install - Ubuntu 16.04 LTS

Installing Linux, Apache, MySQL, and PHP (LAMP) stack on Ubuntu 16.04 LTS

Welcome Aboard. In this blog post I will be covering how to install Linux, Apache 2, MySQL, and PHP 7 (LAMP) stack on Ubuntu 16.04 LTS.

Benefits of using a LAMP stack

  • The use of PHP and MySQL allows newcomer developers to get started building web applications at scale.
  • LAMP stack technologies are frequently updated, making them more secure.
  • They have a lot of support from open source software (O.S.S) community.

Prerequisites (at least 1 of the following)

A. Virtual Machine running Ubuntu 16.04 LTS

B. Have signed up for web hosting or already own Ubuntu 16.04 LTS instance

If you haven’t done so already, download a fresh copy of Ubuntu 16.04 LTS to get started.

Check Ubuntu version

lsb_release -a

The output should be equal or similar to

Distributor ID: Ubuntu
Description: Ubuntu 16.04.2 LTS
Release: 16.04
Codename: xenial

Update the list of available packages and their versions

sudo apt-get update

Update available packages

sudo apt-get upgrade

Install apache

sudo apt-get install apache2
Checking Apache 2 Install - LAMP stack - Ubuntu

Checking Apache 2 Install – LAMP stack – Ubuntu

Install MySQL

sudo apt-get install mysql-server mysql-client

You will be prompted to setup the root user password to be used with MySQL. It is important that you remember it.

You can login into MySQL as root using the following command:

mysql -u root --password=YOUR_DB_PASSWORD
Checking MySQL Install - LAMP stack - Ubuntu 16.04

Checking MySQL Install – LAMP stack – Ubuntu 16.04

Install php 7

sudo apt-get install php7.0 libapache2-mod-php7.0 php7.0-mysql php7.0-curl php7.0-json php7.0-cgi php7.0-xml php7.0-gd

Check php info

sudo apt-get install vim
sudo vim /var/www/html/testphp.php

Add the following line to the file: <?php phpinfo(); ?>

Restart apache2 service

  • On Ubuntu 15.10/15.04 and greater versions:
sudo systemctl restart apache2
  • On Ubuntu 14.10 and lower versions:
sudo service apache2 restart

Validate php install

On your browser of choice, navigate to http://localhost/testphp.php (swap the word localhost with your ip-address).

It will display all the details about php such as version, build date and commands etc.

Check PHP 7 Install using phpinfo - LAMP stack - Ubuntu

Check PHP 7 Install using phpinfo – LAMP stack – Ubuntu

And there you go, you have succesfully installed LAMP stack on your Ubuntu 16.04 Server.
If you enjoyed this blog post or found it helpful in any way, make sure to follow me on Twitter to find out when a new one is available.

Twitter: @giovanni0918

Github: giovanni0918

Website: giovanni-orlando.com

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s