How to Install a LAMP Stack on Debian 12 in Proxmox
2 mins read

How to Install a LAMP Stack on Debian 12 in Proxmox

If you’re running Proxmox and want a simple web server, a LAMP stack (Linux, Apache, MariaDB, PHP) is a reliable choice.

This guide shows how to install it inside a Debian 12 unprivileged container with nesting enabled.


1. Create the Debian 12 Container

Download the Debian 12 template
In the Proxmox web UI:

Node → Local → CT Templates → Templates → Debian 12 (bookworm) → Download

Create the container

  • Select the Debian 12 template
  • Allocate 4–8 GB disk space
  • Configure the network

Enable features

  • Check Nesting
  • Check Keyctl

Start the container.


2. Access the Container

From the Proxmox host:

pct enter <CTID>

Replace <CTID> with the container ID.


3. Update the System

apt update && apt upgrade -y


4. Install Apache

apt install apache2 -y
systemctl enable apache2 --now

Test:
Open your container’s IP in a browser — you should see the Apache default page.


5. Install MariaDB

apt install mariadb-server mariadb-client -y
systemctl enable mariadb --now
mysql_secure_installation

Follow the prompts to secure MariaDB.

Tip: MariaDB works with most software that supports MySQL.


6. Install PHP

apt install php libapache2-mod-php php-mysql php-cli php-common php-zip php-gd php-mbstring php-curl php-xml php-bcmath -y


7. Make Apache Load PHP First

Edit the Apache configuration:

nano /etc/apache2/mods-enabled/dir.conf

Move index.php before index.html.

Restart Apache:

systemctl restart apache2


8. Test PHP

Create a PHP info file:

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

Open in a browser:

http://&lt;container-ip>/info.php

Delete the test file after checking:

rm /var/www/html/info.php


9. (Optional) Enable Remote MySQL Access

Edit the MariaDB config:

nano /etc/mysql/mariadb.conf.d/50-server.cnf

Change:

bind-address = 0.0.0.0

Restart MariaDB:

systemctl restart mariadb

Create a remote user:

CREATE USER 'username'@'%' IDENTIFIED BY 'password';
GRANT ALL PRIVILEGES ON *.* TO 'username'@'%' WITH GRANT OPTION;
FLUSH PRIVILEGES;


Done 🎉

You now have a LAMP stack running in a Debian 12 Proxmox container — ready for websites, testing, or apps.

Note: For production, set up HTTPS with Let’s Encrypt and keep regular backups.

Leave a Reply

Your email address will not be published. Required fields are marked *