Home Linux Ubuntu How To Install LAMP Stack on Ubuntu 16.04/18.04

How To Install LAMP Stack on Ubuntu 16.04/18.04

Q. How to install LAMP stack on Ubuntu??



L = Linux
A = Apache

LAMP server means Linux is an operating system, Apache is a web server, MySQL is a database and PHP is the language.

In this article, will let you know how to install these open source software on the Ubuntu system.

Read More: How to Install Multiple PHP Versions (5.6, 7.1 or 7.2)

Step 1: Install Apache Web Server

To install the Apache web server on the Ubuntu machine, run the following commands.

sudo apt-get update
sudo apt-get install apache2

You can also check the status or restart the service. Just run the following command.

sudo apt-get service apache2 restart
sudo apt-get service apache2 status

Open the web browser and type localhost or IP address of a system. It will open the default Apache web server page.

Step 2: Install MySQL Database

Next step is to install the database. Here we will download the repository package and after that installation will start. Now execute the following commands.

LAMP Server -Install MySQL Database
LAMP Server -Install MySQL Database
wget -c https://dev.mysql.com/get/mysql-apt-config_0.8.10-1_all.deb
sudo dpkg -i mysql-apt-config_0.8.10-1_all.deb  
sudo apt-get update 
sudo apt-get install mysql-server  

To check the status of the MySQL database service, run the below command.

sudo service mysql status

Step 3: Install PHP

To install PHP version on Ubuntu, run the below commands.

sudo add-apt-repository ppa:ondrej/php 
sudo apt-get install libapache2-mod-php7.0 php7.0 php7.0-common php7.0-curl 

This will install the PHP7.0 version on your system. You can check the installed PHP version by running the following command.

php -v

Finally, the LAMP stack installation is complete.

Read More: How to Install & secure MySQL 8.0 in Ubuntu

Conclusion: You have perfectly learned how to configure LAMP stack on the Ubuntu server. In case of any confusion or feedback, kindly write in below comment box.


Please enter your comment!
Please enter your name here