Skip to main content

LAMP stack – install LAMP on a LumaDock VPS

Step by step guide to install Apache, MySQL, and PHP on Ubuntu for hosting websites.

Andy Wallace avatar
Written by Andy Wallace
Updated over a month ago

This guide shows how to install a full LAMP stack on a LumaDock VPS running Ubuntu 22.04. It covers Apache, MySQL, PHP, and basic testing so you can host websites or applications. You can also deploy a ready-made LAMP template in the panel if you prefer a quicker option.


Requirements

Your VPS must run Ubuntu 22.04 and you need SSH access as root or a sudo-enabled user.



Step 1 – Update the system

ssh root@YOUR_SERVER_IP apt update && apt upgrade -y


Install Apache

Apache handles web requests and serves your site. After installation you can browse to the server IP and confirm everything works.



Step 2 – Install Apache

apt install -y apache2 \
systemctl enable apache2 \
systemctl start apache2

Visit:

http://YOUR_SERVER_IP

You should see the default Apache page.


Install MySQL

MySQL provides the database layer for applications like WordPress or custom PHP apps.



Step 3 – Install MySQL

apt install -y mysql-server mysql_secure_installation

The script lets you set a root password, remove test data, and apply safer defaults.


Install PHP

PHP processes dynamic site code. The modules below let it integrate with Apache and MySQL.



Step 4 – Install PHP

apt install -y php libapache2-mod-php php-mysql


Verify PHP is working

A quick PHP info page confirms Apache is sending requests properly to PHP.



Step 5 – Test PHP processing

echo "<?php phpinfo(); ?>" > /var/www/html/info.php

Open:

http://YOUR_SERVER_IP/info.php

You should see a PHP information page. Remove the file when done because it exposes environment details.


Optional: Use the 1-click LAMP image

If you prefer not to install everything manually, the LumaDock control panel includes a LAMP stack template that deploys Apache, MySQL, and PHP automatically.

Your LAMP stack is now ready for applications, virtual hosts, and website deployments.

Did this answer your question?