For a while there, I had a sandpit environment for my parent’s webpage. The sandpit was a XAMPP install, running in a virtual Ubuntu machine via VirtualBox. I eventually got around to an upgrade of VirtualBox, and the old snapshots wouldn’t play ball with the upgraded environment. So, the task I set myself tonight was to recreate the sandpit from the live WordPress install out at my ISP. Turns out it wasn’t that simple to achieve.
First, I’ve been lazy with my Ubuntu kernel installs, and I’d forgotten which kernel I installed my latest VirtualBox with. The first thing I did tonight was to purge all my unused kernels, and start with a fresh install of VirtualBox in the last kernel standing. To get get my monitors and desktop playing at full capacity, I needed the guest additions installed. Once I had a blank virtual OS with guest additions, I took my first snapshot (what a lifesaver when things stuff up, and tonight was full of reversions to previous snapshots).
Next, I laid down XAMPP, Freemind and Dropbox for locahost web-hosting, notes to self on all things web-page related, and easy file transfer across environments respectively, resulting in my 2nd snapshot.
Once that was done I needed the following in order (remember me saying I was backtracking alot? The approach below isn’t exactly how the night went):
- dropped the entire WordPress directory zip file from my ISP into a new subdirectory of opt/lampp/htdocs
- Built a MySQL database and user to match what I’d set up at the ISP
- Imported the content of the live ISP database to the sandbox localhost database
- Modified the wp-config.php file to look at localhost instead of the ISP MySQL URL
- Switch off networking on the virtual machine briefly
- Step into the sandbox MySQL database, and modify relevant fields in the wp_options table so the sandbox environment wouldn’t go out to the live site and f**k it all up on me (the URL fields are the culprits)
- Switch networking back on within the sandbox, and whallah. Working copy from the live system that plays nicely.
And now I have a 3rd and final snapshot that I can try various shopping-carts out on before committing to a particular flavour.
I’ve learned tonight that the WordPress file backup and its matching MySQL backup go hand-in-hand for replicating the web-site across environments. I’ve also learned that the current backups sitting out at my ISP saved my bacon once I realised that the wp-admin screen in the sandbox was going out to the live site, and causing me to lock myself out of the live system, which suddenly thought its URL was based on a localhost address. DO NOT allow the sandbox to talk to the wider network until it’s happy to serve everything up locally Linds. JUST F**KING DON”T!
Might pour myself a stiff drink before I crash. Shaky nerves and all that jazz.