DriversRecommendedOutdated drivers can make a good PC feel brokenScan driver issues before chasing fixes manually.Scan NowOctober DealsAmazon USOctober deal check: compare before you payAmazon US: current deals, useful picks and tech finds.Check DealsSlow PC?RecommendedPC slow today? Run a repair scan before it gets worseResolve common Windows issues and optimize system performance.Scan Now×
Skip to content
World desk13 min

How to Install WordPress with LAMP on Debian (Apache, MariaDB, and PHP)

Install WordPress on Debian using the packaged LAMP route: Apache, MariaDB, PHP, a dedicated database, Debian’s virtual-host layout, and the final browser installer.
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

On Debian, the most maintainable way to deploy WordPress with a LAMP stack is to install Debian’s wordpress package alongside Apache, MariaDB, and PHP, then connect it to a dedicated database and Apache virtual host. The package places core files in /usr/share/wordpress, stores writable content in /var/lib/wordpress/wp-content, and finishes through a browser at /wp.

The commands below cover a single-site installation. They assume a supported Debian release, a resolvable hostname, shell access with root or sudo privileges, and a browser. For a public site, use HTTPS and verify that your Debian release provides versions compatible with WordPress’s current production guidance before you begin.

As an Amazon Associate I earn from qualifying purchases.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Check compatibility before installing

WordPress’s current production guidance recommends PHP 8.3 or newer, MariaDB 10.11 or newer or MySQL 8.0 or newer, HTTPS, and Apache or Nginx. Debian’s packaged WordPress version depends on the Debian release, so check the versions available on the server instead of assuming that every release meets those upstream recommendations.

Debian release WordPress version listed by Debian What to verify
Debian 11 (Bullseye) 5.7.14 PHP and database versions supplied by the release may be below current upstream production guidance.
Debian 12 (Bookworm) 6.1.9 Check the installed PHP and MariaDB versions before exposing the site publicly.
Debian 13 (Trixie) 6.8.3 Confirm the exact versions offered by your enabled repositories and security updates.

These package versions are the versions listed on Debian’s WordPress page in January 2026; they can change as Debian updates its repositories. Check your system with:

cat /etc/debian_version
apt policy wordpress php mariadb-server

You also need a hostname that resolves to the server. For a private test, you can map a name to the machine’s address in the client’s /etc/hosts; for an Internet-facing site, create the appropriate DNS record. Keep the name you choose consistent in Apache and in Debian’s WordPress configuration filename.

Pre-installation checklist

  • Use a supported Debian release with package repositories and security updates enabled.
  • Confirm root or sudo access and have a text editor available for Apache and PHP configuration files.
  • Decide whether this is a private test site or a public production site. Public deployments need DNS, HTTPS, backups, and additional hardening.
  • Record the exact hostname, because Debian uses the HTTP hostname to select a WordPress configuration file.
  • Have a browser available on a machine that can resolve and reach the hostname.

WordPress can run on many PHP-capable servers, but Apache or Nginx is the recommended robust and featureful choice. This guide uses Apache because it matches Debian’s documented package layout.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Install Apache, MariaDB, PHP support, and WordPress

Refresh package metadata and install Debian’s integrated WordPress package:

apt update
apt install wordpress curl apache2 mariadb-server

The wordpress package pulls in the PHP components it declares as dependencies. Debian’s LAMP guidance identifies the PHP MySQL connector as a required part of the stack. If the resolver did not install it for your release, add the release’s package explicitly:

apt install php-mysql

Confirm that the services are running and that PHP is available to Apache:

systemctl enable --now apache2 mariadb
php -v
apachectl -M | grep -E 'php|mpm'

The exact PHP Apache module name varies by Debian release. If no PHP integration appears, inspect the installed PHP packages and Apache modules before continuing; otherwise Apache may display PHP source code or offer .php files for download.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

The package route is deliberately different from downloading a WordPress archive. Debian owns the core files, configuration conventions, and update path, while writable site data is separated into /var/lib/wordpress/wp-content. Do not unpack a second copy into the Apache document root after completing these commands: doing so makes it unclear which copy receives security updates and which configuration Apache is serving.

Harden MariaDB and create a WordPress database

Run the MariaDB hardening tool

Start the interactive hardening process:

mysql_secure_installation

Answer its prompts deliberately. Remove anonymous accounts, prevent remote administrative login where appropriate, remove the test database, and reload privilege tables. The wording differs slightly between MariaDB releases, so read each prompt rather than applying a copied answer sequence blindly.

Create a separate database and application user

