You are here
Home > Linux > Installing LAMP on Ubuntu

Installing LAMP on Ubuntu

Hello Friends, Today I am going to share how to setup LAMP on Ubuntu.

About LAMP

LAMP is an archetypal model of web service solution stacks, named as an acronym of the names of its original four open-source components: the Linux operating system, the Apache HTTP Server, the MySQL relational database management system (RDBMS), and the PHP programming language. The LAMP components are largely interchangeable and not limited to the original selection. As a solution stack, LAMP is suitable for building dynamic web sites and web applications

Setting Up

Step 1: Installing Apache
To install apache use below command

sudo apt-get install apache2

Step 2: Installing MySql
To install mysql use below command. It will ask you to provide password for root user, so provide password when prompted.

sudo apt-get install mysql-server

Step 3: Installing PHP
To install PHP you need to install php5 and libapache2-mod-php5, to do that use below command

sudo apt-get install php5 libapache2-mod-php5

Step 4: Check Apache
To check apache is installed correctly open your browser and type localhost or   You will see a message saying It works! or fully designed html page. If you don’t see then use below command to restart apache server

sudo /etc/init.d/apache2 restart


sudo service apache2 restart

Step 5: Checking PHP
To check PHP installed correctly you can execute any PHP file from within /var/www/ Or you can run below command to test.

php -r ‘echo “PHP installation is working fine\n\n”;’

It is done!



Please Share

Rajesh Kumar Sahanee
I am a passionate Java Developer and I like Computer Programming. I love to do some interesting experiments and listening music in my free time.