Setup LAMP Stack Ubuntu

This tutorial presumes that you understand what is a LAMP Server , how to deploy a web site and how to install software using Terminal and experience in running other Basic Terminal Commands.

Root access
To install any application you need root access , You can prefix sudo before every command or login to root user and execute the commands

sudo -i

Enter the password of your account

You need to update the local repo by fetching indexes from remote canonical repos

apt-get update

To install Apache you must install the Metapackage apache2. This can be done by running the following command.
apt-get install apache2


To install MySQL you must install the Meta package mysql-server.

apt-get install mysql-server

Install PHP
To install php and apache lib for php if required install other libs like mysql lib and lots of other libs are available

apt-get install php5 libapache2-mod-php5

Check Apache
Open a web browser and navigate to that ubuntu IP
You should see a message saying
It works!

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 “nWow my installation is working.”;’

This site uses Akismet to reduce spam. Learn how your comment data is processed.