January 30, 2004

Moving your MT Blogs to a New Server or Web Host

Moving your Movable Type blog to a new server or to a new host is much more perilous than you might think. If not done properly, you could lose all of your entries. I recently went through this exercise and what saved me was a set of instructions from MT user Russcam. What I've done here is reworked Russcam's instructions for what worked for me with moving a site with multiple MT blogs. In some cases in this document I copy his words, word for word. I may get skewered for plagarism here, but I hate PDFs and need a web-findable record of what I did. This is essentially Russ's work, with my tweeks and ammendments. Please leave comments, questions, or proposed amendments in the comments field. I'm not a techie, so if something goes wrong by following these instructions, I can't help you. I accept no liability. Read Russcam's notes as well and do your homework before attempting a move.

This tutorial is for those who already have an MT blog or blogs installed and are moving to a new server or to a new web host. If you are trying to choose a new web host, see Movable Type Friendly Web Hosts.

Note: If your version of Movable Type is MT3 or later, you might try the TypeMover plugin for backing up, restoring, and migrating your Movable Type weblog.

BEFORE YOU BEGIN
Before beginning the process, if you are transferring your domain name to a new host, wait until you have your MT blogs running smoothly at the new host. Your new host should be able to provide you with an IP address you can use before you make your domain name point there.

Note: If you are using the default database for MT2.661 and earlier versions - Berkeley DB - you may encounter problems migrating your blog(s). Please see the MT documentation, I changed hosts and now I can't log into Movable Type on this. I recommend upgrading to MySQL before you move hosts, in order to avoid the problems encountered with Berkeley DB. See the MT note Converting your Berkeley DB database to an SQL database. I used Berkeley DB and could not get into my blogs after a server upgrade. I followed MT's troubleshooting advice, but it didn't help me. I ultimately had to pay Six Apart for an install just to get the new one working again. But if I hadn't paid attention to these following steps, I wouldn't have had a blog to reinstall.

Note: if you are using MySQL as your database, in lieu of the following steps you can use a MySQL dump command to back-up your MT database with all of your entries, templates, and configuration preferences. You will need to back up any images used in your entries separately. See Backing Up Your Blog. You will need to know how to repopulate your new MySQL database on the new server with the dump file of your old database. Many web hosts provide a CPanel or phpMyAdmin that can make this easy.

1) BACKUP YOUR TEMPLATES
Using an FTP client, create a templates folder in the same directory of the index file of each of your blogs. In MT Weblog Edit, for each blog that you have, go to the manage templates section. Template by template, create a backup template by inserting a file name into the Link this template to a file window. For example, for your main index template, type in templates/mainindex.tmpl. Rebuild your files. This tip comes from MT supermoderator Girlie and can be found in detail at http://www.thegirliematters.com/tips/archives/0207/back_up_templates_with_link_this_template.php.

2) RECORD CURRENT PREFERENCES
In MT, click the "Weblog Config" button in the left-hand menu and for Core Setup, Preferences, Archiving and IP Banning, record your current settings by printing them out. Some printers don't fill out the check boxes when printing, so check your check boxes on your printouts for future reference.

3) CREATE BACK UP FOLDERS ON YOUR CLIENT
If you have several blogs like I do, you'll need to keep track of the back up files for all of your blogs. The best way to do that is to create separate back up folders for each blog on your local computer (client).

4) EXPORT YOUR BLOG
For each of your blogs, in MT Weblog Edit, click "Import/Export" from the menu at the left. If you are on a Mac, hold down the "option" key or if you are on a PC hold the shift key. Next (while holding the option or shift) click the link, "Export Entries From yourBlogName" and you can save the export. The resulting file should be called mt.txt, if it shows up as "mt.cfg" don't worry - just change it to mt.txt. For each of your blogs, put the mt.txt file into a separate folder on your client for use later. Check each file and make sure the export worked and you have a text file with the data from all of your entries.

Note: Girlie has posted a great tip on how to automate your blog export. See: http://www.virtualvenus.org/archives/0309/create_an_export_blog.php.

5) RETRIEVE CURRENT HTML
Here you will download from your current server (the visitor accessible html, etc) the complete directory where your blog resides. Using an ftp program, download the directory (folder) that encloses your blog.

Once you have downloaded the directories, for each archives folder, delete the entries or move them someplace else, out of these particular back up files. You will be repopulating these folders with data that you just got from you export when you import them back later.

6) GET YOUR CURRENT mt.cfg FILE
If you don't already have a copy of this configuration file on hand, retrieve it from your current server. It resides with the MovableType application (for many people this is in the cgi-bin directory).

7) COPY YOUR PLUGINS FOLDER
If you are using any of the various plugins available for Movable Type, make a copy of those plugins from your plugins folder in your CGI bin to your client to reload later. Also retrieve and copy any plugin related files from your exlib directory.