WordPress should never connect as the MariaDB administrator. Create one database and one user for this site, granting privileges only on that database. The following example uses the names wordpress and wordpress; choose a strong, unique password and substitute it for the example value.

To keep the password out of normal shell history, write the SQL to a temporary file readable only by root:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
umask 077
cat > /root/wordpress-db.sql <<'SQL'
CREATE DATABASE wordpress CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
CREATE USER 'wordpress'@'localhost' IDENTIFIED BY 'replace-with-a-long-random-secret';
GRANT ALL PRIVILEGES ON wordpress.* TO 'wordpress'@'localhost';
FLUSH PRIVILEGES;
SQL
mysql < /root/wordpress-db.sql
rm -f /root/wordpress-db.sql

Use a password manager or another protected method to retain the secret for the configuration step. Do not publish it in documentation, paste it into a public issue, or leave the SQL file on the server.

Check that MariaDB recognizes the account and database:

mysql -e "SHOW DATABASES;"
mysql -e "SHOW GRANTS FOR 'wordpress'@'localhost';"

The grant should be scoped to wordpress.*, not to every database on the server. The host portion of the account matters: an account created for localhost is not automatically the same account as one created for 127.0.0.1. Keep DB_HOST consistent with the account you create.

Configure Apache with a dedicated virtual host

Debian’s package layout expects WordPress core at /usr/share/wordpress and writable content at /var/lib/wordpress/wp-content. Create a site definition at /etc/apache2/sites-available/wp.conf:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
<VirtualHost *:80>
    ServerName myblog.example.com
    ServerAdmin [email protected]
    DocumentRoot /usr/share/wordpress

    Alias /wp-content /var/lib/wordpress/wp-content
    <Directory /usr/share/wordpress>
        Options FollowSymLinks
        AllowOverride Limit Options FileInfo
        DirectoryIndex index.php
        Require all granted
    </Directory>
    <Directory /var/lib/wordpress/wp-content>
        Options FollowSymLinks
        Require all granted
    </Directory>

    ErrorLog ${APACHE_LOG_DIR}/error.log
    CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>

Replace myblog.example.com with the hostname users will request. The ServerName, DNS record (or local hosts entry), and Debian configuration filename must agree.

Disable Debian’s default site, enable the new virtual host, validate the syntax, and reload Apache:

a2dissite 000-default
a2ensite wp
apachectl configtest
service apache2 reload

apachectl configtest should report Syntax OK. If it reports an error, correct the configuration before reloading. Check the active site list with:

apache2ctl -S

The configuration above intentionally follows Debian’s package conventions. Pretty permalinks, multisite, and alternate helper-script layouts have additional requirements. Read /usr/share/doc/wordpress/README.Debian before adding rewrite rules or changing the document and content paths; do not combine instructions for an upstream tarball with this package layout.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Single site or multisite?

This virtual host is for one ordinary WordPress site. A multisite installation or Debian’s alternate helper-script arrangement can use different aliases, rewrite behavior, and setup steps. Decide before creating the site rather than converting paths casually afterward. Debian documents those alternatives in README.Debian; follow one complete layout and do not mix helper-script instructions with a manually assembled upstream layout.

Create Debian’s hostname-specific WordPress configuration

Debian’s package selects configuration files according to the HTTP hostname. For myblog.example.com, create:

/etc/wordpress/config-myblog.example.com.php

Put the database values and content path in that file:

<?php
 define('DB_NAME', 'wordpress');
 define('DB_USER', 'wordpress');
 define('DB_PASSWORD', 'replace-with-a-long-random-secret');
 define('DB_HOST', 'localhost');
 define('WP_CONTENT_DIR', '/var/lib/wordpress/wp-content');
?>

Replace the password with the exact secret used when creating the MariaDB account. Keep the file readable by the web process but protected from unrelated users:

What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
chown root:www-data /etc/wordpress/config-myblog.example.com.php
chmod 640 /etc/wordpress/config-myblog.example.com.php

Debian also documents fallback names such as config-example.com.php and config-default.php. A hostname-specific file is safer for a server hosting more than one site because each virtual host can select its own database settings. Ensure that the browser’s Host header matches the name in the filename; otherwise WordPress may use a different configuration or fail to find one.

Keep this file outside the document root. It contains the database password and should not be copied into a public backup, pasted into a support ticket, or made world-readable. If you change the database password later, update both MariaDB and this file together, then retest the site.

