Install LAMP server on Linux(Ubuntu)

In this tutorial we’re going to give you a step-by-step guide, on how to install LAMP server on Ubuntu. For those who don’t quite understand what a LAMP server is you can check here. Supposedly you should be sure that you understand also how to create a website from back end, and also you should know how to install a software by using either the Software Center either the Terminal. If you don’t, you can learn here for the Terminal and here for the Software Center.




So, lets get started:


How to install Lamp On Ubuntu


Step 1: Install Apache

First we start by installing Apache. In order to do that Metapackage apache2 should be installed. You can either search for it in Software Center either by running the following command

sudo apt-get install apache2

Step 2: Install MySQL

Now we’re going to install MySQL. Again what you need to do is to install the Metapachage mysql-server. Once more, you can search in Software Center for it, or run the following command on terminal

sudo apt-get install mysql-server

Step 3: Install PHP

We’ll proceed by installing php. To do that you first need to install the following metapackages: php5 and libapache2-mod-php5. Search it in Software Centre or run the following command on terminal:

sudo apt-get install php5 libapache2-mod-php5

Step 4: Restart Server

After MySQL and PHP are both installed, your server should restart Apache automaticaly. In case that doesn’t happen, type the following command:

sudo /etc/init.d/apache2 restart

Step 5: Check Apache

Then in order to check if everything is ok, open a web browser and navigate to your http://localhost/ . If everything is done correctly you should see a message that says “it works!”


Step 6: Check PHP

In the last step we need to check PHP. You can do it either by running any .php file from /var/www/ either by executing the following command

php -r 'echo "\n\nYour PHP installation is working fine.\n\n\n";'


comments powered by Disqus