You need a PHP-based development environment to install WordPress. Commercial hosting packages already have PHP, MySQL, Apache, and everything you need to install & build a WordPress website. But most computers don’t have a built-in development environment, especially windows computers. So you have to install & configure the development environment before you install WordPress in localhost.
There are a few free and paid software you can choose from to create the development environment on your computer. Wamp Server, XAMPP, MAMP, Local by Flywheel are a few of them. You can choose any one of them. In this post, I will show you the XAMPP installation process quickly. But if you want to see the installation process for other software, please let me know in the comment.
How to Install XAMPP on Your Computer
Go ahead and download the software. It works on Windows, Linux & OS X. The installation process is similar to any other software. Just follow its directions and click next & next. There is no rocket science. Once the installation is completed, you will find a folder called “xampp“. Double click on it and look for another folder called “htdocs” inside the “xampp” folder. And the “htdocs” folder is your playground.
How to Install WordPress in Your Computer
You have installed Xampp on your computer successfully. Now the first step is to open the “Xampp Control Panel”. Find & open the application you have installed just a moment ago. Click the first two ‘start’ buttons under the “Actions” tab. This will start/run Apache & MySQL. Please refer to the below screenshot for more clarifications.
Make sure that you started both the Apache & MySQL and both shows a green background like the below screenshot:
Now go to the “htdocs” folder and create a new folder to install WordPress. In this example- I will create a folder called “test” and install WordPress in this “test” folder. So the project URL will be “http://localhost/test“.
WordPress System Files
Now download WordPress into your project folder. You will get a Zip file and you have to extract it. Once you extracted it, you will get all the system files within the “wordpress” folder. Select all the files & folders and move them to the “test” directory/folder. The “test” folder will look like the below screenshot:
One last step before we install WordPress.
Go to localhost in your web browser or copy & paste the following link to your browser: http://localhost/dashboard/ and click on “phpMyAdmin”.
And click on Database to create a new one. You can name it whatever you like. In this example, I will name it- “my_database_for_test” and choose “collation” from the dropdown. Hit the button “Create”. See the below screenshot:
Now we are ready to install WordPress on localhost. Go to your web browser and hit the link: “http://localhost/test/” and it will prompt you to a WordPress installation process. In the first window of installation, choose your preferred language and hit next. The second/final step will ask you database name, username, password, etc. It’s important to provide the correct ‘Database Name” & in my case, it’s “my_database_for_test”, the username is “root” and the password is blank/nothing. And leave other options as they are. See screenshot below:
If your information is correct, you will see a greeting “All right, sparky!…” & just hit the button called “Run the installation”.
On the next window, choose your website title, username, password, email, etc. Don’t worry, you will be able to change that information later (except the username). Don’t forget to note down the username & password because you need them to log in to your website. Once you are done, hit the “Install WordPress” button. And Boom! You successfully installed WordPress on your localhost/computer.
Now you can log in to your website and customize it as you want.
What Is the Purpose of Installing WordPress in Localhost
The main purpose of localhost is to work locally. Here locally means within/only-in your computer. By using localhost, you don’t have to buy a domain and hosting until it’s required. You can experiment with your file system within a very short time. You don’t need to login into your live hosting account to edit a file.
Another great advantage of localhost is Git. Especially if you are a programmer and write code for your websites, then localhost is a piece of cake. You can build your website day by day, save your progress and push your code to a Git Repository e.g: GitHub, Bitbucket, etc.
If you are wondering how to migrate your finished website to a live host or a live URL, keep reading.
How to Migrate Website From Localhost to Livehost (Live URL)
There are a few different ways you can migrate your WordPress website from localhost to a live server. This post will show you the easiest way to transfer your website using the “All in One WP Migration” plugin.
Install & activate the plugin to your localhost. Go to the plugin menu, navigate to Export » File. It will generate a complete backup of your WordPress website and give you a downloadable file in “wpress” format. Download the backup file.
Now login to your live website, install & activate the same plugin. But this time around, navigate to “Import” and upload your downloaded file. It will take some time depending on the file size. Once it’s uploaded, follow the instruction and hit next/proceed/finish. You are done!
Keep in mind, you will not be able to log in to your live website with your old login credentials. Use the login username & password as per your localhost website login credentials. But once you are logged in, go to “Permalinks” and hit save two times. It will generate/re-generate a new “HTACCESS” file.
Now you know how to create localhost on your computer, install XAMPP, WordPress in localhost, and migrate your finished website from localhost to live host/URL. Please let me know if this post helped you.
If you have any questions, feel free to contact me.