Installing LAMP Server Stack.


Apache is a free & widely used web server. To install it on your local system execute following command.

sudo apt-get -y install apache2

You might get following warning when starting apache web server.

apache2: Could not reliably determine the server's fully qualified domain name, using for ServerName

Add following line to /etc/apache2/apache2.conf to slience the warning.

ServerName localhost

To test the installation enter http://localhost in addressbar of your browser and you should see the message It works!.

Visit Apache HTTP Server site.


PHP is one of the most easiest scripting language available for quickly writing backend code. Install php by executing following command.

sudo apt-get -y install php5 libapache2-mod-php5

By default you will not be able to save anything to /var/www. To make /var/www writable execute following command.

sudo chmod -R 755 /var/www/

To test php installation enter following snippet into /var/www/hello.php file and save it.


Open your browser and enter http://localhost/hello.php into address bar and you should be able to see the information about php version, environment settings and modules installed.

Visit PHP scripting language site.


MySQL is a popular open source database server commonly used along with LAMP stack. Execute following command to install it.

sudo apt-get -y install mysql-server

During installation you will be asked to set root user password of MySQL server. It's up to you whether you want to set a new password or leave it blank. Ont the side note linux root account and mysql root accounts are not related at all.

Visit MySQL database server site.


phpMyAdmin is the web interface to work with your database server. You can use phpMyAdmin to manage databases,tables. You can also export and import data into/from database. Execute following command to install phpMyAdmin program.

sudo apt-get -y install phpmyadmin

You can test phpMyAdmin installation by entering http://localhost/phpmyadmin into address bar of your browser.

Visit phpMyAdmin site.


MexicanHacker said…
Great tutorial, keep posting stuff.

I only have one suggestion, after installing Apache and PHP, you will need to restart the server to see the phpinfo example.
Ketan said…
After I installed phpmyadmin I needed to do the following:
Open /etc/apache2/apache2.conf in a text editor and add this line:

Include /etc/phpmyadmin/apache.conf

Then restart apache like this:

sudo apache2ctl restart

Then go to http://localhost/phpmyadmin

You need your mysql username and password here. If you haven't set a password when installing mysql then open a terminal and put in the following line:

sudo mysqladmin -u root password MYPASSWORD

replace MYPASSWORD with whatever password you want then go back to http://localhost/phpmyadmin and enter "root" for username and your paswword for password. That did the trick for me.

Popular posts from this blog

Easy network traffic shaping on your ubuntu system

winetricks - install wine application perquisites with ease

Multi touch for any,all synaptics touchpad