Sunday, May 9, 2010

LAMP install on UBUNTU

install LAMP on ubuntu is very easy. 


What is LAMP?.
LINUX , APACHE , MYSQL , PHP


how to install?
normally LAMP is comming with installation CD. if you missed to install or if you need to install seperately, please follow the steps.


1. type this command on terminal window and hit enter / return
sudo apt-get install apache2 php5-mysql libapache2-mod-php5 mysql-server


this will take 2-3 minutes to install LAMP with all the dependencies.and this will ask some questions like passwords and user names. please read the question and answer it.


cool. if you are not getting any errors, that means you have installed successfully. now time to test it.


2. open the local browser or your developer pc's web browser and enter the http://localhost on the URL. please note you have to enter the domain name or ip address instead of localhost.


you should have to get "It Works!" message. if not something is missing. please re try. I assume that it works and you have configured the apache server.


3. test PHP
open your favorite text editor and create the php file for testing. in my case i'm using the nano editor.


sudo nano /var/www/testing.php


and then enter following php code to the file.





save and exit from the editor. now you have to restart the apache server.


sudo /etc/init.d/apache2 restart


go back to your web browser and enter following url.


http://localhost/testing.php


if everything goes well you should get the php configuration output. 


cool. its working.


4. configure the MYSQL server


checkin the localhost ipaddress.


cat /etc/hosts | grep localhost


checking the mysql's my.cnf file


cat /etc/mysql/my.cnf | grep bind-address


in above stage , you can change the ipaddress.


just type mysql on terminal window and hot enter. if that giving any errrors regarding user permission, that means
you need to change the mysql root password.


enter 


mysql -u root -p 


then enter the password. 


5. install phpmyadmin


type following command on the terminal wiwndow


sudo apt-get install libapache2-mod-auth-mysql phpmyadmin


this will ask series of quesstion and just answer the questions. enter the password that you set to the mysql DB.


once finished go back to the web browser and enter http://localhost/phpmyadmin/


you will get the login page. you can control the mysql database through this web page.


now you successfully completed LAMP on UBUNTU.

How to change the ubuntu root user password?

Normally ubuntu installed default null password. if you need to change the password,

login to terminal, and type

sudo passwd

and then hit enter/return. then it will ask the new password and re confirm the password. this same approach applying to the changing password too.