Ubuntu 24.04 with LAMP Stack

This comprehensive guide covers all steps to launch and verify your LAMP Stack (Linux, Apache, MySQL, PHP) instance on Ubuntu Server 24.04.

Overview: This AMI provides a pre-configured Ubuntu 24.04 LTS environment with a complete LAMP Stack, ready for immediate web application development and deployment. The stack includes Linux (Ubuntu 24.04), Apache web server, MySQL database, and PHP, offering a powerful, flexible platform for developing and deploying dynamic web applications.

Step 1: Launch EC2 Instance

  1. Navigate to the LAMP Stack on Ubuntu 24.04 AMI
  2. Click “Continue to Subscribe”
  3. Accept the terms and click “Continue to Configuration”
  4. Select your preferred AWS region
  5. Click “Continue to Launch”

Recommended Configuration

  • Instance Type: t3.medium or higher
  • Storage: Minimum 20 GiB (50 GiB recommended for production)
  • Security Group:
    • Port 22 (SSH)
    • Port 80 (HTTP)
    • Port 443 (HTTPS)
    • Port 3306 (MySQL) – Only if remote database access is needed

Step 2: Connect to Your Instance

Secure Shell (SSH)

  1. Wait for the instance to reach the running state in your cloud console
  2. Locate the instance’s Public IP address
  3. Use an SSH client (like Terminal on macOS/Linux, or PuTTY/Windows Terminal on Windows) and your private key file
  4. The default username for Ubuntu AMIs is typically ubuntu
Command: ssh -i /path/to/your-key-pair.pem ubuntu@<Instance-Public-IP>
Username: ubuntu
Key File: /path/to/your-key-pair.pem
Instance IP: Your instance public IP

Step 3: Verify LAMP Stack Installation

Once connected to your Ubuntu Server, verify all LAMP stack components are installed and operational using these methods:

Method 1: Verify Apache Web Server

A. Check that Apache is installed and running.
  1. Run the following command in your SSH terminal:
systemctl status apache2
  1. Verification: The output should show the service status as active (running)

Expected output:

● apache2.service - The Apache HTTP Server
     Loaded: loaded (/lib/systemd/system/apache2.service; enabled; vendor preset: enabled)
     Active: active (running) since...
  • active (running) = Apache HTTP Server is operational and serving requests.
B. Check the Apache version to confirm the installation.
  1. Run the following command in your SSH terminal:

apache2 -v
  1. Verification: The output should return the Apache version information.

Expected output:

Server version: Apache/2.4.x (Ubuntu)
Server built:   2024-xx-xx
  • Successful version output = Apache HTTP Server is properly installed and configured.
Apache Service status and Version

Method 2: Verify MySQL Database

A. Check that MySQL is installed and running.
  1. Run the following command in your SSH terminal:
systemctl status mysql
  1. Verification: The output should show the service status as active (running)

Expected output:

● mysql.service - MySQL Community Server
     Loaded: loaded (/lib/systemd/system/mysql.service; enabled; vendor preset: enabled)
     Active: active (running) since...
B. Check the MySQL version to confirm the installation.
  1. Run the following command in your SSH terminal:
sudo mysql --version
  1. Verification: The output should return the Mysql version information.

Expected output:

mysql  Ver 8.0.x-0ubuntu0.24.04.x for Linux on x86_64 ((Ubuntu))
MySQL Service status and Version

Method 3: Verify PHP Installation

A. Check that PHP is installed and properly configured.
  1. Check PHP Version:
php -v
  1. Verification: The output should return the PHP version information.

Expected output:

PHP 8.x.x (cli) (built: ...)
Copyright (c) The PHP Group
Zend Engine v4.x.x
B. Check PHP Apache Module:
  1. Run the following command in your SSH terminal:
apache2ctl -M | grep php
  1. Verification: The output should return the Mysql version information.

Expected output:

php_module (shared)
PHP version and module

Step 4: Test LAMP Stack Integration

Verify that all components work together by accessing the web server.

Test Web Server Access:

  1. Open a web browser
  2. Navigate to: http://<Your-Instance-Public-IP>
  3. You should see the default page with php and apache info.
Default page on web with detail info