I love Debian/Ubuntu based Linux because of this command apt-get. As a starter knowing this one command, It is so easy to install packages and you dont need to worry about package dependency and configuration. I first come use Ubuntu when i start using Amazon’s ec2. I was amazed how easily i can build up a server. I am going to show how easy LAMP setup really is. I assume you have a Ubuntu setup-ed server and PuTTy.Note: Linux + Apache + MySQL + PHP/Perl together commonly known as LAMP Server.

Before proceeding to install, update the necessary packages with Debian with this command.

 apt-get update

1. Installing Apache + PHP
To install PHP5, just run the following on Linux shell. Note that if you dont specify packages with ’4′, PHP5 will be automatically installed.

apt-get install apache2 php5 libapache2-mod-php5

Apache configuration file is located at: /etc/apache2/apache2.conf and your web folder is /var/www

To check whether php is installed and running properly, just create a test.php in your /var/www folder with phpinfo() function exactly as shown below.

nano /var/www/test.php

And write this

<?php phpinfo(); ?>

Point your browser to http://ip.address/test.php or http://domain/test.php and this should show all your php configuration and default settings.
To enable GD Enter this

apt-get install php5-gd

To enabling mod rewrite with .htaccess

a2enmod rewrite

Then open the apache config

nano /etc/apache2/sites-enabled/000-default

Change AllowOverride none to AllowOverride All

<Directory /var/www/>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
allow from all
# Uncomment this directive is you want to see apache2's
# default start page (in /apache2-default) when you go to /
#RedirectMatch ^/$ /apache2-default/
</Directory>

2. Installing MySQL Database Server
The following commands will install mysql 5 server and mysql 5 client.

apt-get install mysql-server mysql-client php5-mysql

To install PhpMyAdmin use the following code

apt-get install phpmyadmin

Then restart Apache

/etc/init.d/apache2 restart

Now When you develop web app or sites you need more packages then the default installation for that use the following command

apt-get install curl libcurl3 libcurl4-openssl-dev php5-curl php5-mcrypt php5-xmlrpc

To install pear use the following command

apt-get install php-pear

How much time did it take – less than 10 Minutes right.