LAMP STACK WITH APACHE ON UBUNTU Complete Production-Ready Setup Guide ============================================================ 1. INTRODUCTION LAMP stands for: L - Linux (Ubuntu) A - Apache M - MySQL / MariaDB P - PHP This guide provides a full Apache-based LAMP configuration for development and production environments. ============================================================ 2. REQUIREMENTS - Ubuntu 18.04 / 20.04 / 22.04 / 24.04 - Sudo access - 2 GB RAM recommended - Public IP or domain (for production) Check version: lsb_release -a ============================================================ 3. UPDATE SYSTEM sudo apt update sudo apt upgrade -y sudo apt autoremove -y ============================================================ 4. INSTALL APACHE sudo apt install apache2 -y sudo systemctl enable apache2 sudo systemctl start apache2 sudo systemctl status apache2 ============================================================ 5. CONFIGURE FIREWALL sudo ufw allow OpenSSH sudo ufw allow ‘Apache Full’ sudo ufw enable sudo ufw status ============================================================ 6. INSTALL MYSQL sudo apt install mysql-server -y sudo systemctl enable mysql sudo systemctl start mysql Secure installation: sudo mysql_secure_installation ============================================================ 7. INSTALL PHP sudo apt install php libapache2-mod-php php-mysql php-cli php-curl php-gd php-mbstring php-xml php-zip php-bcmath php-soap -y php -v sudo systemctl restart apache2 ============================================================ 8. CONFIGURE APACHE FOR PHP Edit: sudo nano /etc/apache2/mods-enabled/dir.conf Ensure: DirectoryIndex index.php index.html index.cgi index.pl index.xhtml index.htm Restart Apache: sudo systemctl restart apache2 ============================================================ 9. TEST PHP Create test file: sudo nano /var/www/html/info.php Add: