As you already know, you need a hosting service and domain name to install WordPress and set up a website. However, before going live, you may have to test your site to see how it is working. For this, there is an option to install WordPress on your computer with a localhost.
Why install WordPress locally?
Installing WordPress locally on your computer means it will be visible only to you. Public would not be able to see that site unless you upload it to a hosting server. Then, why do you have to install it on your computer? Because it is actually a great way to test the appearance and functionalities of your site. A lot of developers and site owners make use of this option to test new features and behaviors before going live. So, as a beginner, installing WordPress on your computer will provide you with a great chance to familiarize yourself with WordPress and its many facets.
XAMPP is a simple tool that will help you set up a local web server for testing purposes. It is actually quite easy to work with, and it is available across platforms such as Windows, Mac or Linux. And more importantly, as XAMPP uses similar components that are used by popular web hosting servers, it is relatively easier to move your test site to a live server.
1. Installing XAMPP
You need to visit the XAMPP website (https://www.apachefriends.org/), and click the download button specific to your operating system. We are using Windows, so will choose the first button.
Once the download is complete, you can start the installation wizard. On the last stage of installation, you can tick the checkbox to launch the XAMPP control panel right after installation.
Start Apache and MySQL
Once you click Finish, the XAMPP Control Panel will open up. On the XAMPP control Panel, you can see a few buttons (Start, Config, Logs, etc.). Click the Start buttons next to Apache and MySQL. When Apache and MySQL starts running, you will see a green highlighter over these two modules on the control panel. That means you are ready to install WordPress on your computer.
2. Create a database
You need to create a database for your site. You can see the Admin button is enabled for both Apache and MySQL. Click the Admin button of MySQL to go to phpMyAdmin. Alternatively, you can open your browser and go to localhost/phpmyadmin. On phpMyAdmin, you will see a menu for Databases. Click Databases, and on the next screen, you can enter a name for your database. Then click the Create button. For this example, we are choosing the database name as ‘db_wp’.
3. Downloading and setting up WordPress
Go to the WordPress website (https://wordpress.org/) and download WordPress.
Upload WordPress to XAMPP
Now, the downloaded file will be in a zip folder. You will have to extract it, and copy the WordPress folder.
Paste the copied WordPress folder inside XAMPP/htdocs folder on your C: drive – OS (C:) >XAMPP > htdocs.
4. Connecting WordPress and XAMPP
Now, open localhost/wordpress on your browser. You will see a screen that informs you about the requirements for the next step. Click Let’s Go! And you will find a screen where you can enter the database information.
You need to enter the Database Name (in our example, the database name is kept as ‘db_wp’), Username (as ‘root’) and Database Host (as ‘localhost’). Password field can be left empty and the Table Prefix can be left as it is. Click Submit after entering all the required information.
5. Installing WordPress on the local server
In the next step, WordPress will ask you for more information regarding your website. This is different from the database information that you have entered in the previous step. Enter Site Title, Username, Password, and Email address. Then click Install WordPress.
WordPress will be installed on your computer. You will see a screen like below
You can click the Log in button.
Enter your username and password and login to the website