How to install WordPress on localhost?

Overview

There are multiple ways to set up a WordPress development environment and automate the repeating tasks which will save you a lot of time and effort in the long run. For example, to set up a WordPress site typically the below steps have to be performed:

  • Download the WordPress files.
  • Extract and copy it to the server.
  • Access PHPMyAdmin and create a new database with proper user privilege.
  • Rename wp-config-sample.php to wp-config.php and add the database info.
  • Finally, go through the installing process of the WordPress site.

In this section, we will learn to install a WordPress site on your local computer using Bitnami WordPress. This method does not require you to follow the traditional steps mentioned above instead we can get the WordPress site up and running in just a few clicks or with a single command line.

There are more ways to automate everything like using Grunt etc, but for now, we will just use this simple and effective approach which is easy to learn and it makes your work less repetitive to set up WordPress sites for your new projects.

What is a localhost?

Localhost is usually referred to a computer on which you can install a web server like XAMP, WAMP, Local by Flywheel or many another server modules available on the internet to run a website on a local IP that is visible only to you.

Here are a few reasons to consider developing your site on a local machine first:

  • Faster development: Website development requires going back and forth. Adding or deleting the content can be time-consuming on a live server. Saving your changes and viewing them is much faster on a local system.
  • Risk-free website testing: Every time a new plugin or a custom code is installed on your WordPress site, you risk crashing the entire web site if the plugin or the code is not compatible. A local host is a good place to test the functionality of a plugin or custom code Avoid the risk of crashing the live site for everyone. If a localhost site crash, it is only for you and it is easy to restore the localhost site by removing the code or deleting the plugin folder.
  • Risk-free content update: Many of us have faced this situation where you finished typing a long email or a post and you press the “Submit” button only to see an ugly error message “Page cannot be displayed” and you lose all the unsaved content when you hit that back button. Your local host site does not require internet to save change hence chances of losing the data because of poor internet connection is highly unlikely.
  • It is completely free: Normally, for a website to function you need a domain name and hosting server. No need to buy a domain name or hosting space to work locally. It is completely free to install and run the localhost server on your computer.
  • Easy to set up and migrate: You can churn up a working WordPress website in just a few clicks. If you are happy with the way your site looks on your local system it is easy to migrate the entire site to a live server.

Limitations:

  • Only you can view the site and it is not easy to share or grant access to other developers. (Local by Flywheel has a workaround for this by providing a link to share with other users on the internet).
  • Limited support for WordPress multisite development.
  • Sometimes the live server environment may be different from the localhost server.
  • Emails do not work out of the box until you Configure SMTP for outbound emails.

How to install a localhost server?

Things you should know before installing:

  • The server automatically starts when you log in to your computer.
  • Your WordPress files can be located in “bitnami-application\apps\SITE-NAME”.
  •  Multiple WordPress sites can be installed using the Bitnami WordPress stack module.
  • When you download and run the Bitnami installer change the default application folder path from “C:\Bitnami\wordpress-VERSION” to “D:\ANY-FOLDER”. I personally prefer to install the application in any other driver than the one that contains the operating system this way if anything happens to the operating system and if I have to format the Drive C: my project folders in D: Drive will be unaffected.
  • Setup automatic backup for your project files and folder by using the Google Backup and Sync program.

OK! Let’s get started and install the program:

  • Download Bitnami WordPress.
  • Double click the installer and follow the step by step on-screen instructions to complete the installation.
  • During the installation process, the setup will ask you to enter the site name, email, username and password. Note : Passwords for phpMyAdmin and MySQL will be the same.

NOTE: Bitnami automatically creates a database with the same name as the site name you provide during the installation and links it to your WordPress site.

For detailed instructions with pictures of the entire installation process please check the Bitnami Documentation.

How to install a WordPress site on your localhost?

The steps involved in creating a separate WordPress site on the localhost depends on which program you are using. If you are using XAMP then you have to follow the traditions steps mentioned in the very beginning of this post.

In order to avoid the painful and repeating steps of manually creating the database and linking it in the wp-config.php file we chose a more modern yet simple approach and went ahead with Bitnami. By default, Bitnami will install one instance of WordPress when you run the installer. To add more WordPress sites with a separate database go ahead and

  • Download the Bitnami WordPress Stack Module.
  • Just to make typing the file name a bit easier in the command prompt. Rename the downloaded file name from “bitnami-wordpress-VERSION-module-windows-x64-installer.exe” to  “installer.exe” and place it in C: Drive.
  • Open the list of programs installed on your computer and click on “Use Bitnami WordPress Stack” this should open the command prompt for you.
  • Copy and paste the below line in the command prompt and hit the enter key.
    C:installer.exe --wordpress_instance_name NEW_BLOG_NAME
    
  • The installer will open, follow the onscreen instructions to go ahead and install a separate WordPress site. If everything goes fine you should see the new site in “bitnami-application\apps\SITE-NAME” Next let’s see how to access the newly installed site 🙂

How to access your website frontend on localhost?

After successfully installing the WordPress site it’s now time to access the frontend to see how things look. If you have installed the Bitnami WordPress then the server will automatically start when the computer starts.  Open your favourite web browser and type the address http://ocalhost/YOUR_SITE_NAME in the address bar. Make sure to replace “YOUR_SITE_NAME” with the website name you provided during the installation process.

How to access WordPress admin area?

Let the fun begin!! We can login to the WordPress admin area and change the way our web site looks. To access the WordPress admin area keep your credentials handy and type the address http://localhost/YOUR_SITE_NAME/wp-admin in the address bar of your favourite web browser. Make sure to replace “YOUR_SITE_NAME” with the website name you provided during the installation process.

How to access phpMyadmin?

When you add any content to your sites such as a post, page, images etc, or change any settings it is stored in the database. Not to be confused with the enfold theme files which you download from ThemeForest and upload to the WordPress site. Theme files are stored on the server and not in the database. The database can be modified, exported or imported from the phpMyAdmin area.

To access the phpMyAdmin area and make changes to your database the default username is “root” and the password is the same as the one you gave during the Bitnami WordPress set up. Login to the phpMyAdmin area by typing the address http://localhost/phpmyadmin/ in the address bar of your favourite web browser.