Install LAMP stack with MariaDB on Ubuntu 25.10 and you will have Apache serving HTTP requests, PHP 8.4 processing dynamic pages, and MariaDB ready for application data. The setup takes about ten minutes on a clean VPS, including a firewall and a temporary PHP check.
Ubuntu 25.10 is an interim release and reached end of life on July 9, 2026. Use Ubuntu 26.04 LTS for a new production server; the instructions below are for an existing Questing installation that must be kept running.
Prerequisites
- A 64-bit Ubuntu 25.10 (Questing Quokka) VPS with at least 1 GB of RAM and 10 GB of free disk space.
- SSH access as
root, or a normal account with workingsudoprivileges. - A public IPv4 address and outbound access to the Ubuntu package archive.
- A domain such as
YOUR_DOMAINis optional for the initial install, but required for a trusted TLS certificate. - A VPSLake Linux VPS with root access if you need a server for this stack.
The commands use sudo. If you are logged in as root, remove sudo from each command. Keep an existing SSH session open while changing firewall rules.
Step 1: Confirm Questing and refresh its package sources
Ubuntu 25.10 is archived, so an existing server must use the Ubuntu release archive before APT can find packages. This step also applies the last package set available for Questing; it does not restore security support.
grep -E '^(PRETTY_NAME|VERSION_ID|VERSION_CODENAME)=' /etc/os-release
uname -m
if [ -f /etc/apt/sources.list.d/ubuntu.sources ]; then
sudo sed -i -E 's#https?://[^[:space:]]*ubuntu/?#http://old-releases.ubuntu.com/ubuntu#g' /etc/apt/sources.list.d/ubuntu.sources
else
sudo sed -i -E 's#https?://[^[:space:]]*ubuntu/?#http://old-releases.ubuntu.com/ubuntu#g' /etc/apt/sources.list
fi
sudo apt update
sudo apt full-upgrade -y
The release check should show VERSION_ID="25.10", codename questing, and normally x86_64 for an AMD64 VPS. Do not replace questing with another codename; the archive retains the release-specific package metadata.
PRETTY_NAME="Ubuntu 25.10 (Questing Quokka)"
VERSION_ID="25.10"
VERSION_CODENAME=questing
x86_64
If the server has third-party APT sources, disable any that fail during apt update before continuing. Do not mix packages from another Ubuntu release.
Step 2: Install Apache and protect the public ports
Apache is the web-facing part of LAMP, while UFW keeps inbound access limited to SSH and the two standard web ports.
sudo apt install -y apache2 apache2-utils curl ufw
sudo ufw allow OpenSSH
sudo ufw allow 80/tcp
sudo ufw allow 443/tcp
sudo ufw --force enable
sudo systemctl enable --now apache2
sudo apachectl configtest
sudo systemctl is-active apache2
sudo ufw status verbose
Add the SSH rule before enabling UFW. If SSH uses a custom port, replace the OpenSSH rule with sudo ufw allow YOUR_SSH_PORT/tcp, substituting the numeric port from /etc/ssh/sshd_config or ss output. The checks should show Syntax OK, active, and an enabled firewall.
Test Apache locally before testing the public address. This separates a web-server problem from DNS, routing, or a provider-level firewall problem.
curl -fsSI http://127.0.0.1/
HTTP/1.1 200 OK
Content-Type: text/html
You can also open http://SERVER_IP/ from another device. The default Apache page confirms that port 80 is reachable.
Step 3: Install and secure MariaDB
MariaDB holds application data; leaving it on local access means a PHP application can use the database without exposing port 3306 to the Internet.
sudo apt install -y mariadb-server mariadb-client
sudo systemctl enable --now mariadb
sudo systemctl is-active mariadb
sudo mariadb-secure-installation
The hardening utility is documented in MariaDB’s official mariadb-secure-installation reference. On a fresh package install, press Enter for an empty current root password when appropriate, remove anonymous accounts, reject remote root login, remove the test database, and reload the privilege tables. Unix-socket authentication for the administrative account is a normal choice.
Create a database and a separate local application account. Replace YOUR_DB_PASSWORD with a long, unique password before running the block; do not put the real password in a public web file.
sudo mariadb <<'SQL'
CREATE DATABASE lampdb CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
CREATE USER 'lampuser'@'localhost' IDENTIFIED BY 'YOUR_DB_PASSWORD';
GRANT ALL PRIVILEGES ON lampdb.* TO 'lampuser'@'localhost';
FLUSH PRIVILEGES;
SQL
sudo mariadb -e "SHOW DATABASES LIKE 'lampdb';"
The final command should return a row named lampdb. Do not add a UFW rule for 3306: an application on this VPS can connect through the local socket or loopback interface.
Database (lampdb)
lampdb
Step 4: Install PHP 8.4-FPM and connect it to Apache
Ubuntu 25.10’s native repositories provide the PHP 8.4 package series. PHP-FPM handles PHP through FastCGI, so Apache does not need the older embedded PHP module; the PHP-FPM manual describes this process manager.
Install the runtime, the MariaDB driver, and common extensions used by PHP applications.
sudo apt install -y php8.4-cli php8.4-fpm php8.4-mysql php8.4-curl php8.4-gd php8.4-mbstring php8.4-xml php8.4-zip php8.4-opcache
php -v
The first line should begin with PHP 8.4.
PHP 8.4.x (cli) (built: ...)
Enable Apache’s FastCGI support, load the matching FPM configuration, and start the versioned service at boot.
sudo a2enmod proxy_fcgi setenvif
sudo a2enconf php8.4-fpm
sudo systemctl enable --now php8.4-fpm
sudo systemctl reload apache2
sudo systemctl is-active php8.4-fpm
Create a small endpoint that returns a fixed message rather than revealing PHP settings with phpinfo(). Remove it immediately after the request succeeds.
printf '%s\n' '<?php echo "PHP OK\\n"; ?>' | sudo tee /var/www/html/health.php > /dev/null
curl -fsS http://127.0.0.1/health.php
sudo rm -f /var/www/html/health.php
PHP OK
Verify the LAMP stack
Run the checks together to confirm that Apache, PHP-FPM, and MariaDB are active, enabled for the next boot, and able to serve a PHP request.
sudo systemctl is-active apache2 php8.4-fpm mariadb
sudo systemctl is-enabled apache2 php8.4-fpm mariadb
sudo apachectl configtest
php -m | grep -E 'mysqli|mysqlnd|PDO|mbstring|xml'
sudo mariadb -e "SELECT VERSION();"
curl -fsSI http://127.0.0.1/
sudo ufw status
Expect three active lines, three enabled lines, Syntax OK, PHP module names, a MariaDB version, an HTTP success response, and Status: active from UFW.
active
active
active
enabled
enabled
enabled
Syntax OK
HTTP/1.1 200 OK
Status: active
Troubleshooting
apt update returns 404 or “does not have a Release file”
Questing was moved off the active mirrors after end of life. Repoint only the Ubuntu source URL to the old-release archive and keep the questing, questing-updates, and questing-security suites unchanged.
if [ -f /etc/apt/sources.list.d/ubuntu.sources ]; then
sudo sed -i -E 's#https?://[^[:space:]]*ubuntu/?#http://old-releases.ubuntu.com/ubuntu#g' /etc/apt/sources.list.d/ubuntu.sources
else
sudo sed -i -E 's#https?://[^[:space:]]*ubuntu/?#http://old-releases.ubuntu.com/ubuntu#g' /etc/apt/sources.list
fi
sudo apt update
If a separate vendor repository still fails, disable that repository rather than changing Ubuntu’s codename or adding a PHP PPA.
E: Unable to locate package php8.4-fpm
The APT index is stale, the server is not using Questing sources, or the universe component is missing. Confirm the release and inspect the package candidate before retrying.
grep -E '^(VERSION_ID|VERSION_CODENAME)=' /etc/os-release
sudo apt update
apt-cache policy php8.4-fpm
sudo apt install -y php8.4-fpm
The policy output should show a candidate from the Questing archive. Do not install a package built for Noble, Plucky, or another release.
Apache returns 503 Service Unavailable for a PHP URL
PHP-FPM may be stopped, or Apache may not have its versioned FastCGI configuration enabled. Check the unit and socket, then reload both services after correcting the first error in the log.
sudo systemctl status php8.4-fpm --no-pager
sudo journalctl -u php8.4-fpm -n 40 --no-pager
ls -l /run/php/php8.4-fpm.sock
sudo apachectl configtest
sudo systemctl restart php8.4-fpm apache2
Do not expose the FPM socket or port to the network. If the socket is absent, fix the FPM service failure before restarting Apache.
SSH stops working after UFW is enabled
The firewall rule did not match the port used by sshd. Open VPS control panel (Virtualizor) → VNC console from the VPSLake client area, allow the actual port, and keep the current console session open while testing a second SSH connection.
sudo ss -ltnp | grep ssh
sudo ufw allow YOUR_SSH_PORT/tcp
sudo ufw status numbered
Replace YOUR_SSH_PORT with the numeric listening port. Remove an obsolete broad rule only after the new SSH connection works.
Hardening
- Move this server to Ubuntu 26.04 LTS before production use; an archived 25.10 installation does not receive new security fixes.
- Point
YOUR_DOMAINto the VPS, configure an Apache virtual host, and issue a trusted TLS certificate before accepting passwords or personal data. - Keep MariaDB on local access and port 3306 closed. Back up
/var/wwwand the database separately. - Keep SSH key authentication enabled and review the policy with the VPSLake UFW firewall generator.
FAQ
Is Ubuntu 25.10 still supported?
No. Ubuntu 25.10 reached its planned end of life in July 2026, so its packages are available from the archive but no longer receive normal security maintenance. For a new VPS, select Ubuntu 26.04 LTS instead.
Which PHP version should I use on Ubuntu 25.10?
Use the native PHP 8.4 packages and the matching php8.4-fpm service. Pinning the FPM configuration to that branch keeps Apache, the socket path, and systemd aligned; adding a third-party repository is unnecessary for this release.
Does a LAMP website need MariaDB port 3306 open?
No. When Apache, PHP, and MariaDB share one VPS, the application can connect locally. A remote database connection should be an intentional exception restricted to known source addresses and protected with encryption.
Can I run the stack without a domain name?
Yes. Apache can answer on the VPS IP, and the health endpoint can be checked locally. Add the domain later, create the virtual host, and enable TLS after DNS points to the server.