How to: Setup LAMP on Ubuntu
To setup a web server and to run a website on a system(localhost) you have setup LAMP or WAMP first. If you are a Linux user, you have to setup LAMP for this purpose and if you use Windows then you setup WAMP. This is a simple guide for running a website on localhost by setting LAMP on Linux machine. I used Ubuntu 8.1 (desktop edition) for this purpose.
LAMP is the acronym for Linux Apache MySql Php,Python,Perl.
WAMP is the acronym for Windows Apache MySql Php,Python,Perl.
We will install all these components and will configure a web server on localhost.
First, we will install and configure Apache.
- Open the terminal Application -> Accessories -> Terminal and type the command-
Now apache is downloaded and installed automatically.
A www directory will be located in your /var directory. This is your server’s base address where you will place files for your website. /var/www basically stands for localhost. You can test your localhost by typing http://localhost/
Next, we will install PHP.
- Type the command in the terminal-
Here, we are downloading and installing PHP5. You can install other versions of php too.
After installation is finished , restart Apache with the command-
To test if everything is fine and working , create a test.php file and add any php code for examle-
<?php
echo 'Welcome to TechTickLe';
?>
Now you can open this file by the url http://localhost/test.php in the web browser . It should prompt Welcome to TechTickLe. If not working, then something is wrong with your local server.
So, your server is working , now you need to store databases for your server back end. Therefore we will install MySql now.
- Again in terminal execute the command-
This way, MySql will be installed for your localhost.
If you are running a server (not for localhost) then you have to bind your ip address to Mysql. You can do it by editing the bind address in the file /etc/mysql/my.cnf . And change bind address’s value (127.0.0.1) by your IP address.
Set your root password for MySql-
- First type mysql in terminal , it will drop mysql prompt.
- Then type command .
where xxxxxx is your desired password.
- Now we can install phpMyAdmin as graphical interface for MySql.
You can open phpMyAdmin by typing http://localhost/phpmyadmin
It will ask for username and password . You can access it as root and give its mysql’s root password.
Note- The password that you have set for mysql’s root not your system’s root password.
- Last step is to restart your apache.
This should give a better understanding how a Lamp server’s components are installed and configured.
Comments are welcome!
Thanks.
You can Subscribe to TechTickle Feed or join us on our Facebook Page or follow us on twitter for any queries and to keep yourself updated with the latest updates!
You might like:
- How to: Open CHM Files in Ubuntu and Convert to More Stable Formats
- How To: Update twitter Status using Linux Command Line
- How To Install Skype From Repositories in UBuntu Linux
- Customize and Theme-Up your Ubuntu Linux
- Amazing New Features of Lucido Avant Window Navigator
- UNetbootin- Install your Linux on USB Pen Drive



[...] This post was mentioned on Twitter by Sahil Malhan, Sahil Malhan and slimb mani, TechTickle. TechTickle said: TeckTickLe- How to: Setup #LAMP on Ubuntu http://bit.ly/bdy4lX (A tutorial for Linux Lovers) #linux #ubuntu [...]