8) SET UP NEW DATABASE FILE AT NEW HOST
Some hosts require you to contact them to get your database set up. Usually you tell them the username and password you want and they respond with the database name (it varies, check with your host). Other hosts allow you to set up your database via their user control panel.

9) UPLOAD BLOG DIRECTORIES TO NEW HOST SERVER
Upload the directories you saved from Step 5 to the new server. To simplify things, try to maintain the same paths as you had in your old webspace.

10) INSTALL MT TO NEW SERVER
Install the MT application. Do not just copy your MT files from your old server, it may not work if you do that. Get the latest copy of MT from MovableType.org and install MT from scratch. Run the diagnostics and checks. Don't forget to place the mt-static directory in the public html space if that is where you had it before.

11) PLACE EXPORTED BLOG WHERE MT CAN FIND IT
Chose which blog you will import first. In the same directory where the mt.cgi file resides, create a new directory called, "import" and place the blog's mt.txt export file you created in step 4 inside.

12) EDIT mt.cfg TO REFLECT INFORMATION FOR NEW HOST
Pay special attention to any settings that may have to change because paths for certain things are different in your new webspace such as CGIpath, ObjectDriver, Database, DBUser, MailTransfer, SMTPServer and StaticWebPath. Pay careful attention to CGIpath if your new host has a different location for cgi-bin.

13) PREPARE NEW BLOG
Connect to MT at your new webspace and create a new weblog. Using your Weblog Config print outs from Step 2 of the blog you want to set up first, re-enter these settings. Enter your Archiving settings before the Preferences settings so that your Preferred Archive Type shows up in the pull-down menu in Preferences. Also, unless you set the Default Post Status to "Publish", all your imported entries will come in as drafts. You can change it back to "Draft" after you complete the import.

14) UPDATE TEMPLATES
If you followed steps 1, 5, and 9, your template files should be already in your blog directories on your new server. For each template in your blog, relink a blank template to each one. To do this, type the path of the template file into the Link template to file window. Make sure that the template body window is blank. Click save and MT will populate the template body window with the data from your existing template file.

15) IMPORT BLOG
Before importing, be sure to read over the MT documentation on the subject, particularly regarding assigning authorship and categories. Here's the link:
http://www.movabletype.org/docs/mtmanual_importing.html#importing%20entries
When you are ready, in MT click Import/Export in the left-hand menu then click the "Import Entries" button. When the import is complete, click REBUILD. View your site.

16) REPEAT STEPS FOR ALL YOUR BLOGS
For each additional blog, click create new weblog in the Main Menu of the Weblog Edit page. Repeat steps 10 through 14 for each blog of your website.

17) POST A NOTE ON THE BLOG AT YOUR OLD HOST
Create an entry that basically tells your readership that you are making the move and that it may take a day or two for the DNS servers to connect your domain name up to the new host. Ask them not to post comments during this period or they may be lost.

18) RE-DIRECT DOMAIN NAME (skip if you don't have your own domain name)
This process will depend on who you registered your domain name with. If you don't know how, contact your domain name registrar and ask how. Many allow you to do it yourself via a web-based control panel.

19) POST A "FIRST ENTRY" ON BLOG AT NEW HOST
Create a new entry that will let you (and your readership) know that the blog on the new host is online. Until your redirected domain name has propagated through the DNS servers, the "last entry" on your old blog will still show up.

Links:
MTWiki instructions on backing up a MySQL database - as an alternative to the above instructions.
TypeMover - a new MT3 plugin to help backup, restore, and migrate your Movable Type weblog.
Advice from a Google employee on moving web hosts or changing domains.

Note on Creative Commons License: Attributed, non-commercial, derivative works based on this content are allowed and encouraged.

Has this tutorial been helpful? Please consider linking to Learning Movable Type at http://learningmovabletype.com/ . Thanks!

Posted by Elise Bauer on January 30, 2004 to Servers
Comments(16) | Email to a friend | Printer-friendly version


Trackback

If you would like to send a trackback
please use the following URL: http://learningmovabletype.com/cgi-bin/mt32/mt-tb.cgi/170

» The pain of moving to a new server from Katieweb: a user-centered viewpoint
After using Movable Type for a couple of weeks, I asked my host company to install suexec. This turned out to be a mistake. Right after suexec was installed, I was locked out of MT. My password no longer......[read more]

Tracked: August 9, 2004 08:40 AM

» Upgrading MovableType Berkeley to MySQL from VoIP Blog - VoIP News, Gadgets
Upgrading to MovableType running MySQL instead of the Berkeley database was certainly a challenge, but it was worth the effort. I've been running the default Berkeley database for TMC's blogs, including my own. I knew that the Berkeley database was......[read more]

