Installing Movable Type using SSH
There are way too many users who are complaining on a regular basis about upgrade-related issues with Movable Type on the Movable Type forums. Until the process is automated for the average user through better support from software like CPanel and Fantastico, there is a better way for the average user to upgrade Movable Type: over SSH. If you don't know if your host provides SSH (a secure, Telnet-like login process for those that have never heard of it), then contact them before trying this. If you are using Windows, you'll need to download Putty. Mac users already have SSH installed (just open up the Terminal app, and you're good to go).
Before you get started, you need to know the following things about your host:
- What URL to give SSH for logging in (it's almost always your blog's domain without anything like www before it).
- What username and password to supply at the shell prompt (usually the same one you use for account maintenance at your host).
- The path to where you can either install CGI scripts or where you have already installed Movable Type.
In Windows with Putty, you'll open putty.exe, and supply it the URL for logging into your host where it asks for a host name, and then you click on the open button. On a Mac, you type ssh -l USERNAME URL and press Return.
Now, open up a FTP connection to your host like you normally do for uploading Movable Type file-by-file. Upload the whole zip file to the directory where you have /mt (or whatever you named the Movable Type folder). For example, if the full path in your FTP client was ~user_directory/public_html/mt for Movable Type, just upload the zip file to ~user_directory/public_html.
In the SSH window, run unzip MOVABLE_TYPE_FILE_NAME. If you downloaded the tarball (tar.gz) the command is tar -zxvf instead of unzip. That will create a fully expanded copy of the latest, fresh copy of Movable Type on your host. Before you proceed, it's a definitive best practice to do the following:
- Back up your database.
- Back up your existing copy of Movable Type.
The method of doing the database varies from database to database, but a tool like phpMyAdmin is usually provided by your host and is excellent for exporting a database for backup. With regarding to backing up your old copy of the Movable Type files, you have two options:
- Download the entire directory by FTP.
- Run the "zip" command; ex: zip -r mt_backup.zip ./mt from the directory that holds your copy of Movable Type. You can either leave that file on the host or download it by FTP.
The command to copy over the contents of all files from the fresh, new copy of Movable Type to your existing installation is (for MT-4.261-en.zip) cp -R MT-4.261-en/* ./mt/
That command should preserve existing file permissions, so you shouldn't have to worry about chmod'ing anything. If anything fails after the upgrade, and you followed the backup instructions, restoring your old copy is as simple as putting your SQL backup into the database admin tool, running rm -rf ./mt and copying the file backup back to your host (or unzipping the zipped backup).
For people unfamiliar with Unix, it may seem daunting because it is different, but it usually pays off quite well. A significant portion of installation issues come from FTP clients failing to properly upload a new copy of Movable Type piece-by-piece. If you find yourself in that position, then give it a shot.
Leave a comment