My recipe for rapid migration of a MovableType Version 3.2 installation to another host
Recently, I shifted four MovableType blogs to my present host, Bluehost. These were four separate installations, on a personal unlimited license. The existing databases — the ones to be moved — were heavily populated: lots of plugins, customizations, plenty of data, including pictures and long blobs of text. I also had three or four users per blog.
The problem was this: how best to seamlessly migrate the blogs, retaining users, passwords and all customizations, without having to reconfigure MovableType from scratch?
After some trial-and-error, I figured out a way. I don’t claim that this is the best, or even the only, way in which to do this, but it worked for me and should work elsewhere, as long as the new host meets certain requirements (listed below). Here’s my recipe for shifting MovableType to a new host, based on what I did.
Moving a MovableType installation to another host: the recipe
Ingredients
First, some assumptions:
- That you can access your MySQL database, and know how to use the export, import, drop, empty and SQL query functions. Very likely this is through PHPMyAdmin
- That your target/new host runs the CPanel control panel. If you’re using anything else, I can’t help you, though the overall instructions may still be useful.
- That you’re already running MT 3.2. This may not work for an upgrade; in fact, it very likely won’t, because, as far as I know, Version 3.2 uses a different MySQL table structure from the previous versions.
Separate the eggs: Backup and export your existing database.
This is critical. Log in to your existing MySQL and export the entire MT table. I prefer to do two exports, one each for the data and the table structure. But that’s only because it’s easier to upload at the other end. Remember to export with the create tables and inserts ticked on.
Heat the oven: Upload and install MovableType
On your new host, upload and install MovableType. For the upload, I strongly recommend using the Cpanel File Manager. It allows you to upload easily right from your browser, without going through an FTP client, and, more importantly, has a nifty built-in unpacking utility that will unzip/unpack your MT files. Remember also to upload any customizations and plugins you may have made.
What I do is this:
- Upload the core MT distribution;
- Unpack/unzip it;
- Upload a tar.gz file of my customizations and plugins (which I generally keep in a separate directory anyway). Unpack them, and, if you’ve configured the tarball correctly, it will unpack right into the MT folder, over-writing where necessary.
Tip 1: If you’re as much a maniac as I am about using MT Plugins, then you’ll soon have realized that it’s damn near impossible keeping track of what goes where — the folder hierarchies, the customized files, etc. Besides, I also customize some of the core libraries so that my uploads go to pre-defined directories and all uploads come up with pre-designated code. If I muddle all this with a default MT distribution, I’m bound to lost track of some file essential to a plugin. So what I do is to keep a separate folder called mt on my local machine, and store all the plugins and customizations in that, preserving their required folder structures and placements. Then I create a tarball of this entire folder. Now, when I need to ‘customize’ a new MT installation, I have only to upload this folder and unpack it. Since the core distribution is always unpacked to a folder on the root called mt, unpacking the customizations-folder from the root (using Cpanel) will automatically add the plugins and customizations at their appropriate places.
Tip 2: to quickly create tarball files:
- Use 7-zip (freeware) to create a .tar file;
- Use Win-GZ to turn the .tar into a .tar.gz file. Download Win-GZ
I’m not going to get into the details of the MT installation and initialization procedure, which are well set out in the MT documentation. Remember only that before you install MovableType, you must create the necessary database, database user, and add the user to the database with full privileges. The Cpanel interface is quite intuitive for that. Remember to update your mt-config.cgi as [documented][9].
Blend at high speed: Enter your new MovableType installation
Okay, now that you’ve uploaded MT, your customizations and plugins and set all the correct permissions for the various .cgi files and such, initialize the system. After that, you’ll log in to the default MT interface using, of course, the default login (Melody) and password (Nelson).
Okay, you’re in. First off, create a new user, preferrably using the same login and password you had earlier. Remember to give this new user (you) full access to the default blog, ie, all privileges. Also remember to rename the default blog. Do one rebuild. I don’t think it’s strictly necessary, but it doesn’t harm. Don’t worry about paths and settings at this stage.
Now log off as Melody Nelson; log in again using the new user you created. Go to the authors page and delete Melody Nelson as a user.
Log off and close this browser window. Onward!
Add seasoning to taste: Upload additional files
I forgot to do this, so I’m making a note of it, though it’s self-evident. Rememebr to upload all the additional files for your website including:
- Your css files (important!);
- Your template files (important!);
- downloadable files, if any;
- image and picture files;
- and, generally, anything that’s not stored in your database.
You can upload and unpack a zip file of these files, or use an FTP client (I use CuteFTP).
Pour into prepared pan: MySQL and PHPMyAdmin Adding the table structure
Here’s the next nifty bit. Enter your new host’s Cpanel again. Go to the MySQL page, and from there to the PHPMyAdmin page. You should be in your database. You may have to select your database if your host allows more than one, from the drop-down list. Select it.
Now select all the tables in the database and drop (read, delete) them. Open up a good text editor — I use TextPad — and open the MySQL table-structure file you exported from your previous installation. You can upload it directly into your MySQL database using the import function or, alternatively, use the SQL Query function and copy the entire table into it. Since your export has the create table and insert into lines in it, this will replicate your entire earlier table structure.
Do not repeat with the data export file just yet. You need to edit this file before you upload/insert the data (populate the table).
The critical thing now is to change the paths to your templates in your exported data file because it’s extremely unlikely that your earlier template-paths match the paths on your new host.
For example, earlier path name:
/home/net/somehost/domain/html/templates
While the new path name might be
/home/accountname/public_html/templates
Ideally, you should do a search-and-replace for the old path names and substitute them with the new path names in the exported data file.
Done? Fine. Now in PHPMyAdmin, upload or insert the contents of your freshly-edited exported-data file into MySQL.
The topping: full rebuild
That’s about it! Try logging in now, with the username and password you used on your previous host — you should be through without any difficulty. Remember to do one full rebuild.
Sit back and savour: tuck in!
All this sounds terribly complicated, but, believe me, it’s a whole lot simpler than trying to re-configure the MovableType installation from scratch.
Lastly, one important thing to note: do not try and merely shove the exported table/data into the database of the new host. You just won’t be able to access the MovableType interface, no matter what you do. You have to go through the process of installing and initializing the new MovableType installation, logging in, adding a user and so on, as described above. Frankly, I understand the first bit, but don’t quite know why it requires you to log in and add a user. But that’s a small thing, given the huge saving in time and effort. Doing it like this, I was able to move all four installations over to Bluehost in less than 30 minutes. Doing them over would have taken three days. 
Post a comment