Tuesday, 1 July 2014

Quick Start: LAMP on Ubuntu 14.04

Quick Start
LAMP on Ubuntu 14.04

Here's a simple, easy to follow guide that will help you set up a fully functional "LAMP": Linux (duuuuhhh), Apache, MySQL and PHP on your Ubuntu Desktop/ Server

For this tutorial, I am using a Ubuntu 14.04 Desktop, however, the steps remain more or less the same for a majority of other Ubuntu versions as well.

NOTE: The following steps require root (sudo) access to perform.

To get started, launch a terminal in your Ubuntu System, obtain root privileges by typing the sudo -i command.

The next thing to do is to provide a static IP address to your Ubuntu system. Although this can be left as optional, but I highly recommend that you always use static IPs for such Servers.

Make a note of your Ubuntu System's IP address by executing the  ifconfig command. Note down the IP address.

# ifconfig

Edit the /etc/network/interfaces file and add the IP address info there. The final outcome of your interface file should look something as shown below:

# vi /etc/network/interfaces

# The Primary Network Interface
iface eth0 inet static

Once these preliminary activities are done, we are now ready to install our LAMP Server.

Install Apache
Installing Apache is a simple process. Simply type in the following command in your terminal and watch the magic happen:

# apt-get install apache2

The installation automatically attempts to start the Apache service. You can check the server's status by executing the following command:

# service apache2 status

If the service status shows stopped, then start up the apache server by using:

# service apache2 start

Verify Apache was successfully installed by launching a browser window and simply putting your Ubuntu Server's IP address in there. You should see Apache2 Default Page as shown below:

Install MySQL 
This involves installing and configuring MySQL Server and Client as well on your Ubuntu system. Type in the commands in your terminal to get started:

# apt-get install mysql-server mysql-client

Along the installation process, you will be prompted to provide the MySQL Server's administrative (a.k.a root) password. Provide a strong password here. 

TIP: I don't know why, but I have faced issues with accessing MySQL from time to time especially if my password contained an '@' in it. It seems MySQL treats this as some special character or something and does create problems at times. So avoid using the '@' in your password, use whatever else that comes to your damn mind :)

Provide the same password again (Just to make sure that you are awake I guess.. :P )

Once the installation completes, check the status of your MySQL Server. It should be in the running state. 

# service mysql status

You can then access your MySQL Server using the below syntax:

# mysql -u root -p

Install PHP
The next step in out LAMP is PHP. 

# apt-get install php5 php5-mysql libapache2-mod-php5

To test your PHP installation, first we need to traverse to the following path and create a simple php file (Here, im gonna call it as info.php)

# cd /var/www/html

# vi php.info

# Add the following contents in your PHP.INFO file
<? php

The next thing to do is to restart the apache2 service. You may get a looooong warning message as shown in the image below, but not to worry. That's there as we haven't set the FQDN in the apache2 conf file. You can ignore this though for time being..

Open up a browser and type in the Ubuntu server's IP address followed by the PHP.INFO file in the following format:


If you get a similar output as shown below, then voila.. you got yourself a working LAMP Server!!

Bonus Stuff!
Well, its not actually a bonus as such, but a pretty handy tool never the less. Its called as PHPMYADMIN. Ill not go in-depth on this, but just to keep things simple its a PHP based tool meant to administer MySQL databases using a web-based UI. You can read more about it HERE

To install it, type in the following in your terminal:

# apt-get install phpmyadmin

During the installation, it will prompt you to select the "Web Server" to run PHPMYADMIN. Select apache2 and continue

The next few screens, are just used for the configuration of PHPMYADMIN

Provide the administrative password of your MySQL DB to configure PHPMYADMIN

Provide a suitable password for PHPMYADMIN to register with the MySQL DB

Re-enter the password

Congrats! Your PHPMYADMIN is now ready for use.. simply login to the portal using root as the username and the password yhat you set in your earlier steps

You can use the tool to administer the MySQL DB as you want to.

There you have it! A simple LAMP tutorial to help you get started.. 

Stay tuned for more coming your way..


varshini devi said...

Great blog..You have clearly explained how to install PHP ..Step by step explanation is too good to understand..Its very useful for me to understand..Keep on sharing..
PHP Training in Chennai|PHP Course in Chennai

caroline jesi said...

Hello Admin,
Awesome Post! I like writing style, how you describing the topics throughout the post. I hope many web reader will keep reading your post at the end, Thanks for sharing your view.
web design training chennai|Best web designing institute in chennai

Melisa said...

I really enjoyed while reading your article, the information you have delivered in this post was damn good. Keep sharing your post with efficient news.
JAVA Training in Chennai|JAVA J2EE Training in Chennai|java courses

Nikshitha S said...

Excellent post!!!. The strategy you have posted on this technology helped me to get into the next level and had lot of information in it.
Web designing Course in Chennai | Hadoop Training in Chennai

Arthur Mac said...

Nice explanation about selenium. we are also taking Selenium training in Chennai .The future of selenium is on positive note.Thus training will assist the students to reach their dream jobs.
Selenium Training | Selenium Course in Chennai | Best Selenium training institute in Chennai

Arjun kumar said...

I am so thankful for your post.It is really helpful and informative to me.Keep sharing more like this.
Android Training in Chennai | Java Training in chennai

Paul Miller said...

Great and really helpful article! Adding to the conversation, providing more information, or expressing a new point of view.Nice information and updates. Really I like it and everyday am visiting your site.
Informatica Training in Chennai | Best Informatica Training in Chennai | Informatica Training Center in Chennai

Arjun kumar said...

This data is great and amazing. A debt of gratitude is in order for taking an ideal opportunity to talk about this, I feel upbeat about it and I adore adapting more about this theme. I utilize your manual for teach my understudies.
Informatica Training center chennai | Informatica courses in Chennai | Informatica institutes in Chennai

Steve Hawks said...

Extremely enlightening substance. Digital marketing is the best to promote our product. We mainly focus on SMO and SEO in digital marketing. The main task is to analyze the keyword and to bring the site at top position for particular keyword.
Digital Marketing Training in Chennai | Digital Marketing Chennai | Digital Marketing courses in Chennai

Qinan Chen said...

20160920qiujiecanada goose sale
gucci outlet online
kd shoes
polo ralph lauren
canada goose jackets
adidas nmd runner
pandora charms
ugg boots outlet
uggs on sale
coach outlet online

Arjun kumar said...

Big data is the accompanying huge thing for the associations to settle on exact decision. Immense data examination is done using the past genuine data and to go on the ordinary arrangements in the midst of a particular period. This is used generally by the FMCG based associations.
Bigdata Training | Best Hadoop Training institute in Chennai | Bigdata Hadoop Training in Chennai

Post a Comment