How to Install LAMP Web Server On Ubuntu 20.04


Hello Friends, today I wanna talk about How to install a LAMP on ubuntu 20.04 server. LAMP is a short word for "Linux Apache Mysql Php", It is basically a complete package of web server
First things first, open up a terminal then check that your system is up to date by typing:

sudo apt update && sudo apt upgrade -y

Now we are ready to install LAMP, we will install it one by one.

Installing Apache and php7.4


sudo apt install apache2 -y

then we need to install php7.4 by typing:

sudo apt install php7.4 -y

after that we need to install libapache2-mod-php7.4 this package is a module it will make php work with apache2, install it by typing:

sudo apt install libapache2-mod-php7.4 -y

Installing SQL Database

Now we are ready to install a sql database, and I'll give you 2 choices, first is mariadb and second is Mysql server from oracle, from what i read there almost no different between them, just mariadb is free and open source, it was created by the original Mysql server developers and if you want to use open source software only, I encourage you to install mariadb by typing:

sudo apt install mariadb-server -y

if you just need the original Mysql server from oracle just type:

sudo apt install mysql-server -y

You need another package module php7.4-mysql this module is a php support to mysql server form oracle or mariadb. install it by typing:

sudo apt install php7.4-mysql -y

Now whatever your choice is, you need to setup the new install sql server by creating a new root password and answering some relative questions about your new setup, do that by typing:

sudo mysql_secure_installation

Read and follow what you will appear and answer the questions as you pleased

Double check Startup and running services

You are just finished, Lamp should be automatically running and will start up in boot when you boot up your system to double check just type:

sudo systemctl status apache2
sudo systemctl status mysql

You should get active and running services, but if for some reason you get Inactive (Dead), do the following:

sudo systemctl start apache2
sudo systemctl enable apache2
sudo systemctl start mysql
sudo systemctl enable mysql

Your web server is just ready go to /var/www/html and start coding.

Thank you for reading and I hope this helps you some way

Comments