How to install WordPress on Debian 13 Trixie

We are using the LAMP stack (Apache, MariaDB/MySQL, PHP) on a fresh Debian 13 server with sudo privileges.


1. Update your system

sudo apt update && sudo apt upgrade -y

2. Install Apache

sudo apt install apache2 -y
sudo systemctl enable --now apache2

Check if it is started well:

systemctl status apache2

3. Install MariaDB (MySQL)

MariaDB is the default alternative to MySQL on Debian.

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

Secure the database:

sudo mariadb_secure_installation

Choose these important options:

  • Set root password: Y
  • Remove anonymous users: Y
  • Disallow remote root login: Y
  • Remove test database: Y
  • Reload privileges: Y

4. Create a WordPress database and user

Enter MariaDB:

sudo mysql -u root -p

Inside MariaDB:

CREATE DATABASE wordpress DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;

CREATE USER 'wpuser'@'localhost' IDENTIFIED BY 'StrongPasswordHere';

GRANT ALL PRIVILEGES ON wordpress.* TO 'wpuser'@'localhost';

FLUSH PRIVILEGES;
EXIT;

5. Install PHP + required extensions

Debian 13 includes PHP 8.2 by default.

sudo apt install php php-mysql php-xml php-gd php-curl php-zip php-mbstring php-imagick php-intl php-soap -y

Restart Apache:

sudo systemctl restart apache2

6. Download and set up WordPress

Go to /var/www/:

cd /var/www/
sudo wget https://wordpress.org/latest.tar.gz
sudo tar -xvf latest.tar.gz
sudo rm latest.tar.gz

Set proper permissions:

sudo chown -R www-data:www-data /var/www/wordpress
sudo chmod -R 755 /var/www/wordpress

7. Configure WordPress

Copy sample configuration:

cd /var/www/wordpress
sudo cp wp-config-sample.php wp-config.php

Edit configuration:

sudo nano wp-config.php

Insert your correct DB settings:

define( 'DB_NAME', 'wordpress' );
define( 'DB_USER', 'wpuser' );
define( 'DB_PASSWORD', 'StrongPasswordHere' );
define( 'DB_HOST', 'localhost' );


8. Configure Apache Virtual Host

Create a vhost file:

sudo nano /etc/apache2/sites-available/wordpress.conf

Paste:

<VirtualHost *:80>
    ServerName your-domain.com
    DocumentRoot /var/www/wordpress

    <Directory /var/www/wordpress>
        AllowOverride All
        Require all granted
    </Directory>

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

Enable configuration:

sudo a2ensite wordpress.conf
sudo a2enmod rewrite
sudo systemctl restart apache2

9. Secure with HTTPS (optional but recommended)

Install Certbot:

sudo apt install certbot python3-certbot-apache -y
sudo certbot --apache

10. Finish installation in browser

Open your Blog:

http://your-domain.com

or if using an IP:

http://YOUR_SERVER_IP

Follow the on-screen WordPress setup (site title, admin user, password, etc.)


Comments

Leave a Reply

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