Do you want to install LAMP-SERVER on Ubuntu Linux ?

LAMP stands for Linux, Apache, Mysql, Php

Its a package containing all required packages which are needed on linux for developing php application with apache server and mysql database server.

You can install each of the packages individually or just install a single package containing all this in one single command.

Which one you will prefer ?

Don’t worry ! I will show you both the methods…. 🙂

But one important thing, just make sure that you are logged in as ADMIN and full access to avoid any further problem.

If you are interested in installing everything in one command then you should check “Ubuntu Linux – Install Full LAMP Package with single command“.

Install all packages separately

Perform following commands

sudo apt-get install apache2

Now one all installation is done, just make sure that it is installed and working properly.

Try http://localhost/ or http://YOUR_IP_ADDRESS

It will show you a message in web page “It Works!” means “It is working”.

Now next step install php and required libraries & modules.

sudo apt-get install php5 libapache2-mod-php5

Once installation is done, restart apache.

sudo /etc/init.d/apache2 restart

Now make sure that PHP is working. Just create a simple php file in /var/www folder.

sudo gedit /var/www/check.php

Once editor is opened then put following code in that file.

<?php

echo "PHP is also working.";

phpinfo();
?>

Save & Close file.

Now open http://localhost/check.php

If you see a message “PHP is also working.” along with some more information about PHP, then its done. Its working.

If its not working then try to restart your computer and then try again.

Now next step is installing MySQL.

sudo apt-get install mysql-server

Now once this is over, first thing is we have to set the root password of MySQL.

mysql -u root

Now you will get a mysql terminal/command prompt.

mysql>SET PASSWORD FOR 'root@'localhost' = PASSWORD('ENTER YOUR PASSWORD');

Thats all ! You are done with installation.

If you like to work with GUI for databases, then you should install “PHPMYADMIN”.

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

Once installation is started it will ask you for selecting server, there you select apache2 by hitting “SPACE” key and continue installation.

Test phpmyadmin in browser by http://localhost/phpmyadmin