This is a post in the series WordPress 101; see previous posts:
WordPress 101 – Things to Start with WordPress
In this article of the WordPress 101 series, I will guide you through the steps to install WordPress locally. Whether you use WordPress as a blog or website framework or if you develop WP themes and plugins, it is essential to know how to install WordPress on your computer. This enables you to test your site locally using a virtual server, eliminating the need to purchase a physical server for testing purposes.
Table of Contents
There are three ways to install WordPress locally on Mac and Windows: MAMP for Mac, WAMP for Windows, and XAMPP. You can choose the method that interests you, as the installation processes are similar. Today, I will briefly introduce how to install WordPress with XAMPP, which I use.
Installing WordPress locally
First of all, you have to download XAMPP from its official website. Then, install XAMPP on your computer. In installing XAMPP, you should choose the directory of XAMPP to the partition differently from the one containing the system file. Cos when the re-installation of your operating system is requested, you do not have to back up the XAMPP files. After installing XAMPP successfully, open the XAMPP application (name “manager-osx” on OSX) and start running the Apache web server and MySQL.
The Apache web server and MySQL database run locally on your computer. Now, you need to download WordPress to your computer>> put it in htdocs folder of XAMPP>> rename wp-config-sample.php file to wp-config.php >> open wp-config.php, and edit following value:
- DB_NAME (name of your database for this site)
- DB_USER (MySQL username)
- DB_PASSWORD (MySQL password)
- WP_DEBUG (set it true if you want to echo error out to frontend – default is false)
Then, open your browser and go to localhost/phpmyadmin to create a database for the website:
And here is my wp-config.php file:
Now you can go to localhost/wordpress_test (name of the folder you put your WordPress in) to start setting up your site
Choosing a language for your WordPress site.
Provide the required information for your website and click “Install WordPress” to set up the WordPress site on your computer for local use.
Install Multisite WordPress
To create Multisite WordPress, you need to edit wp-config.php. You can follow detail official instruction from here.
Download plugin directly
If your Linux-based computer requires your FTP username and password for plugin installation, simply add these lines to your wp-config.php file to avoid downloading the plugin.
/**Allow direct download**/ define('FS_METHOD','direct');
Conclusion
There are various methods to run WordPress locally for development and testing purposes. XAMPP is a cross-platform and open-source tool that can be used in any operating system for free. It enables you to operate WordPress in a controlled environment before deploying it to your live website. Have you used XAMPP? Share your thoughts. In upcoming posts, we will explain how to easily and automatically deploy a ready site online.