How to install LAMP on Ubuntu

in #linux8 years ago

If you're new to Ubuntu and wanna start some coding, then you will need a localhost. LAMP stands for Linux, Apache, MySQL, PHP. It is a web stack used for hosting Web Content.

In this tutorial, You will be guided step by step to install LAMP.

1- Install Apache


The first step is to start up your terminal by searching for it or by using the shortcut CTRL + ALT + T.

Now you will need to install the Metapackage Apache2. You can search for it in Ubuntu's Software center or just run this quick command:

sudo apt-get install apache2
 

2- Install MySQL

Now, you will need to install the MySQL Metapackage. Just do the same steps as before but using this command:
sudo apt-get install mysql-server
 

3- PHP

Of course, you will need php. If you don't have it yet, you can install it with this command:
sudo apt-get install php5 libapache2-mod-php5
 

4- The Last Step: Restart the server.

Now, Apache and MySQL will restart automatically. If they didn't use this command:
sudo /etc/init.d/apache2 restart
 

5- Testing

You should see a page saying that it is working successfully. If you got the message, Congratulations, you now have LAMP on your Ubuntu Computer!

 

If you have any question, please write us a message on our page: Nerdy Lab

Just go to any browser and go to this link: http://localhost/
Sort:  

You could have done it "a lot faster": apt-get install apache2 mysql-server php5 libapache2-mod-php5. That was the easy part.

Once that command completes, the tricky part starts: securing the server and making sure it won't be hacked in the next couple of days.