WordPress On a USB Stick
You can run WordPress, or any blog platform, from a USB stick. It’s easy and useful. If you are anything like me, you are probably laughing while asking the question “Why would anyone need to run WordPress from a USB drive?” I laughed too, until recently.
About two months ago I received a notice for jury duty. Just a couple days ago I served for jury duty. I wasn’t called into a trial, but I did make the most of my day. All thanks to my WordPress on a stick. I didn’t know if the court house had internet access and didn’t feel like reading a book all day, so I dove into a little project to run WordPress from a stick. After all I had a long list of website tweaks I wanted to perform and this could be the perfect day to do them.
After a day of working with my remote blog platform I came to realize there are many reasons why this is valuable…here is a short list I came up with:
- Work on your blog while at jury duty (ha)
- Want to work on your theme or template and not worry about caching and refresh to see your changes (yes, I’m a hacker too)
- Your boss monitors what you do on the net and you want to tweak your WordPress template, plugins, themes while
getting paidon-the-job. - Web developers can make their environment portable for showing to clients or provide a delivery platform for a finished product.
- You travel a lot and internet time can get expensive at hotels so a portable environment lets you work at your pace.
- Making long airplane trips and WordPress on a stick kills time (it really does).
- Off line, firesafe remote back up. This is absolutely invaluable when you have a large blog with lots of valuable info to keep safe.
- A great way to learn and play around with Apache, MySQL features and configurations without killing your site or server.
Sure, there are many reasons why WordPress on USB is beneficial but lets stop talking about it and start making it happen. This is my USB Tutorial on how to put WordPress to USB.
Taking Care of the Server Stuff
You need a full list of server tools to make this happen and luckily there is a pre-configured zip file ready for the taking. Jump over to PortableApps.com and grab the XAMPP zip file under the Development category (link). This has everything you need to put your blog platform to USB. Apache, mySQL, PHP, phpMyAdmin and some other items.
For my homebrew project I downloaded the XAMPP Lite version as I didn’t need everything in the full version and the Lite version is smaller in size. Please note, this USB tutorial is for the Lite version only and using the full version might require changes.
Once you download and unzip the contents, drag-n-drop the new folder (called xampplite) to your USB stick (Don’t try and unzip the file from your flash drive, this = slooow). To copy the contents to your flash drive will probably take more time than anything else.
Once the xampplite folder is on your flash drive, get into the new xampplite directory and open the xampp-control file and the xampp application starts up. This is where you turn ON the Apache server software and MySQL database server software. Just click the two start buttons, that’s it!
*Note: Do not run the setup_xampp.bat file. This will assign a drive letter to the USB stick and make the stick inoperable when a different drive letter is assigned when used on a diff computer.
**Be sure not to check the “Svc” check boxes as this will leave a footprint on the host machine (which partly defeats the purpose of running the web server off a stick). ~Thanks Brian!
Next, open your browser and navigate to the remote server we just downloaded, installed and activated on your USB drive. Get your seat belt on.
Open your browser and type in: https://localhost
This will open your web interface to the MySQL, Status, examples and other fun tid-bits.
So now we have the remote USB server running, the next step is loading up WordPress (or other blog platform) and activating it to get your WordPress on a stick and running.
Click the phpMyAdmin link from your https://localhost location. Here we create the name of your database for WordPress. Type in wordpress in the blank field for “create new database” and click “Create.”
You didn’t actually make all the database fields for running WordPress you simply created the database name.
Taking Care of the WordPress Stuff
The next step is copying the WordPress software (link) to your USB drive. To prepare you for placing the WordPress software in the correct location know that all web pages must be in the htdocs folder. You can drop in a quick test.html into the htdocs folder and double click it and open to make sure everything works, but trust me, it will.
Inside the htdocs folder create another folder called wordpress. Inside this folder is where you place all the WordPress software files. The folder you just created named wordpress is what the MySQL server software will look for (remember you created the database name just a few steps earlier).
Once WordPress is on the USB drive find the wp-config file inside the wordpress folder and lets edit. Open up the file using Notepad or Wordpad and edit the wp-config file so it reads like this:
// ** MySQL settings ** //
define(‘DB_NAME’, ‘wordpress’);
define(‘DB_USER’, ‘root’);
define(‘DB_PASSWORD’, ”);
define(‘DB_HOST’, ‘localhost’);
**Note: With the Lite version of xampp you need to include the word ‘root’ for user. I believe the only difference with the full version is you keep that field empty.
Save the wp-config file and close.
Now type the following into your browser to activate WordPress:
That’s it. You are done. Simply follow the WordPress instructions and you are done (actually one more step). Write down the password WordPress gives you because there is no email being sent to you! Change the password in the Admin panel under Users once everything is set-up.
The last item is taking care of the feeds you see on the WordPress Dashboard. You know, all the stuff Matt and his clan send out. The USB hack to eliminate the RSS feed on your dashboard simply navigate into your wordpress folder to:
\xampplite\htdocs\wordpress\wp-admin\index.php
Open up the file in Notepad or Wordpad and delete everything (yes everything) and replace with:
< ?php require_once(‘admin.php’); $title = __(‘Dashboard’); require_once(‘admin-header.php’); require_once (ABSPATH . WPINC . ‘/rss-functions.php’); $today = current_time(‘mysql’, 1); ?>
< ?php require(‘./admin-footer.php’); ?>
Now you are ready to rock and roll.
Go Have Fun
My tutorial is the down-and-dirty, lets get to business, approach so sorry for any lack of back ground info. You should have a nice clean process if you follow exactly as described. Just as a friendly reminder, here are the key files I spoke about you should pay attention too:
I also found some reference material at Tamba2.org.uk which is a great website to bookmark for WP info.
If you have any questions, concerns or problems hit the USB forum post for this article and post your situation.