How to install and configure LAMP ( Linux, Apache, MySQL and PHP ) in Ubuntu 14.04

1. Introduction

Short for Linux, Apache, MySQL and PHP, an open-source Web development platform, also called a Web stack, that uses Linux as the operating system, Apache as the Web server, MySQL as the RDBMS and PHP as the object-oriented scripting language. Perl or Python is often substituted for PHP.

2. Requirements

An ordinary server with Ubuntu 14.04 LTS installed. You can install it on any platform, but here the documentations are based on the Ubuntu / debian server.

3. Installation

Please proceed with the following steps:

3.1 Apache2 Installation

Type the below command for installing apache 2 package from repository.

#  apt-get install apache2

Restart apache service

# /etc/init.d/apache2 restart

Apache will start working with minimal configuration. Now Open your server-ip in the browser and You can see the apache ubuntu test page.( Default document root is located in this path /var/www/html )

 

3.2 MySQL installation

Issue the below command to install mysql server with dependencies.

# apt-get install mysql-server

During installation it will prompt for a new password for mysql root . Give some strong password and retype the same password for confirmation.

After installation check the Database connection.

Check the service status.

# /etc/init.d/mysql status

Service is already up , Now Type this command to login

# mysql -u root -p

Enter password: ******
Welcome to the MySQL monitor. Commands end with ; or g.
Your MySQL connection id is 42
Server version: 5.5.35-1ubuntu1 (Ubuntu)
Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or 'h' for help. Type 'c' to clear the current input statement.
mysql>

Mysql server installation is over.

3.3 PHP installation

Type the below command to install php5.

# apt-get install php5 php5-mysql

Create a php file and paste the below code into the file to show the php configuration . Goto the default apache root path /var/www/html . create a new file info.php and paste the below code and save it.

# vi /var/www/html/info.php

Please use the following codes to create a phpinfo page.

<?php
phpinfo()
?>

Now restart the apache2 service.

# /etc/init.d/apache2 restart

Now open the file in the browser ( Eg: http://yourip/info.php ) you can see the php information page as below.
Make sure you can see the mysql details in the php information page.

Subscribe Now

10,000 successful online businessmen like to have our content directly delivered to their inbox. Subscribe to our newsletter!

Archive Calendar

Sat Sun Mon Tue Wed Thu Fri
 1
2345678
9101112131415
16171819202122
23242526272829
30  

Over 20000 Satisfied Customers!

From 24/7 support that acts as your extended team to incredibly fast website performance

Zelt staff were fantastic, I had a concern with a domain and they got back to me very quickly and they helped me to resolve the issue!

author
Technician, Diageo PLC

I'm using Zelt for my portfolio since 2006. The transition was seamless, the support was immediate, and everything works perfectly.

author
Photographer, Allister Freeman

Very easy to understand & use even though I am not very technologically minded. No complications whatsoever & I wouldn't hesitate to recommend it to all.

author
Actor, A&J Artists

Zelt support team have been amazingly responsive and helpful to any of my queries, thank you so much to the Zelt have been amazingly responsive and helpful to any of my queries ๐Ÿ‘๐Ÿ‘๐Ÿ‘

author
Technician, Diageo PLC

Anytime I've had a problem I can't solve, I've found Zelt to be diligent and persistent. They simply won't let an issue go until the client is happy.

author
Doctor, SmartClinics

Zelt support team have been amazingly responsive and helpful to any of my queries, thank you so much to the Zelt have been amazingly responsive and helpful to any of my queries ๐Ÿ‘๐Ÿ‘๐Ÿ‘

author
Freelancer, Fiverr

24/7 World-Class Support

Ran into trouble? Contact our Customer Success team any time via live chat or email.

  • Receive professional WordPress support
  • Our specialists are available round
Get Support