In this tutorial we will learn, how to setup LAMP Stack on Ubuntu 14.04 LTS Server. LAMP is the abbreviation of Linux, Apache, MySQL and PHP. To setup LAMP stack, we will install Apache HTTP Server, PHP and MySQL Database Server on Linux . In our case, for Linux we will use Ubuntu 14.04 LTS Server.

In internet world, LAMP stack is popularly used for Web Application. Many Open source CMS (Content Management System) like WordPress, Joomla, Drupal, MODX etc .

Install Apache, PHP and MySQL on Ubuntu 14.04 LTS

Follow the given below steps to setup the LAMP stack.

(1) Install Apache HTTP Server :

In Ubuntu 14.04 LTS, the apache 2.4 version has been introduced.Whereas in Ubuntu 12.04,it was shipped with Apache 2.2 version.In new Apache version 2.4 a few things are changed.
In our last post, we have already brief about installing Apache on Ubuntu 14.04

To install Apache Web Server,use given below command

sudo apt-get update apache2

(2) Install MySQL Database Server

MySQL is an Open Source RDBMS . In my last post we have already install mysql server on Ubuntu 14.04.

Here we will install MySQL Server version 5.6 . Which is currently a new stable release.

To install MySQL Server, run below given command

sudo apt-get install mysql-server-5.6

During installation, after a few seconds it will ask you to set mysql root password.
On your terminal, you will see the screen like below given screenshot

Set MySQLroot Password
mysql Ubuntu 14.04

Confirm the MySQL root password

MySQL Server 5.6 Ubuntu 14.04

(3) Install PHP :

In recent time, PHP is well known for server side scripting,widely use in Web Development.at the time of writing, currently PHP 5.x series is running

To get connection from PHP script to MySQL Server, we have to install the module called php5-mysql

Here we will install php and php5-mysql

sudo apt-get install php5 php5-mysql

Note: In apache 2.4 version in Ubuntu 14.04 , the default Document Directory is /var/www/html

Now create a file called test.php inside /var/www/html directory .

sudo vi /var/www/html/test.php

Now paste given below phpinfo code in test.php file . And save the file.


Open the web browser in your PC/Laptop and type IP address in URL address bar with test.php file name .
My Server ip is 192.168.56.101 hence I will write http://192.168.56.101/test.php .

Replace 192.168.56.101 with your Server IP Address.

phpinfo

Through phpinfo php script, you can get many useful information.
First, it confirms the PHP is installed in Server and can work with apache web server. Second, you can also know what are the PHP extension are enable or disable. And there are may other useful information you can get in phpinfo page.

Now Apache, PHP and MySQL server are installed. You can start working on LAMP stack.

To start/stop/restart the apache service

sudo service apache start
sudo service apache2 stop
sudo service apache2 restart

Apache status

sudo service apache2 status

To start/stop/restart the MySQL service

Start MySQL:

sudo service mysql start

Stop MySQL:

sudo service mysql stop

Restart MySQL

sudo service mysql restart

MySQL status

sudo service mysql status

Read Some More Articles

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.