Skip to main content

Install LAMP Server on Ubuntu OS

A LAMP stack is a group of open source software that is typically installed together to enable a server to host dynamic websites and web apps.

The term LAMP is an acronym which stands for Linux, Apache, MySQL and PHP.

Below are the steps to follow on Terminal:

Step 1: Install Apache

sudo apt-get install apache2

Step 2: Install MySQL

sudo apt-get install mysql-server

Step 3: Install PHP

sudo apt-get install php5 libapache2-mod-php5

Step 4: Restart Server

sudo /etc/init.d/apache2 restart

Step 5: Verify Apache Installed

Type http://localhost/ in your browser. You will see apache ubuntu default screen.

Step 6: Check MySQL Installed

sudo mysql

Type above command you will see below Message. You can type exit to exit from MySQL.

$ sudo mysql
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 5
Server version: 5.7.20-0ubuntu0.16.04.1 (Ubuntu)

Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> exit
Bye

Step 7: Check PHP is installed 

php -r 'echo "\nPHP installation is done.\n\n";'

Type above command on terminal, you will get above Message "PHP installation is done" on terminal.

That's it, your LAMP installation is done and verified.

Submitted by tgoswami on September 9, 2020

Tarun has 11+ years of experience in Quality Assurance in different domains like Banking, E-commerce, Health and Education.

About

At ProgramsBuzz, you can learn, share and grow with millions of techie around the world from different domain like Data Science, Software Development, QA and Digital Marketing. You can ask doubt and get the answer for your queries from our experts.