Finish the installation in your browser

  1. Open http://myblog.example.com/wp, replacing the hostname with yours. Debian documents this path as redirecting to /wp/wp-admin/install.php.
  2. Enter a site title, an administrator username, a strong administrator password, and an email address.
  3. Complete the installer and sign in at the administrator URL it provides.
  4. For a public server, configure HTTPS before using the administrator login over the Internet. WordPress’s current requirements list HTTPS for production deployments.

If the page does not load, verify DNS or the local hosts entry, confirm that Apache is listening on port 80, and inspect the virtual-host and error logs. A successful browser redirect confirms that Apache is serving the Debian package and that the hostname-specific configuration was found.

For a private installation, the local hostname can be sufficient. For a public installation, complete DNS and HTTPS work before inviting users or entering production data. The browser installer creates the site-level administrator account; it does not replace operating-system, database, or web-server hardening.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Verify the completed LAMP stack

Run these checks after the browser installer finishes:

  • Apache: systemctl status apache2 should show an active service, and apache2ctl -S should show the WordPress virtual host.
  • MariaDB: systemctl status mariadb should show an active service. The WordPress user should have grants only on its own database.
  • PHP: Confirm the installed version with php -v and ensure Apache has PHP integration enabled.
  • Files: Core files should remain under /usr/share/wordpress; uploads, themes, and plugins belong under /var/lib/wordpress/wp-content with permissions that allow the web process to write where needed.
  • Hostname: Request the site using the same hostname used in ServerName and the configuration filename.

Check both an ordinary front-end page and /wp/wp-admin. Confirm that a test upload is stored in the content location and that the administrator can sign out and sign back in over the intended protocol. These simple checks catch mismatched aliases, permissions, and hostnames before the site receives visitors.

Keep Debian WordPress updated

Use Debian’s package manager for WordPress, Apache, PHP, and MariaDB security updates:

apt update
apt upgrade

Review the proposed changes before confirming them, especially on a production site. Debian’s package integration is the reason paths and update procedures differ from an installation made by unpacking an upstream archive.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Before changing themes, plugins, content locations, multisite behavior, or upgrade mechanics, read:

/usr/share/doc/wordpress/README.Debian

Keep independent backups of the database and /var/lib/wordpress/wp-content. A backup is only useful if you can restore it, so periodically test restoration on a separate system or maintenance instance. Apply updates during a planned window when plugin or theme compatibility matters.

Package updates can change the WordPress version supplied by a Debian release, but they do not remove the need to review plugin and theme compatibility. Keep a record of the installed Debian release, PHP version, database version, and enabled extensions so a future upgrade can be evaluated against WordPress’s PHP 8.3+, MariaDB 10.11+/MySQL 8.0+, and HTTPS production guidance.

Troubleshoot common installation failures

Apache shows a directory listing or downloads PHP

Check that the WordPress virtual host is enabled, DirectoryIndex index.php is present, and Apache’s PHP integration and MySQL PHP connector are installed. Confirm the request is reaching the intended virtual host with apache2ctl -S, then inspect /var/log/apache2/error.log.

Free tools Windows power users keep installed

One-click scans. No signup required.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

“Error establishing a database connection”

Compare every value in /etc/wordpress/config-myblog.example.com.php with the database you created: DB_NAME, DB_USER, DB_PASSWORD, and DB_HOST. Check MariaDB’s service state and verify the account’s grants. A password typo, a user created for a different host (for example, 127.0.0.1 instead of localhost), or a missing database is more common than a WordPress defect.

Permalinks return 404 errors

Review Apache rewrite and module settings and follow the Debian instructions in /usr/share/doc/wordpress/README.Debian. Rules copied from an unrelated upstream-tarball installation may reference the wrong document root or permissions.

The installer uses the wrong site configuration

Check the hostname in the browser address bar, Apache’s ServerName, and the filename under /etc/wordpress. Debian chooses the first matching configuration based on the HTTP hostname, so a mismatch can select a fallback file.

The site works locally but not from the Internet

Confirm that public DNS points to the server, the firewall permits the web service, and Apache is bound to the expected address. Add HTTPS before exposing the login page publicly, and avoid testing with a hostname that resolves to a different machine.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Updates appear to change the wrong copy

Look at the active virtual host and document root with apache2ctl -S, then confirm that /usr/share/wordpress is the directory being served. If an archive was previously unpacked elsewhere, remove the ambiguity before updating; otherwise Debian may update one installation while Apache serves another.

Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Package installation versus an upstream archive

Decision point Debian package Upstream archive
File layout Uses /usr/share/wordpress and /var/lib/wordpress/wp-content. Uses the directory layout you choose when unpacking the archive.
Configuration Hostname-aware files under /etc/wordpress. Usually configured inside the application directory according to upstream instructions.
Updates Managed with Debian’s package and security-update process. Requires the archive’s own upgrade procedure.
Best fit Administrators who want Debian integration and predictable system paths. Administrators who specifically need a release or layout not supplied by their Debian repositories.

