December 2, 2026
Setting up WordPress locally for practice on Kali Linux
Hi everyone, it’s been a while since we last met, hasn’t it? This time, I’m going to share my experience setting up a WordPress lab for…

By Albertstive
2 min read
Hi everyone, it's been a while since we last met, hasn't it? This time, I'm going to share my experience setting up a WordPress lab for penetration testing on Kali Linux. This stems from my curiosity about how penetration testers go about searching for and finding their first CVEs. I've summarized the key points here to make it easier for all of you to follow along. Good luck!
PROCEDURES
Step 1: Update Your System
Enter this command into your Kali Linux terminal; this command will update the current system.
sudo apt update
sudo apt upgradesudo apt update
sudo apt upgradeStep 2: Install LAMP Stack
- Install Apache
sudo apt install apache2sudo apt install apache2- Run this command if you want it to run every time your Linux OS starts up.
sudo systemctl start apache2
sudo systemctl enable apache2sudo systemctl start apache2
sudo systemctl enable apache2- Install Mariadb
sudo apt install mariadb-serversudo apt install mariadb-server- Install PHP and its dependencies
sudo apt install php php-mysql php-curl php-gd php-mbstring php-xml php-xmlrpc php-soap php-intl php-zipsudo apt install php php-mysql php-curl php-gd php-mbstring php-xml php-xmlrpc php-soap php-intl php-zip- After installation, restart the Apache service:
sudo systemctl restart apache2sudo systemctl restart apache2Step 3: Create a Database for WordPress
There's no problem with the terminal commands; even if you install MariaDB, the Kali Linux terminal will still accept MySQL commands because the system supports them — it's 100% SAFE.
- Configure the database using the commands below in the order listed
sudo mysql -u root -p
CREATE DATABASE wordpress;
CREATE USER 'wordpressuser'@'localhost' IDENTIFIED BY 'password';
GRANT ALL PRIVILEGES ON wordpress.* TO 'wordpressuser'@'localhost';
FLUSH PRIVILEGES;
EXIT;sudo mysql -u root -p
CREATE DATABASE wordpress;
CREATE USER 'wordpressuser'@'localhost' IDENTIFIED BY 'password';
GRANT ALL PRIVILEGES ON wordpress.* TO 'wordpressuser'@'localhost';
FLUSH PRIVILEGES;
EXIT;Step 4: Download and Install WordPress
- Download WordPress and then extract it
cd /tmp
sudo wget https://wordpress.org/latest.tar.gz
tar -xzvf latest.tar.gz
sudo mv wordpress /var/www/html/cd /tmp
sudo wget https://wordpress.org/latest.tar.gz
tar -xzvf latest.tar.gz
sudo mv wordpress /var/www/html/- Set Permissions
sudo chown -R www-data:www-data /var/www/html/wordpress
sudo chmod -R 755 /var/www/html/wordpresssudo chown -R www-data:www-data /var/www/html/wordpress
sudo chmod -R 755 /var/www/html/wordpress- Configure WordPress:
cd /var/www/html/wordpress
sudo cp wp-config-sample.php wp-config.php
sudo nano wp-config.phpcd /var/www/html/wordpress
sudo cp wp-config-sample.php wp-config.php
sudo nano wp-config.php- Update the database details in the wp-config.php file:
define('DB_NAME', 'wordpress');
define('DB_USER', 'wordpressuser');
define('DB_PASSWORD', 'password');
## ADDITIONAL FEATURES FOR THE TESTING PLUGIN
define( 'WP_DEBUG', true );
define( 'WP_DEBUG_LOG', true );
define( 'AUTOMATIC_UPDATER_DISABLED', true );define('DB_NAME', 'wordpress');
define('DB_USER', 'wordpressuser');
define('DB_PASSWORD', 'password');
## ADDITIONAL FEATURES FOR THE TESTING PLUGIN
define( 'WP_DEBUG', true );
define( 'WP_DEBUG_LOG', true );
define( 'AUTOMATIC_UPDATER_DISABLED', true );Congratulations, the installation is complete.
Open your web browser and navigate to [http://localhost/wordpress](http://localhost/wordpress`) (replace localhost with your server's IP address if accessing remotely).
some additional settings
- Select the language you understand : )
- Then enter your credentials so you can log in later
- Then log in with your credentials
errors that sometimes occur
This error often occurs if the password you entered in the WordPress database does not match the configuration password in WP-config.php
The solution is to simply open the wp-config.php file — specifically, /var/www/html/wordpress/wp-config.php — and adjust it accordingly.
It's okay to follow in the footsteps of those who came before you — that's actually how science works.