Thursday 24 July 2014

How to install LAMP in Ubuntu 12.04

L.A.M.P. is an acronym for solution stack of free and open source software. In order to create a viable general purpose web server, this term has been coined from the first letters of Linux (Operating System), Apache HTTP server, MySQL (database software) and Perl/Python/PHP. Generally “P” is taken to be as PHP but it may also refer to Perl or Python. PHP, Perl and Python are web scripting software.
Each package can be configured and installed separately. Here we will see how to install them at one shot. In earlier version of Ubuntu we used to have “tasksel” and “sudo tasksel” to bring various options including “lamp-server”. Simply selecting lamp-server use to do the work. But we don’t have tasksel in latest Ubuntu. No worries, we still can install the lamp stack in one shot.
But if you still want to use tasksel. you can install it by typing this command in terminal
sudo apt-get install tasksel
and then after the completion of installation type “sudo tasksel” in terminal and you are follow the instruction. I
But if you don’t want to go that way you have the way explained below which you will be doing step by step and while doing you will understand the basics too.
Lets get started:
Open your terminal. Either press “ctrl+alt+T” or from dash type “terminal” and press enter.
sudo apt-get install php5 mysql-server apache2
The above command will install latest version of PHP which is version 5 and mysql-server with apache http server 2.
You will be prompted in terminal as shown in figure. Give a password for your MySQL “root” user (you can create more users too).
Now to check if its working or not just open your favorite browser and type “localhost” in the address bar. You should see something like this-
(note: this comes from the file index.html located in /var/www/ folder of your system.)
Now to check if php is working or if not, let us create a small php file
Open your terminal and type- sudo vi /var/www/info.php
or you can open the same from gedit or any other editor as
sudo gedit /var/www/info.php
and write:
<?php
phpinfo();
?>
save the file and exit. Restart the apache2 service by typing the command in terminal
sudo service apache2 restart
open your browser and type in address bar the following.
localhost/info.php
and you should see something like this:
yay! you are done now! :-) cheers! Oh wait. Let us also install phpmyadmin . phpmyadmin helps to take control over our database. It can be done graphically from the browser or from the command line. to install
sudo apt-get install phpmyadmin
You will be prompted to screen like this- press space to select apache2 server and enter.
configure phpmyadmin with dbconfig-common. Press yes to configure. give your passwords.
When you are done type “localhost/phpmyadmin” in your address bar of browser, you should see something like this- give user as “root” and password which you had given before. you will be taken to phpmyadmin page. on this page you can create databases, users and many more

No comments:

Post a Comment