Ubuntu : Install LAMP Server on Ubuntu

LAMP Server
>> Linux, Apache, MySQL, PHP <<




About LAMP
LAMP stack is a group of open source software used to get web servers up and running. The acronym stands for Linux, Apache, MySQL, and PHP. Since the virtual private server is already running Ubuntu, the linux part is taken care of by Ubuntu . Here is how to install the rest.

Two methods A. 1 Step and 5 mins or B.6 Steps and 5 mins to get your LAMP working.


A. Single Command
Installs Apache > MySQL > Php


sudo apt-get install lamp-server^
---------------------------------------------------------------------------------------

B. The hands on approach

1. Install Apache
To install Apache you must install the Metapackage apache2. This can be done by searching for and installing in the Software Centre, or by running the following command. 
sudo apt-get install apache2


2. Install MySQL
To install MySQL you must install the Metapackage mysql-server. This can be done by searching for and installing in the Software Centre, or by running the following command. 


sudo apt-get install mysql-server


3. Install PHP
To install PHP you must install the Metapackages php7 and libapache2-mod-php and php-msql. 


sudo apt-get install php libapache2-mod-php php-mysql

4. Restart Server
Your server should restart Apache automatically after the installation of both MySQL and PHP. If it doesn't, execute this command.


sudo /etc/init.d/apache2 restart

5. Check Apache
Open a web browser and navigate to http://localhost/. You should see a message saying It works!




6. Check PHP
You can check your PHP by executing any PHP file from within /var/www/. Alternatively you can execute the following command, which will make PHP run the code without the need for creating a file .


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



You are done !

What to do with your LAMP server - the articles will follow.

________________________________________________________________________________

Thanks for reading, make sure to keep an eye on OkInteresting.com for more posts.
You can ask me questions here or @sanmansp on Twitter or fb.com/okinteresting

Comments