Setting Up a LAMP Stack on Ubuntu 24.04

LAMP — Linux, Apache, MySQL, PHP — has been the default stack for self-hosted web applications since the late 90s, and despite decades of new frameworks and cloud platforms, it’s still the fastest way to get a traditional PHP application running on your own server.

Installing the Stack

sudo apt update
sudo apt install -y apache2 mysql-server php libapache2-mod-php php-mysql

# Verify each component
apache2 -v
mysql --version
php -v

Securing MySQL

sudo mysql_secure_installation
# Answer yes to: remove anonymous users, disallow remote root login,
# remove test database, reload privilege tables

A Minimal Virtual Host

<VirtualHost *:80>
    ServerName myapp.local
    DocumentRoot /var/www/myapp
    <Directory /var/www/myapp>
        AllowOverride All
        Require all granted
    </Directory>
    ErrorLog ${APACHE_LOG_DIR}/myapp-error.log
    CustomLog ${APACHE_LOG_DIR}/myapp-access.log combined
</VirtualHost>
sudo a2ensite myapp.conf
sudo a2enmod rewrite
sudo systemctl reload apache2

Is LAMP Still Relevant in 2026?

For WordPress, legacy PHP applications, and anyone who wants full control without container orchestration overhead, absolutely. For new greenfield projects you’d more likely reach for Nginx and a containerized stack — but LAMP’s simplicity and enormous body of existing documentation still make it the pragmatic choice for a huge share of the web.