MENU
LAMP
LAMP is an acronym for:
Linux: the open-source operating system
Apache: the open-source HTTP web server
MySQL / MariaDB: the open-source relational database management system
PHP: the scripting language interpreter
Because Linux is open-source and free, LAMP has been a popular web server stack, often hosted on cloud computing platforms such as AWS, GCP, Azure, etc.
On Ubuntu 20.04, to install LAMP:
Step 1. Update the package repository:
sudo apt update && sudo apt -y upgrade
Step 2. Install MariaDB
sudo apt install software-properties-common mariadb-server mariadb-client
Step 3. Install Apache
sudo apt install -y apache2 apache2-utils
To start the service automatically during boot time:
sudo systemctl is-enabled apache2
Step 4. Install PHP
sudo apt install php libapache2-mod-php php-cli php-fpm php-json php-pdo php-mysql php-zip php-gd php-mbstring php-curl php-xml php-pear php-bcmath
Step 5. Test out the servers
mysql –V
apache2 -v
php –v
mkdir /var/run/apache2
source /etc/apache2/envvars
chmod –R 777 /var/www
sudo iptables -A INPUT -p tcp --dport 80 -j ACCEPT
echo "<?php phpinfo(); ?>" | sudo tee /var/www/html/phpinfo.php
apache2
(iptables is not supported on Ubuntu bash on Windows.)
Enter 'localhost' and 'localhost/phpinfo.php' on the address bar of a browser. You should see the Apache default page and the PHP settings.
The root of the site directory is located at: /var/www/html/ .
Depending on your environment, you may also need to add 'AcceptFilter http none' to the last line of /etc/apache2/apache2.conf .