Installing WordPress on a Linux computer using XAMPP provides a local environment where you can develop and test a website without publishing it to a live server.
This guide covers installing XAMPP, creating a WordPress database, configuring the required permissions, and completing the WordPress installation through your web browser.
To install WordPress on a Linux computer using XAMPP (the standard web server stack containing Apache, MariaDB/MySQL, and PHP), follow these steps:
Apache and NGINX are the two industry-standard web servers powering the modern web—Apache relies on a thread-based architecture with flexible .htaccess rules, while NGINX uses an event-driven model optimized for high concurrency. Understanding these web servers is essential, as both serve as the foundational middleware that connects client requests to PHP and database-driven platforms like WordPress.
WordPress is the world’s most popular open-source content management system, powering everything from simple personal blogs to complex enterprise websites. Its flexible ecosystem of themes and plugins allows anyone to build, customize, and manage a site without writing code.
Download and Install XAMPP
Download the Linux installer (.run file) from the official Apache Friends website. Open your terminal, navigate to your downloads directory, make the installer executable, and run it:
cd ~/Downloads
chmod +x xampp-linux-x64-8.2.12-0-installer.run
sudo ./xampp-linux-x64-8.2.12-0-installer.run
Follow the graphical installer prompts. By default, XAMPP installs to /opt/lampp.
Start XAMPP Services
Start the Apache web server and MySQL database server using the command line:
sudo /opt/lampp/lampp start
Then run the following commands:
sudo apt update
sudo apt install net-tools
sudo /opt/lampp/lampp restart
To verify both services are active, open your browser and navigate to http://localhost. You should see the XAMPP welcome page.
Create a MySQL Database for WordPress
Open your browser and go to http://localhost/phpmyadmin.
Click on the Databases tab in the top menu.
Enter a database name (for example, localsitedb) in the Create database field.
Leave the collation as default and click Create.
Download and Extract WordPress
Download the latest WordPress package, extract it into the XAMPP web root folder (/opt/lampp/htdocs), and rename the folder to your preferred site name:
cd /tmp
wget https://wordpress.org/latest.tar.gz
tar -xvzf latest.tar.gz
sudo mv wordpress /opt/lampp/htdocs/localsite
Configure Folder Permissions
Grant web server permissions to the WordPress directory so Apache can upload files and write configuration updates:
cd ~
sudo chown -R daemon:daemon /opt/lampp/htdocs/localsite
sudo chmod -R 755 /opt/lampp/htdocs/localsite
Run the WordPress Web Installer
Open your browser and go to http://localhost/localsite.
Select your preferred language and click Continue.
Click Let's go! on the welcome screen.
Fill in your database configuration details:
Database Name: localsitedb (the database name created in Step 3)
Username: root
Password: Leave blank (XAMPP's default MySQL root password is empty)
Database Host: localhost
Table Prefix: wp_
Click Submit, then Run the installation.
Complete the site title, admin username, password, and email address fields, then click Install WordPress.
Launch the XAMPP Manager
To launch the XAMPP manager, run:
sudo /opt/lampp/manager-linux-x64.run
WordPress on Localhost Is Ready
And now, your local WordPress environment is ready! Use it to test plugins, experiment with designs, and refine your site risk-free.
Once you're fully satisfied with your local setup, you'll be ready to migrate to a live web server and launch your site to the world.
With WordPress running locally through XAMPP, you can safely work on your website before moving it to a live server.
This local environment gives you a practical place to test plugins, experiment with designs, and refine your site risk-free.
.webp)