WordPress is a content management system for website. It will be nothing unless you make it appear on the internet. However, there are some situations where you want to run WordPress locally on your machine. Probably, you are just getting started to learn how to develop a WordPress theme. Or, you want to have an in-deep learn of how actually WordPress works.
There are three required programs need to install on your computer to install WordPress locally. They are a web server, database server and PHP interpreter. You can install them individually. Alternatively, you can also install an application called XAMPP. XAMPP is a bundled application consisting of Apache (web server), MySQL (database server), Perl and PHP. If you are a Windows user I suggest you to install XAMPP, but keep in mind to turn the Internet Information Service off before running the Apache daemon through XAMPP to avoid conflict. Internet Information Service is a web server developed by Microsoft and in some Windows laptops this service is enabled by default.
I use Linux in this example and all of the required programs are installed individually. But don’t worry, no matter the operating system you use, the method to install WordPress locally is still the same.
In order to makes it easy for you to create a new database, I also suggest you to install PhpMyadmin. It’s GUI-based tool to manage database. You can use this tool to create MySQL database.
Creating a database
WordPress needs a database to work. The first thing you need to do before installing WordPress is by preparing a database to use by WordPress. In this example, I am going to create a database named “wordpress”.
Start installing WordPress
- First and foremost, download the WordPress package on its official site (wordpress.org)
- Copy the WordPress package to the root directory of your web server. If you use XAMPP, you can copy the package to the “htdocs” directory. Or, if you are a Linux user and install Apache individually, you can copy the package to the “html” directory which is located under the “/var/www/” directory.
- Unzip the package and you should see a new directory named “wordpress”
- Launch your web browser and type “localhost/wordpress” on the address bar.
- On the fist installation page, WordPress will tell you that it needs some information regarding the database. WordPress needs the information to create a
wp-config.phpfile. Just click the Let’s go! button to continue.
- On the next page, you will be asked to enter your database connection details. On the Database Name section, enter the name of database you have just created on the first step above. Once you done entering, click the Submit button.
- After you clicking the Submit button, WordPress will create the
wp-config.phpfile. In some case, WordPress is unable to create this file. But don’t worry, you can create this file manually by yourself. WordPress will provide the code you have to enter to the file. Put this file under the “wordpress” directory. Once you done creating this file, click the Run the installation button.
- Enter your site title, username, password and the administrator email and click the Install WordPress button.
You can now access to your local WordPress by typing “localhost/wordpress” on the address bar of your browser. To login to the dashboard you can type “localhost/wordpress/wp-login.php”.