Installing WordPress on Debian 12 utilizing Apache, MariaDB, and PHP8.3 (LAMP setup) Tutorial
In this guide, we'll walk you through the steps to set up and optimize a WordPress site on a Debian 12 server using Apache, MariaDB, and PHP 8.3. This LAMP stack provides a secure, stable, and high-performing environment for your WordPress site.
Preparing the System
- Update your Debian 12 system:
- Install required tools for managing the server.
Installing Apache Web Server
Confirm Apache is running by visiting your server's IP or domain.
Installing MariaDB Database Server
Secure MariaDB installation:
Follow prompts to set the root password and secure the database.
Installing PHP 8.3 and Required Extensions
Debian 12 supports PHP 8.3. Install PHP along with necessary modules for WordPress:
Restart Apache to apply PHP:
Creating a MariaDB Database and User for WordPress
Log into MariaDB shell:
Execute commands replacing , , and with your values:
Downloading and Configuring WordPress
- Download latest WordPress:
- Set ownership and permissions:
- Create Apache Virtual Host (optional for domain-based setup) in with proper ServerName and DocumentRoot.
Enabling Apache Rewrite Module
WordPress uses pretty URLs that require mod_rewrite:
Ensure directives are allowed by setting in Apache config for your WordPress directory.
Completing WordPress Installation via Web Browser
Navigate to or your domain and complete the setup wizard by providing database details created earlier.
Optimizing the WordPress Site
- Install caching plugins (e.g., WP Super Cache or W3 Total Cache).
- Enable OPcache in PHP for performance:
Add or ensure in :
- Secure your installation by hardening file permissions, disabling XML-RPC if not needed, and setting proper rules.
- Regularly update WordPress core, themes, and plugins.
- Use HTTPS by installing and configuring SSL with Certbot (Let's Encrypt).
Verifying PHP and Extensions
Create a in with:
```php
```
Access to confirm PHP 8.3 and required extensions (curl, gd, mbstring, xml, etc.) are active.
These steps ensure a secure, stable, and optimized WordPress environment on Debian 12 with Apache, MariaDB, and PHP 8.3. Happy blogging!
The guide also provides instructions on how to optimize the WordPress site for better performance. This includes installing caching plugins and enabling OPcache in PHP.
Additionally, the guide recommends securing the WordPress installation by hardening file permissions, disabling XML-RPC if not needed, and setting proper rules. It also advises regularly updating WordPress core, themes, and plugins, and using HTTPS by installing and configuring SSL with Certbot (Let's Encrypt). These technologies help ensure a secure and high-performing environment for your WordPress site.