Saturday, 25 May 2013

Installing LAMP in LINUX


L - LINUX (the OS)  

      A - APACHE ( the Web server )  

             M - MYSQL ( the database management system ) 

                     P - PHP

LAMP can be installed with just one command 



sudo apt-get install lamp-server
  
But if you want to know what exactly is happening, go through the entire post 
 

Installing Lamp Server components individually

 
STEP 1 : Installing APACHE

Open the terminal (ctrl+alt+t) and type the below command .

sudo apt-get install apache2 .

(if asked to enter the password , type it and press enter) .

 Now let us check whether apache has been installed successfully .

 Open any web browser and enter http://localhost/ in the address bar .
                                              
                                (you should see the page as in the image below) .
APACHE, database management system, install apache, install MySQL, install php, Installing LAMP in LINUX, LAMP, libapache, LINUX, MYSQL, PHP, phpinfo, phptesting, sudo, ubuntu, web server,

Congrats you have now installed APACHE !

STEP 2 : Installing PHP

Open the terminal (ctrl+alt+t) and type the below command

 sudo apt-get install php5 libapache2-mod-php5

 (you will be asked to enter the password , type it and press enter)


For  PHP to work correctly and be compatible with apache , we need to restart it , it can be done using command


sudo /etc/init.d/apache2 restart


Now let us check whether php has been installed successfully, to do this, type the following command in the terminal

                                                                                      
                                        sudo /var/www/phptesting.php

Type the following line in the phptesting.php file that has been opened

<?php phpinfo(); ?> 


(this will show you a page having the details of PHP as in the image below) 

APACHE, database management system, install apache, install MySQL, install php, Installing LAMP in LINUX, LAMP, libapache, LINUX, MYSQL, PHP, phpinfo, phptesting, sudo, ubuntu, web server,

Congrats you have now installed both APACHE and PHP !!

STEP 3 : Installing MYSQL


 In the terminal (ctrl+alt+t) type the below command

                   sudo apt-get install mysql-server

 (you will be asked to enter the password , type it and press enter) .



 Enter the user name and password  that you wish to use for mysql .


Once done with the installation, you can verify the successful installation by typing the below command .

                    mysql -u <username> -p


Congrats you have now installed APACHE, PHP and MYSQL !!!

As an alternative you can use the below command for quick installation :-)


sudo aptitude install apache2 php5 mysql-server php5-mysql libapache2-mod-php5


Leave your doubts or suggestions in comments section..

2 comments:

  1. is LAMP similar to wamp in windows?

    ReplyDelete
  2. Hi abdulla rehman....Yes it is similar to wamp in windows!!


    vignesh has also posted http://wetechies.blogspot.in/2013/05/java-server-pages.html

    ReplyDelete