How To Install LAMP Server On Ubuntu

In this post I will show you how to install a LAMP (Linux, Apache, MySQL and PHP) server on Ubuntu 12.10 using apt-get to simplify the whole process. While you can also use tasksel to completely automate the process I have read about problems that it sometimes causes and it seems so much easier to just take the extra 10 minutes and run a few more commands knowing it will all work in the end. My next post which will be posted right after this one will show you how to add php to your new LAMP server.

ubuntu install lamp How To Install LAMP Server On Ubuntu


Install Apache On Ubuntu

To install Apache on Ubuntu all you should have to do is run the following command.

sudo apt-get install apache2

Install PHP On Ubuntu

To install PHP and also make it work on your Ubuntu LAMP you will have to install a module aswell that makes it work with Apache. You can do both by running the single command below.

sudo apt-get install php5 libapache2-mod-php5

After you have installed PHP and the PHP module you needed you need to restart Apache to make it load with the newly added module, you can do this with the next command.

sudo /etc/init.d/apache2 restart

Install MySQL On Ubuntu

Next you should install MySQL with the following command, you will also need to install a module later to make it work with PHP/Apache. I have added both of the commands below.

sudo apt-get install mysql-server

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

After you have done this you will need to restart Apache again using the same command as above, I have listed it again below for your convenience.

sudo /etc/init.d/apache2 restart

You can access your new Ubuntu LAMP by going to either or http://localhost/ and your files will be located at /var/www/. If you want to test the PHP functionality then you can add a new php file with <?php phpinfo(); php?> pasted and saved into it.

I hope this has helped you install LAMP Ubuntu, please don’t forget to share/like/plus-one as it helps the blog out. Thank you!


Incoming search terms: