How To Install Wordpress on Kali Linux

Published: December 1, 2025 (Updated: Dec 1, 2025)

Enjoying this content? Subscribe to the Channel!

Kali Linux Hacking Lab Setup: Installing WordPress Step-by-Step

Welcome back to Darren’s Tech Tutorials! If you’re following our Kali Linux series, you know we are building toward an exciting goal: learning how to ethically test and audit web applications.

This post marks the critical third step in our series. We are taking the Kali Linux virtual machine we previously set up and transforming it into a fully functional local development environment by installing WordPress. Why WordPress? Because it’s the most popular CMS in the world, and once we have it running, we’ll move on to the final video in the series: demonstrating how to ethically hack it!

Setting up WordPress on Kali requires installing a few key components (the classic LAMP stack), configuring the database, and pointing your web server in the right direction. Ready to build your local hacking lab? Let’s dive in!

Quick Tip: Need a handy reference for all your command-line work? Grab your free Linux Cheat Sheet right here: http://eepurl.com/dkRNM9


Series Prerequisites

If you haven’t yet set up your Kali Linux machine, you may want to check out the previous tutorials in this series:

  • How To Install Kali Linux On VMWare Workstation
  • How To Install VMWare Tools On Kali Linux

Step 1: Setting Up Your LAMP Stack Prerequisites

WordPress requires a web server, a database, and a scripting language to run. On Linux, this typically means Apache, MariaDB (a fork of MySQL), and PHP. While many of these are installed by default on Kali, it’s best practice to ensure you have the required packages.

Open your Kali terminal and run the following commands:

# Install the Apache Web Server
sudo apt-get install apache2

# Install PHP (scripting language)
sudo apt-get install php

# Install MariaDB (Database Server)
sudo apt-get install mariadb-server

# Install MariaDB Client
sudo apt-get install mariadb-client

Step 2: Starting Core Services

Before we can use our web server or database, we need to ensure the services are running in the background.

# Start Apache
sudo service apache2 start

# Start MariaDB
sudo service mariadb start

Step 3: Creating the WordPress Database

Next, we need to create a dedicated database and a user account that WordPress can use to store its information. We’ll log into the MariaDB environment using the root user (which, by default on Kali, has no password).

  1. Log into MariaDB:

    mysql -u root -p
    

    (When prompted for a password, just hit Enter.)

  2. Run the Database Commands: Once inside the MariaDB prompt, execute the following commands. These create the database and then grant a user named ‘darren’ full permissions on that database.

    (Note: While ‘password123’ is used here for a local test environment, always use strong, complex passwords on production or external systems.)

    -- 1. Create the database named 'wordpress'
    create database wordpress;
    
    -- 2. Optional: Check if the database was created
    show databases;
    
    -- 3. Grant privileges to a new user
    grant all on wordpress.* to 'darren'@'localhost' identified by 'password123';
    

    Type exit; to leave the MariaDB shell.

Step 4: Downloading and Preparing WordPress Files

Now that the foundation is ready, we need the actual WordPress software.

  1. Download WordPress: If you haven’t already, navigate to wordpress.org/download in your Kali browser and download the latest .tar.gz file. It will usually land in your ~/Downloads folder.

  2. Move the File: Apache serves web files from the /var/www/html directory. We need to move the compressed WordPress file there.

    # Navigate to your Downloads folder
    cd ~/Downloads
    
    # Move the file to the Apache web directory
    sudo mv wordpress-4.8.tar.gz /var/www/html
    

    (Note: The file version in the video was 4.8; ensure you use the name of the file you actually downloaded.)

  3. Extract the Files: Navigate to the HTML directory and extract the WordPress files. This will create a new directory named wordpress.

    cd /var/www/html
    
    # Extract the tarball
    sudo tar -zxvf wordpress-4.8.tar.gz
    

Step 5: Configuring Apache for WordPress

By default, Apache looks for index files (like index.html) in the root of the /var/www/html directory. Since our WordPress files are inside a new /wordpress subdirectory, we need to tell Apache where to look.

We will edit the default site configuration file.

  1. Edit the Configuration File:

    cd /etc/apache2/sites-available
    sudo vi 000-default.conf
    

    (If you are not comfortable with vi, you can substitute another editor like nano or leafpad.)

  2. Adjust the Document Root: Look for the line that says DocumentRoot /var/www/html. We need to change this line to point to the WordPress subdirectory:

    DocumentRoot /var/www/html/wordpress
    

    In vi, press i to enter insert mode, make the edit, press Esc, then type :wq! to save and quit.

  3. Restart Apache: Apply the new configuration by restarting the web service.

    sudo service apache2 restart
    

Step 6: Completing the Web Installation

It’s time for the famous 5-minute install!

  1. Navigate to Localhost: Open your Kali web browser (Firefox) and navigate to:

    http://localhost/
    
  2. Enter Database Details: Click “Let’s Go!” and enter the credentials you defined in Step 3:

    Setting Value
    Database Name wordpress
    Username darren
    Password password123
    Database Host localhost
    Table Prefix wp_ (default)
  3. Handle the wp-config.php Error (Critical Step): When you click Submit, WordPress may say it cannot create the wp-config.php file (due to file permission restrictions on Kali). This is normal.

    • When the error appears, copy all the displayed text (this is the content of the config file).
    • Open a simple text editor (like Leafpad) in Kali.
    • Paste the copied text.
    • Save the file as wp-config.php inside the /var/www/html/wordpress directory.
  4. Final Setup: Once the file is saved, go back to the browser and click “Run the Install.”

    • Choose a Site Title (e.g., “Test Hacking Site”).
    • Choose an administrative username and password (e.g., username Darren, password password123).
    • Provide an email address and click Install WordPress.

Congratulations! You have successfully installed WordPress on your Kali Linux local environment.

Conclusion and What’s Next

You’ve done the hard work of setting up a complete, local web server environment on Kali Linux. This setup is perfect for testing configurations, developing locally, and, most importantly, practicing your ethical hacking skills without affecting a live site.

The lab is ready! In the final video of this series, we will put this new WordPress installation to the test and dive into the exciting world of ethical hacking using Kali Linux tools.

If you found this tutorial helpful, hit the Like button and subscribe to Darren’s Tech Tutorials for more accessible and practical guides. If you ran into any issues, drop a comment below—I’m happy to help!

See you in the next one!

P.S. Don’t forget to download your Free Linux Command Cheat Sheet: http://eepurl.com/dkRNM9