How to install LAMP on ubuntu

LAMP word consists of Linux, Apache, MySQL and PHP/Python
Let’s see how to install and configure LAMP in your ubuntu machine

Let’s start with updating Linux package repository

sudo apt update
sudo apt install software-properties-common
sudo add-apt-repository ppa:ondrej/php
sudo apt update
sudo apt install -y php7.3

above will install apache and PHP on your system

To install MySQL Server, use below-mentioned command

sudo apt-get -y install mysql-server

After above command, verify the installation with below commands

service apache2 status
service mysql status

Above should return the status as “Active(Running)”, if it doesn’t and you are facing any errors, feel free to comment below.

Check PHP version with

php -v

Add on to above, if you want to connect to MySQL using PHPMyAdmin Tool, install and configure it as below

apt -y install phpmyadmin 

After PHPMyAdmin is installed, edit /etc/apache2/apache2.conf
append below-mentioned line at the end of file

Include /etc/phpmyadmin/apache.conf

After above, restart apache to reflect changes

service apache2 restart && service apache2 status

Now, you will be able to access PHPMyAdmin with your IP/phpmyadmin URL

After this, you will require to know some basic commands of Apache which can help you work and troubleshoot it better in your use. Here’s the link

Drafted on: 11th March, 2020

1 thought on “How to install LAMP on ubuntu”

Leave a Comment