17 August, 2011

setup lamp server on debian/ubuntu || the easiest & the best way


The LAMP server is the commonly abbreated for Linux Apache MySql PHP server. This is a platform where web pages can be build/test/run using linux.

So setting up your LAMP server includes installing all those above said packages and configuring them to work together.

You can use either terminal or synaptic package manager to install these packages [and should have a working internet connection]. Anyway we may have to use the terminal for configuring them. So better move with the Terminal [Applications > Accessories > Terminal] itself.

1. Install Apache server

------------------------------
Below command will install apache server in your system


$ sudo apt-get install apache2

when the installation finishes, test weather it's working by pointing your web browser[firefox / chrome . . . ] to the following web address.
http://localhost/  

You should see a folder entitled apache2-default/. Open it and you will see a message saying something like > "It works!"

2. Install PHP

- - - - - - - - - - - - -

copy-paste the command given below onto a terminal and hit the enter key.


$sudo apt-get install php5 libapache2-mod-php5

While PHP installation finishes, restart the apache web server to make it compatible with apache using the following command.


$ sudo /etc/init.d/apache2 restart

testing PHP

To ensure there are no issues with PHP let's give it a quick test run.

Step 1. In the terminal copy/paste the following line:



$ sudo gedit /var/www/test.php

This will open up a file called test.php.

Add the following line into the test.php, save and close the file.


  <?php
      phpinfo();
  ?>


Now open you're web browser and type the following into the web address:



http://localhost/test.php


Note : You can change the location of the Document root [by default it is /var/www/] by reading this article.

Install MySQL
- - - - - - - - - - - - - - 

open up the Terminal and then copy/paste this line:


sudo apt-get install mysql-server libapache2-mod-auth-mysql php5-mysql


install phpmyadmin
-------------------------

 

sudo apt-get install phpmyadmin

Now just restart Apache and you are all set!



sudo /etc/init.d/apache2 restart


That's enough! your LAMP server  is ready, and now you can can move up with your pretty codes >>
Read rest of entry
 

Terminal Diary | techblog Copyright © 2009 Gadget Blog is Designed by jintu jacob Powered by Blogger