Installing WordPress on Debian 10/11 is a straightforward process. Follow the steps below to get started:
- Update the System
First, ensure that your system is up to date by running the following commands:
sudo apt update
sudo apt upgrade
- Install LAMP Stack
The LAMP stack includes Apache, MySQL, and PHP, which are required to run WordPress. Run the following command to install the LAMP stack:
sudo apt install apache2 mysql-server php php-mysql libapache2-mod-php
- Configure MySQL
Next, configure MySQL by running the following command:
sudo mysql_secure_installation
This command will prompt you to set a root password, remove anonymous users, and disallow root login remotely.
- Create a MySQL Database
Create a new MySQL database for WordPress by running the following commands:
sudo mysql -u root -p
Enter your MySQL root password when prompted, then run the following commands to create a new database:
CREATE DATABASE wordpress;
GRANT ALL PRIVILEGES ON wordpress.* TO 'wordpressuser'@'localhost' IDENTIFIED BY 'password';
FLUSH PRIVILEGES;
EXIT;
Note: Replace “password” with a strong password.
- Download and Install WordPress
Download and extract the latest version of WordPress using the following commands:
cd /tmp
wget https://wordpress.org/latest.tar.gz
tar xf latest.tar.gz
Move the WordPress files to the Apache web server’s document root directory using the following command:
sudo mv /tmp/wordpress/* /var/www/html/
- Configure WordPress
Copy the WordPress configuration file by running the following command:
sudo cp /var/www/html/wp-config-sample.php /var/www/html/wp-config.php
Open the wp-config.php
file using the following command:
sudo nano /var/www/html/wp-config.php
Enter the following database details in the wp-config.php file:
define('DB_NAME', 'wordpress');
define('DB_USER', 'wordpressuser');
define('DB_PASSWORD', 'password');
define('DB_HOST', 'localhost');
Save and close the file.
- Set File Permissions
Set the correct file permissions on the WordPress installation directory using the following commands:
sudo chown -R www-data: /var/www/html/
sudo chmod -R 755 /var/www/html/
- Complete Installation
Restart Apache web server using the following command:
sudo systemctl restart apache2
Finally, open your web browser and navigate to http://your-server-ip/ or http://your-domain-name/ to complete the WordPress installation process.
That’s it! You have successfully installed WordPress on Debian 10/11.