How To Install LAMP on Ubuntu 14.04
LAMP is a one of the most popular open source distribution and commonly used to run dynamic web application such as WordPress, Drupal, Joomla and many more. It’s a group of open source software including Linux, Apache, MySQL and PHP that used to develop and run dynamic web application of software.
Lamp is an acronym word and it stand for L = Linux, A = Apache, M = MySQLand P = PHP.
- Linux is a operating system that runs the whole system
- Apache is a server software that process requests and web application
- MySQL stores the application data on it
- And PHP process dynamic content
Through this article, I will show you how to install LAMP stack on Ubuntu 14.04, So that you can run web application on it.
Let me install and Optimize LAMP stack in Your Ubuntu Server for only $5. My this offer includes Free server optimization, Memcached Installation, Varnish Install and Configuration and basic Server setup and security improvements. Contact Me for more details.
[We are going to use basic Terminal commands to install LAMP.]
Installing LAMP on Ubuntu 14.04
In order to install LAMP you first need to install a Linux base operating system and I assume that you already have Ubuntu 14.04 installed that fulfill the first letter of LAMP. Now let’s install other software to complete LAMP installation.
Apache is a most popular web server software that is used by most of the web hosting companies and web sites. In order to install Apache we need to use meta package
apache2 on terminal or Ubuntu software center. We are going to install Apache using terminal and Ubuntu package manager
Lets get started by typing the following commands into the terminal:
first refresh app index using
sudo apt-get update
sudo apt-get install apache2
Wait a few seconds to get Apache installed. Once installed verify the installation by visiting the IP address. If you are installing on your local machine, You can verify your Apache installation using
127.0.0.1 on your web browser and If you are installing LAMP on Web server visit your web server IP address.
To find out your web server IP address, You can run the following command to get IP
By using above the method, You will get your IP address. Just copy and visit from any web browser to verify Apache installation. If Apache installed successfully, You will get a page like this by visiting your IP address.
In order to install MySQL we need to use meta package
mysql-server and MySQL module for PHP5.
sudo apt-get install mysql-server php5-mysql
While installing MySQL, MySQL will ask for set administrative user password. I strongly recommend using a password for administrative user. In my case the administrative user name is root.
mysql_secure_installation. It will remove any test user on MySQL database, Disable root login from outside of localhost and remove test database as well. This command also presents the opportunity to change administrative password. During the command execute, MySQL will ask you to choose answer for basic settings. You can leave the settings default by hitting enter when question asked by MySQL.
PHP is the last software to install in order to complete the installation of LAMP. So why wait, Lets start:
sudo apt-get install php5 php5-mcrypt libapache2-mod-php5
The above command will install PHP5 and 2 modules without any problem.
If you are planning to host static HTML based website then you are ready to go, But if you are planning to host dynamic website or application such as WordPress, Drupal or Joomla, You need to make a change to Apache’s configuration. By default Apache serves files when a directory is requested and Apache first look for
index.html file and we need to change it from
In order to do that, Open
dir.conf file in a text editor
sudo nano /etc/apache2/mods-enabled/dir.conf
Now in this file replace
index.html. By doing this,
index.phpwill move to the first position. Now Apache will first look for
Test PHP processing
The LAMP stack should be working fine, But if you want to check php processing on your server, Do the following:
Create a php scripts on your server’s root directory
sudo nano /var/www/html/info.php
Put the following script inside the blank file.
<?php phpinfo(); ?>
save the file and restart Apache server
sudo service apache2 restart
This page will give you information about your webserver and PHP processing. If this page appear, Your PHP is processing. Now you have LAMP stack installed.