Using the Command Line for Fast Upgrades

WinSCPMy site is hosted on Dreamhost, and the reason I signed up with them was so I could use a command line for direct access to my hosting account on the web server to easily configure accounts, transfer large files, setup cron jobs, make backups, etc. No more hours of waiting for conventional FTP installs! I use WinSCP, an open source SFTP client and FTP client for Windows. Its main function is the secure file transfer between a local and a remote computer. Beyond this, WinSCP offers basic file manager functionality. It uses Secure Shell (SSH) and supports, in addition to Secure FTP, also legacy SCP protocol.

Prior to using this program, I used a conventional FTP program to upload the uncompressed Movable Type install. The process was slow and could take a couple of hours to move all the files to the server. It's no wonder that some people put off upgrading their installations. These days I just upload the compressed file to my server, uncompress using the secure shell command and drag and drop files and folders. The whole process takes less than half an hour.

Today a read a fantastic tip on movabletype.org that has cut the upgrade process down considerably more. Upgrading from MT4.2 to MT4.21 took less than 3 minutes. I'm using Movable Type Pro so my instructions vary slightly to those posted by phretor.myopenid.com.

First, you need to know the path to the version of MT that you're upgrading. Go to the download page and choose your download format (zip or tar.gz). Either will work but the command will be different. Click to download but cancel the actual download. You don't need to download the file. You'll see a thank you page with a link to directly download the file if the automatic download doesn't start.

If your download does not begin within 5 seconds click here.

Use your mouse to right click on the "click here" link and choose to copy the link location.

Open your secure shell window (or command line interface) and navigate to the folder that has your mt folder in it.

Enter the following lines into the command line:


$ cp -pR mt mt-bak
$ wget wget http://www.movabletype.com/downloads/blogger/MT-4.21-en.tar.gz
$ tar xvfz MT-4.21-en.tar.gz
$ rsync -a --progress MT-4.21-en/ mt/ 

The first line creates a backup of your mt folder.

The second line gets the file from Movable Type and puts it into the folder. You can paste the path in that you saved previously.

The third line uncompresses the file. If you saved the link for the zip file, change tar xvfz to unzip.

The fourth line uses the rsync command to copy the files that have changed in the new version.

If you have the mt-static folder in a different location, rename the one inside the mt folder to mt-static-new and drag it across to the same directory as the old version. Type in the following line:


$ rsync -a --progress mt-static-new/ mt-static/

Any files that have changed in the mt-static folder will be upgraded.

Before deleting any folders or files on the server, log in to MT and go through the upgrade process to make sure everything went smoothly.

A great tutorial on Dreamhost's Wiki explains in detail how to do an automated MySQL database backup, with the option to zip the file and email it to you. Instructions are also available for a complete domain backup.

5 Comments

I don't know about this. It seems to me to be altogether too cumbersome, perhaps not in terms of time, but certainly in terms of the steepness of the learning curve. Why would I want to know all those commands for shell access?

A decent control panel gives you a built in file manager. You can use that to upload the tarball, and then use the file manager's built-in extract/unzip function. That's a whole lot simpler.

I usually get my MT installation readied for the initial wizard in less than three minutes, and the whole run to the first login is under ten minutes.


To the previous commenter, these are good to know for people who already know how to use rsync and such. And it never hurts to learn the mechanics behind the drag and drop system. When something goes wrong, it's much easier to fix if you are at least partially up the learning curve. Gratz to the poster for posting something that isn't dumbed down.


Where did you get your site template, I really like it


I know a few people that will love this article, I'll certainly let them know.


Although I would’ve preferred if you went into a little bit more detail, I still got the gist of what you meant. I agree with it. It might not be a popular idea, but it makes sense. Will definitely come back for more of this. Great work


Leave a comment



Recent Entries

  • Send Entries Using HTML Formatted Email

    There used to be a plugin for earlier versions of Movable Type called "MT-Mail-Entry":http://www.nonplus.net/software/mt/MT-Mail-Entry.htm that allowed you to send friends a HTML-formatted email that included...

  • All Comments Not Getting Published

    I had a problem viewing some of the comments on one of my posts. I thought it must be a comment limit somewhere in the...

  • MT 4.23 Update Released

    Movable Type has released a security upgrade that fixes XSS vulnerabilities, and recommends updating to 4.23 as a mandatory. The vulnerability hasn't been exploited yet,...

  • Updated Joost Action Streams Plugin

    The plugin for [Joost Action Streams](http://mt4.juneeonline.com/babble-on/archives/2008/10/joost-action-streams-plugin.php) has been updated to include favourites. If you've previously installed this plugin I recommend deleting Joost from "Other Profiles"...

  • Adding the ShareThis Button to Mid-Century

    There's a tutorial on Rob Kenny's The Composing Stick with instructions for adding AddThis or ShareThis buttons to your posts. After receiving a request today,...

OpenID accepted here Learn more about OpenID