Choose one method for a site. Mixing package paths, permissions, and upgrade instructions can leave Apache serving one copy while updates modify another. The package route is generally the simpler choice when the Debian-supplied WordPress version and PHP/database versions satisfy your requirements; an archive is a deliberate alternative, not an extra step in this procedure.

Private test site versus public production site

A local or private installation mainly needs a reachable hostname, working services, and a browser. A public site adds operational requirements: DNS must resolve to the server, HTTPS must protect administrator credentials, backups must cover both the database and writable content, and MariaDB and Apache should be hardened rather than left at default settings.

Before switching from testing to production, verify the exact PHP and database versions against WordPress’s current requirements, confirm that the virtual host is the only intended site answering for the hostname, and test a restore of the database and wp-content. Capacity also matters: the hosting handbook lists 128 MB as sufficient for a vanilla installation, but plugins, themes, image processing, administrator concurrency, and traffic can require substantially more.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Resource expectations

WordPress’s hosting handbook lists 128 MB as sufficient for a vanilla installation. That is a baseline, not a capacity guarantee: media processing, large themes, demanding plugins, concurrent administrators, and traffic can require substantially more memory, CPU, storage, and database capacity. Measure the workload and plan capacity before adding resource-intensive features.

Frequently Asked Questions

Which Debian package command installs the complete WordPress LAMP stack?

Run apt update, then apt install wordpress curl apache2 mariadb-server. If your release did not install the PHP MySQL connector as a dependency, add apt install php-mysql.

Why should WordPress have its own MariaDB user?

A dedicated account limits WordPress to its own database instead of granting the application administrator-level access to every database. Create a separate user, grant it privileges on wordpress.*, and use a strong unique password.

Where does Debian’s WordPress package store files?

Core files are under /usr/share/wordpress. Writable uploads, themes, and plugins are exposed from /var/lib/wordpress/wp-content. Hostname-specific database settings belong under /etc/wordpress.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

What URL opens the Debian WordPress installer?

Open the configured hostname followed by /wp, such as http://myblog.example.com/wp. Debian documents a redirect to /wp/wp-admin/install.php.

What should I do if WordPress reports a database connection error?

Compare DB_NAME, DB_USER, DB_PASSWORD, and DB_HOST with the MariaDB database and account. Check systemctl status mariadb and the grants, paying attention to the difference between localhost and 127.0.0.1.

Should I use Debian’s package or an upstream WordPress archive?

Use the Debian package when you want Debian’s filesystem layout, hostname-aware configuration, and package-managed updates. Use an archive only when you deliberately need a release or layout not supplied by your repositories, and never mix the two layouts.

Is 128 MB enough memory for WordPress?

The WordPress Hosting Handbook lists 128 MB as sufficient for a vanilla installation. Media processing, heavy plugins, large themes, concurrent users, and traffic can require more memory and other resources.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

What must be checked before making the site public?

Confirm that DNS reaches the server, the Debian-provided PHP and database versions meet current WordPress guidance, MariaDB has been hardened, HTTPS protects the login, and tested backups cover the database and /var/lib/wordpress/wp-content.

The Bottom Line

Install Debian’s wordpress package with Apache and MariaDB, create a least-privilege database account, map a dedicated virtual host to Debian’s WordPress paths, add the hostname-specific configuration file, and complete setup at /wp. Keep the stack maintained with Debian updates and follow README.Debian whenever you change the package’s layout or behavior.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

Leave a Reply

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

Free tools Windows power users keep installed

One-click scans. No signup required.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

More from the Wire

  1. World desk4 min
    How to Spot an AI Voice Scam Before Sending MoneyDon’t rely on how a caller sounds. Pause, call back through a known number, and verify the emergency with another trusted person before sending money.
  2. Mountain View desk4 min
    Google’s SynthID Detector: How to Check AI-Generated Images, Video and AudioGoogle’s SynthID Detector looks for an embedded watermark in supported images, video and audio. Here is what its results do—and do not—show.
  3. Redmond desk20 min
    How to create a link to File or Folder in Windows 11Windows 11 gives you several ways to point to a file or folder without moving or duplicating it. You can create a desktop shortcut,…
Recommended PC Tool
Recommended PC Tool
Outdated Drivers Are Slowing You DownFree scan - exact matches
PC Slower Than It Used to Be?Free scan - under a minute

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.