
WordPress is a massive content management system used by millions of websites worldwide. If you’re on Debian 12 and want to install WordPress, this guide will walk you through it in a step-by-step, beginner-friendly way.
Whether you’re a developer or a small business owner, this will help you install WordPress on Debian 12 in no time.
- Requirements
- Step 1: Update and Upgrade Your Server
- Step 2: Install Apache Web Server
- Step 3: Install PHP
- Step 4: Install MySQL and Create a Database
- Step 5: Download WordPress
- Step 6: Configure Apache
- Step 7: Configure WordPress
- Step 8: Secure Your WordPress Installation
- FAQs – Install WordPress on Debian 12
- Conclusion
Requirements
Before you begin, ensure you have the following:
- A Debian 12 Server: Ensure your server is running the latest version of Debian 12 with SSH access.
- Domain Name and DNS Settings: Have a domain pointed to your server’s IP address.
- LAMP Stack Installed: Install Linux, Apache, MySQL/MariaDB, and PHP (referred to as the LAMP stack).
- Root or Sudo User Access: Access to a user with sudo privileges for executing administrative tasks.
Step 1: Update and Upgrade Your Server
- Always start by ensuring your system is up-to-date. Run the following commands:
sudo apt update && sudo apt upgrade -y
This will update the package list and upgrade the installed packages.
Step 2: Install Apache Web Server
- Apache is one of the most popular web servers for hosting WordPress. To install it, type:
sudo apt install apache2 -y
- Enable and start the Apache service:
sudo systemctl enable apache2
sudo systemctl start apache2
- Check if Apache is running by visiting your server’s IP address in a web browser. You should see the default Apache welcome page.
Step 3: Install PHP
- WordPress requires PHP to function. Install PHP and necessary extensions:
sudo apt install php php-mysql libapache2-mod-php php-cli php-curl php-xml php-mbstring -y
- Verify the PHP installation:
php -v
This will display the PHP version.
Step 4: Install MySQL and Create a Database
- WordPress needs a database to store its content. Install MySQL server:
sudo apt install mysql-server -y
- Secure the MySQL installation by running:
sudo mysql_secure_installation
During the process, set a root password and follow the prompts to improve security.
- Log in to MySQL:
sudo mysql -u root -p
- Create a database and user for WordPress:
CREATE DATABASE wordpress;
CREATE USER 'wpuser'@'localhost' IDENTIFIED BY 'yourpassword';
GRANT ALL PRIVILEGES ON wordpress.* TO 'wpuser'@'localhost';
FLUSH PRIVILEGES;
Step 5: Download WordPress
- Navigate to your web server’s root directory:
cd /var/www/html
- Download the latest WordPress package:
wget https://wordpress.org/latest.tar.gz
- Extract the archive:
tar -xvzf latest.tar.gz
- Move the WordPress files to the root directory:
sudo mv wordpress/* /var/www/html/
- Set proper permissions:
sudo chown -R www-data:www-data /var/www/html
sudo chmod -R 755 /var/www/html
Step 6: Configure Apache
- Create a virtual host file for WordPress:
sudo nano /etc/apache2/sites-available/wordpress.conf
- Add the following configuration:
<VirtualHost *:80>
ServerName yourdomain.com
DocumentRoot /var/www/html
<Directory /var/www/html>
AllowOverride All
</Directory>
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
- Enable the virtual host and Apache rewrite module:
sudo a2ensite wordpress.conf
sudo a2enmod rewrite
- Restart Apache:
sudo systemctl restart apache2
Step 7: Configure WordPress
Visit your domain in a web browser. You’ll be greeted by the WordPress setup wizard.
- Select your language.
- Enter your database details:
- Database Name: wordpress
- Username: wpuser
- Password: yourpassword
- Click Submit and then Run the Installation.
Provide site details like your website title, admin username, and password. Once complete, log in to your WordPress admin panel.
Step 8: Secure Your WordPress Installation
Use HTTPS
- Install and configure an SSL certificate with Let’s Encrypt:
sudo apt install certbot python3-certbot-apache -y
sudo certbot --apache
- Update Plugins and Themes Regularly
Keep WordPress, plugins, and themes updated.
- Install a Security Plugin
Consider plugins like Wordfence or iThemes Security for added protection.
FAQs – Install WordPress on Debian 12
Can I install WordPress on Debian 12 without a LAMP stack?
No, WordPress requires a LAMP stack or similar setup to run. You need Linux, Apache/Nginx, MySQL/MariaDB, and PHP.
How do I secure my WordPress installation on Debian 12?
Use HTTPS with an SSL certificate, regularly update plugins and themes, and install security plugins like Wordfence.
What PHP version is recommended for WordPress on Debian 12?
WordPress recommends PHP 7.4 or higher for optimal performance and security.
Do I need a domain to install WordPress on Debian 12?
While not mandatory for testing, a domain is essential for live websites. Configure DNS settings to point to your server.
Can I install WordPress on a shared Debian 12 server?
Yes, but ensure your hosting provider supports the required server configurations (LAMP stack, PHP, MySQL).
Conclusion
To Install WordPress on Debian 12 is straightforward if you follow these steps. From setting up a LAMP stack to securing your site, this guide has got you covered. By choosing to install WordPress on Debian 12, you’re leveraging a stable and powerful platform for your online presence.
If you have questions or run into issues during installation, comment below. Happy WordPressing!

Leave a Reply