Tracked: April 8, 2005 09:04 AM

Comments

Great job Elise! I have absolutely no problem with you adapting my work and publishing it here: the whole purpose was to provide others with a place to go for help. You have finished a job that I have left incomplete for too long. Thank you!

Excellent instructions! I migrated one MT blog tonight, and I'll do another one tomorrow. I was planning on doing a database dump from mysql so I could do an import into the new database (on a new server). The new database is Postgres, and I was NOT looking forward to that export/import process. Your instructions saved me from that particular pain. Thank you.

Thanks for a really helpful guide. It guided me through the intricacies really well. I'd add one more thing: that you can lose the numbering sequence of your posts, and thus confuse inbound links from the past. It might be worth referencing Importing/Exporting Movable Type from Cook Computing (http://www.cookcomputing.com/blog/archives/000254.html) on this.

I may have missed something but at what point was I supposed to import my DB?

Thanks

Morgs - When you follow the steps outlined above, you export your entries and import them into a new database that MT creates automatically.

There are other ways to do this, especially if you are using MySQL. Do a search on the MT Support Forums for more info.

Thanks Elise,

Turns out I had done it properly just didn't realize it.

I am following along here and have a few questions.

1. In step 3 you mention creating backup folders for each blog on your client. What is the point of this step. Isn't it the same as doing the export in step 4.

2. What is all the talk about databases? I am using mysql. I know this from the install, but I thought all the "data/stuff" is just in files on my webserver??? Am I wrong, or just confused?

Thanks,
Erik

Hi Erik - the folders in step 3 are empty until you put the export files from step 4 in them. This instruction is specifically geared toward those who have multiple blogs on the same installation. You export a blog one at a time and if you don't put the files into different folders, you will overwrite them. MySQL is your database. It is different from the files that you see on your webserver. The best place to ask questions about the database is on the MT Support Forums by the way. They know a lot more about them than I do.

You may want to mention the implications of breaking old archive links within entries if people are moving their blog not only from another host, but into a new directory structure as well.

The search and replace feature can help here by updating '/olddir/archive' to '/archive' e.g..

Internal image links might also break if used in entries.

Hi Elise,
I'm almost there thanks to you. For reasons too long to go into, I ended up adjusting the new mt3 templates to match my old site and then saving them BEFORE I HAD MY DATA IMPORTED (I worked with test entries.) I actually had to reinstall MT 3 to get it to upload my data correctly. My problem is that while I have successfully imported the dat (FINALLY!) my site uses the new UNadjusted mt3 templates that came with the new install. How can I swap out these unadjusted ones, for the ones I adjusted and saved?
kelly

Joost - good point.

Kelly - I think the best way is to copy and paste from your old templates into the new in the template edit area. If you did a "link to file" to save your original templates, see Girlie's tips on this: http://www.thegirliematters.com/tips/archives/0301/link_this_template_to_a_file.php. For more help, go to the Support Forums. There are many more people there who have experience with this than I.

every thing went well :)
thanx elise .

Hi Elise

Sorry Im commenting back a bit late on this article as I just fell upon it today.

Thanks for the tips and a great site. When you mention populating a template box it made me think.

Is there a way to populate a template box without manually typing in a path to a saved template?

I'm curious if you know of a method of doing this as I would like to have MT populate a standard default template every time, eliminating the need to cut and paste, or worry about looking for files / paths.

Hi Erik, I don't know of a way to repopulate the template automatically.

Hi Elise. My webhost (Netfirms) won't update an Apache module that MT 3.11 needs (PerlSendHeader=Yes), so I am going to migrate to a new host (BlogHosts.com).

I like the idea of using TypeMover. So, I'm wondering if you can check my logic. (1)Install MT 3.11 Full version to new location. (2)Install Type Mover plugin. (3)Copy Image directory from old server to new (for images used in templates and entries), in addition to any other static files (I also have a Coppermine photo gallery to move). (4)Run the TypeMover application to migrate my MT blogs from old host to new host.

Will TypeMover also bring over my cfg files and the stuff needed to point to the sql database at the new location? Or, is there any manual tweaking to do?

Hi Dave,
Now that I'm using MySQL, I can just do a MySQL dump and reimport that dump file back into MySQL. I haven't used TypeMover yet; I hear it is still a bit buggy. What I would do is make sure you don't turn off your old server until the new one is populated and working. If you are running Berkeley DB on the old server, you can try upgrading to MySQL first, or you can follow the steps outlined above to save your export.

You might try asking about TypeMover at the MT Support Forums.

Comments are now closed for this entry.


Email to a friend

Email this article to:


Your email address:


Message (optional):