Install Lamp Stack on Ubuntu.
"LAMP" Stack is group of open source softwares where L stands for Linux, A stands for Apache, M
stands for Maria DB(MY Sql), P stands for Php.
All these open source software installed together let us to host powerful application on server.
In this article we will install LAMP Stack in 3 easy steps.
Step 1:- Install Apache and enable Firewall
Apache is one of the most powerful and mostly widely used open source web server in the world. We can easily install it using Ubuntu default package manager apt.
~/Server $ sudo apt-get install apache2
As we have used sudo command so you will be asked to enter password for root privileges. It will
how much space it will take and will ask to confirm so press Y and press Enter.
Supress Syntax Warning
It will open apache2.conf file in the terminal. Navigate to bottom of the terminal and
add ServerName your_ip_address
Save the file and close it. After it we have to restart apache2.
Now to allow incoming web traffic we have to adjust firewall.
Now to check everything works ok visit your server's ip address http://your_ip_address.
If everything is ok you will see apache landing page. You are all ready for Step 2.
Step 2:- Install MySql Server
After installing apache we are ready for next step which is installing Mysql Server. Mysql is open-source RDBS(relational database management system) where we can store our site information. We can install Mysql Server in two commands.
It will be show again how much space it will take. Press Y and the Enter to continue. During the
installtion you will be prompted
to enter password and reconfirm it. This password is for admin account.
When Everything is done we are ready to run some security script to increase security for Mysql Database.
Answer Y for yes and any other key for no. We will strongly recommend Y for everything but frankly its your choice. Well we are done with step 2 now to step 3.
Step 3:- Install Php
Now we are ready for our final step. Php is programming language which can runbs scripts and make connection to mysql databse.
This will install php and all important dependency we need. Now we want to increase indexing of php scripts so that they are more prefered.For that we have to type following command.
We have to move index.php from middle to first. From
Save and Close the file. Now we have to just restart apache and we are all set. And we can do that by typing following commands:-
If you have are here you can pat your back as you have sucessfully install lamp stack on the server. You can test this by making a php scrip on /var/www/html/ directory. you can do this by typing following commands:-
And then writing some php code in it. Now when we got to http://your_ip_address/info.php you will see the php code you wrote in action.