Home > Blog Setup > Host Your Wordpress Blog Locally

Host Your Wordpress Blog Locally

If you regularly tweek your blog’s design, layout or test plugins – I would recommend having a local version of your blog.
Hosting locally means running a duplicate copy of your live blog on your local machine. In other words, your PC becomes your web and database server.
Having your own development area is a bit like having your own playground, with freedom to test and tweek as you please without affecting the live system. Web developers generally adopt this approach before deploying.

Hosting your blog locally is a very straight forward process, and would require the following;

  • Installing a web server on your computer.
  • Creating a database.
  • Downloading the latest version of wordpress.
  • Tweeking one wordpress file.

There are several ways to achieve this, but one the easiest ways is using a tool called XAMPP, which happens to work across most operating systems.

Step 1

Install a local web server

PC

This is quite straight forward on a PC, simply visit http://www.apachefriends.org/en/xampp-windows.html to download and install XAMMP Lite executable file.

Linux

For Linux users, applying a few commands in your terminal should get you up and running. Simply visit http://www.apachefriends.org/en/xampp-linux.html for download and install instructions.

MAC

MAC users, download and extract XAMPP file from here http://www.apachefriends.org/en/xampp-macosx.html

Step 2

Create and active your database
Using the downloaded XAMPP tool, you can create a new database for your local blog. Simply open XAMPP control panel and select the Admin button next to MySQL. This should then take you phpMyAdmin page.

On this page, under MySQL Localhost section,  you can create a new database name.

At this stage, to make sure everything is working fine, start the Apache and MySQL services, it will notify you once it starts.
You should also see the XAMPP splash screen when you type “localhost” into your browser.

Step 3

Download and Extract Wordpress
You can download the latest version of Wordpress by visiting wordpress.com Once downloaded, extract the zipped file and move it inside the htdoc folder. On a windows machine, this can be located under c:\xampp\htdoc

Step 4

Update your wp-config.php file
In this file, you will have to define your database parameters to enable connection.
In your wordpress folder, c:\xampp\htdoc\wordpress\

  1. Rename the file wp-config-sample.php to wp-config.php
  2. Define your database name – (‘DB_NAME’, ‘test‘);
  3. Define your database username – (‘DB_USER’, ‘root‘);
  4. Define your database password – (‘DB_PASSWORD’, ‘test‘);

You can find your database information from the phpMyAdmin page, located under the MySQL section

Step 5 and final step

Configure and Install
Run install.php file by pointing your browser to http://localhost/wordpress/wp-admin/install.php and hit enter.

  1. At this stage, you then see the configuration file, complete the fields with the same information as your wp-config.php file.
  2. Complete your blog title along with your email address and hit Run install
  3. ALL DONE – You now have a copy locally.

To transfer files from server to local machine, I would recommend using a an FTP client such as FileZilla.

What are your thoughts on testing locally?

Categories: Blog Setup Tags: , ,
  • Ah, my husband does this. I have yet to try it out. You're inspiring me!
  • Great guide John! Using XAMPP and running a local WordPress is really easy (with informative guide like this) and great way to test new design and plugins for WordPress.
  • Many Thanks Antti, :-)
    XAMPP makes it very easy and straight forward.
  • great resource John. Wordpress is such a widely used application, that resources like this will come in handy to many.

    While I do use Linux most of my work is done on Windows. Now nobody scream.
    Wordpress is also available for Windows, using PHP and mySQL. But the installation is slightly different.

    Now you can install Wordpress on Vista/Windows 7 with either Apache server or IIS7.0.

    So for all those Windows and WP fans, (Sorry John, hope I am not hijacking your comments here), I have written a nice little tutorial on how to install and get WP working on Vista/Windows7 and IIS7
    Using Wordpress on Vista and IIS 7.0
    I think that article will be of benefit to your readers, especially those who are using Windows and seek to use WP as well.
  • Hey fellow Linux user :-)
    Totally my pleasure, I'm always up for learning new things, especially techniques that would streamline the process.
    In the case of Windows, an activated IIS would make this even easier and convenient, since it comes built in.
    Although on XP, I am aware that IIS isn't available to XP Home edition users. Is there similar restrictions on Vista/Windows 7?
    Again, there are so many ways to approach this. Personally, I prefer the command-line approach on Linux.

    XAMPP seems to be a nice all-rounder.

    Will check out your post on this - Many Thanks Robert
  • You seem to have inspired a few posts today, John! Currently working on one of my own regarding configuring your own linux web server... Will drop a tweet when its done!
  • That's fantastic Ross, I look forward to reading it - Tweet me when you're done.
  • I use a slightly different twist on this and use a "staging" environment in a subdomain of my blog, learnt many lessons from working in IT...
  • Hi Ross,

    I'm familiar with that working approach too.
    It's actually not a bad idea sticking a "staging" environment on a sub-domain.
    Thanks for that Ross :-)
  • I wish I had this when I started last July! I am planning a second blog and this will be great for getting everything just right before releasing it into the wild. Last time round it was trial and error and the first month or so was a nightmare as I tweaked bits and pieces.
  • Releasing to the wild???
    Is that what you think of the blogosphere? LOL :-)
    I had similar trial and error experience in my early months too.
    I tried everything out, I even managed to take down the site a few times too.
    Thanks Kevin
  • Hi John, I didn't know this could be done. I didn't think most people had that much space available on their own pc's. Thanks for the info, these instructions seem easy to follow.

    @Ileane
  • Yep, it can be done, a local area doesn't necessarily use up as much resources as you would think.
    You can pick and choose what data you wish to copy over to your local machine.

    Thanks Ileane
  • Very helpful. Going to try this out this weekend as I try to learn how to mess with Headway.
  • Hello Earl, Good to see you.
    I've heard some good stuff about Headway, hope you have fun learning it.
    Thanks
  • I don't use WP, but I can easily translate those elements to Drupal. Really useful post John. I've always wanted to understand how to do this.
  • Hey Mike, I'm glad you found it helpful.
    We really must get you over to Wordpress someday :-)
  • Hey, John.
    This is a really nice tutorial you've put together and a great way to do some tinkering without affecting your live site, as you've pointed out.
    Well done, my friend!
  • Many thanks Jimi
blog comments powered by Disqus