The LAMP is stands for Linux, Apache, Mysql, and PHP. It is an open source platform and works on the Linux operating system. It uses Apache web server, MySQL relational database management system, and PHP object-oriented scripting language.
In this tutorial, i am going to show you how to install Lamp on Ubuntu 20.04 server.
How To Install LAMP On Ubuntu 20.04
Just use the following steps to install lamp on ubuntu 20.04:
- Step 1 – Update System Dependencies
- Step 2 – Install The Apache On Ubuntu
- Step 3 – Install MySQL on Ubuntu
- Step 4 – Install PHP 7.2 On Ubuntu
- Step 5 – Test Installation
Step 1 – Update System Dependencies
First of all, open terminal and execute the following command into it to update the apt package:
sudo apt-get update
sudo apt-get upgrade
Step 2 – Install The Apache On Ubuntu
Then execute the following command on terminal to install apache on ubuntu:
sudo apt-get install apache2
Once the apache installation is done, execute the following command on terminal to check the Apache service status:
sudo systemctl status apache2
Output
apache2.service - The Apache HTTP Server
Loaded: loaded (/lib/systemd/system/apache2.service; enabled; vendor preset: enabled)
Drop-In: /lib/systemd/system/apache2.service.d
`-apache2-systemd.conf
Active: active (running) since Sun 2018-12-31 05:18:45 PDT; 2min 30s ago
Main PID: 3143 (apache2)
Tasks: 55 (limit: 2321)
CGroup: /system.slice/apache2.service
|-3143 /usr/sbin/apache2 -k start
|-3144 /usr/sbin/apache2 -k start
`-3145 /usr/sbin/apache2 -k start
Manage the Apache services using these below commands :
To start Apache
sudo systemctl start apache2
To Stop Apache
sudo systemctl stop apache2
Restart Apache
sudo systemctl restart apache2
Disable Apache
sudo systemctl disable apache2
Step 3 – Install MySQL on Ubuntu
Now, execute the following command on terminal to install MySQL server into your ubuntu server:
sudo apt install mysql-server
Secure MySQL Server Installation
Default MySQL is insecure , we need to secure the database server.
After installation is complete, the mysql_secure_installation
utility runs.
Run the below command and answer the few questions based on your environment requirements.
sudo mysql_secure_installation
Step 4 – Install PHP 7.2 On Ubuntu
Then execute the following command on terminal to install PHP 7.2 version on ubuntu server:
sudo apt-get install python-software-properties -y
sudo add-apt-repository ppa:ondrej/php
Install PHP with Exetension
sudo apt-get install php7.2
sudo apt-get install php7.2-<extension-name>
See example below
sudo apt-get install php7.2-fpm php7.2-curl php7.2-mysql \ php7.2-xml php7.2-zip php7.2-gd
Step 5 – Test Installation
Test your server by executing the following command:
php -v
Finally, we need to restart the Apache Web Server :
sudo systemctl restart apache2
Conclusion
In this tutorial, i have shown how to install LAMP on Ubuntu 20.04.