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.
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
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.
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.
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.