Section 5.2. Installing Movable Type

Movable Type is free for personal use; if you're using the system for commercial purposes, a license fee of $150 is required. The software is donation-ware, meaning that a donation is appreciated. There are incentives for donating; for example, if you donate $20, you will receive a key, allowing your site to appear on the Recently Updated List on

As mentioned earlier in this chapter, the process of installing Movable Type can be time consuming, and the actual time spent installing the software will vary based on the amount of prior experience and familiarity you have installing server-based scripts. Users unfamiliar with the process of setting file permissions will no doubt have a different experience from those who are comfortable working in a command-line environment. However, as long as your server meets the requirements and you follow the instructions below, you should be able to get up and running without too much trouble. Let's get started.

5.2.1 Requirements

Does your web server meet the requirements for installing Movable Type? The system is a server-based application comprised of CGI scripts, Perl library modules, and frontend display templates and images. Data is stored in Berkeley DB databases, which provide a solid data repository for all your important blog data.

To install and run Movable Type, you will need:

A web server

The application itself is around 2 megabytes, but we suggest you have at least 25 megabytes of disk space available on your server to accommodate future files and posts.

FTP program or shell access (Perl 5.004_04 or greater)

Most web hosts should have this version or greater installed. If they don't, ask them to upgrade. You can determine the version of Perl installed on your host's server from the command line:

% perl -v

This is perl, v5.6.1 built for i686-linux

Copyright 1987-2001, Larry Wall

Perl may be copied only under the terms of either the Artistic License or the

GNU General Public License, which may be found in the Perl 5 source kit.

Complete documentation for Perl, including FAQ lists, should be found on

this system using `man perl' or `perldoc perl'.  If you have access to the

Internet, point your browser at, the Perl Home

Berkeley DB and the DB_File Perl module

If your server does not have Berkeley DB or DB_File, you will need to have your hosting provider install it. Berkeley DB can be downloaded from, and DB_File can be downloaded from the CPAN ( If you are on a Windows server, you can install DB_File using the Perl Package Manager (PPM).

5.2.2 Downloading

The distribution can be downloaded from the Movable Type web site at The file that you download is saved in .tar.gz format; this is a compressed bundle, containing all the files necessary to run the application on your web server. After downloading the archive to your computer's hard drive, unpack it.

If you are in Unix, you can use gunzip and tar to unpack the archive:

$ gunzip file.tar.gz

$ tar -xvf file.tar

If you are on a Macintosh, Stuffit Expander can unpack the archive. If you are on Windows, PKZip or Winzip (in classic mode) can do the job.

If after unzipping the distribution archive you find a folder without a directory structure ? that is, files dumped into one folder, rather than grouped into subfolders ? you will have trouble installing Movable Type. This problem usually signifies you used Winzip's wizard mode to unzip the archives. If this is the case, delete the folder and try again with Winzip in Classic mode.

5.2.3 Locating Perl

The following files from the Movable Type distribution are Perl scripts: mt.cgi, mt-comments.cgi, mt-add-notify.cgi, mt-load.cgi, mt-check.cgi, mt-xmlrpc.cgi, and mt-send-entry.cgi.

The first line of each file (called the shebang line) must contain the path to Perl on your web server; typically, this location is /usr/bin/perl, so the first line of the file is #!/usr/bin/perl. You may need to change the first line of each file if Perl is in a different location on your web server.

To determine the location of Perl on your web server, take a look at the support pages for your hosting service. Alternatively, if you have a shell (command line) account and are comfortable using it, you can log in to that account then type:

$ whereis perl

This will give you the location(s) of Perl on your system.

If the location of Perl is not /usr/bin/perl but instead /usr/local/bin/perl, change the shebang line of each of the .cgi files to #!/usr/local/bin/perl. If you need to change the setting, take care not to remove the -w at the end of the first line in each file; this setting turns on warnings in Perl, and it is important that it be left on.

5.2.4 Installation Directories

There are three main components to Movable Type: the application, composed of CGI scripts, library files, and templates; the database directory, where your data is stored; and your blog itself, which is the public-accessible output of Movable Type (and is the reason that you're installing the system in the first place). The next step is to decide where to place these three components. The location of the application

Choose where on your web server you would like to install the software. This is the location that you will use (from your web browser) when using the Movable Type system to publish to your web site. (It is not necessarily the same location as your blog, though it can be.)

If you are installing Movable Type into a cgi-bin directory, note that you will need to upload your images, docs, and styles.css files and directories into a directory outside of the cgi-bin. These are static files, and if they are left inside of the cgi-bin, the web server will try to execute them. This renders them unusable through a web interface.

A typical solution is to create a new directory in your web-accessible area called mt-static, then upload images, docs, and styles.css into that directory. Take note of the URL corresponding to the directory that you created, because you will need to use it later when configuring Movable Type. For example, if you created mt-static at the root of your web-accessible area, this value would be /mt-static/. The location of the Movable Type database

Choose where on your web server you would like to store your Movable Type database files. The database holds all the data stored by the system: your entries, comments, templates, configuration, authors, etc.

If you are installing into a cgi-bin directory, your database can be located in cgi-bin; otherwise, it is advisable from a security standpoint to create the database directory outside of your web-accessible directories. For example, many hosted accounts have a home directory that is not web-accessible, then a public_html directory that is the root of the web-accessible area. Placing the database outside of the web-accessible area prevents web browsers from seeing any of your database content; placing it in the cgi-bin directory has the same effect. The location of your blog directories

Now you need to determine where to place the directories that will hold your blog files. These directories determine the URL that visitors will come to when they wish to view your blog. There are two directories: one for your main blog index files and one for the archives. The directories can be the same, if you'd like them to be. Note the path to the directories that you choose, because you will be creating them in Section 5.2.6, later in this chapter.

5.2.5 Configuring

The Movable Type system configuration is stored in the file called mt.cfg. This file contains system-wide settings, such as where your Movable Type databases are stored and the URL used to access the Movable Type system from a web browser.

On the computer where you unpacked the Movable Type archive, find the mt.cfg file and open it in a text editor.

  1. Change the line starting with CGIPath to point to the URL where you chose to install the application in Section 5.2.4. Make sure your URL contains a forward slash (/) at the end. For example, if you are installing Movable Type at, you would change the CGIPath line to:

  2. Change the line:

    DataSource ./db

    to instead read:

    DataSource /FULL/PATH/TO/DB

    where /FULL/PATH/TO/DB is replaced by the full filesystem path to the Movable Type database directory (typically called db). For example, if you chose to locate your Movable Type database at /home/melody/db, the above line would read:

    DataSource /home/melody/db
  3. If you are not installing Movable Type into the cgi-bin, skip this step.

    In Section 5.2.4, you chose a location for the docs, images, and styles.css in a directory outside of the cgi-bin, and you noted the URL corresponding to that directory. Find this line in mt.cfg:

    # StaticWebPath /mt-static/

    Uncomment it by removing the # character at the beginning of the line, then change the URL to the URL that you chose in Section 5.2.4. For example, if the files are located in /mt-static/, this line would become:

    StaticWebPath /mt-static/
  4. If your server does not have cgiwrap or suexec, skip this step.

    cgiwrap and suexec are tools that allow for more secure Movable Type directories and files. When running your CGI scripts under either of these tools, your files and directories do not have to be world writable. This extra security is a very good idea in a shared hosting environment, where other users have access to the same server as you.

    To take advantage of cgiwrap or suexec, uncomment the following lines in mt.cfg:

    DBUmask 0022
    HTMLUmask 0022
    UploadUmask 0022
    DirUmask 0022
  5. Save mt.cfg and exit the text editor.

5.2.6 Installing Files

Now that you have decided where your files will be located and have configured the system accordingly, you are ready to install the application and create the necessary directories. Connecting to your web server

Open your FTP program and open an FTP connection to your web server.

If the directory where you chose to install Movable Type in "Installation Directories" does not yet exist, create it. Then, open that directory. Uploading the application

Upload all of the files in the Movable Type directory to your web server. Upload these files/folders in ASCII mode: docs, lib, mt.cfg, styles.css, tmpl, and all of the CGI scripts (mt.cgi, etc.) Upload these files/folders in Binary mode: image. Note: be careful when uploading your files, as certain files must be uploaded in ASCII mode, whereas others must be uploaded in binary mode. If you get it wrong, the system will not work.

If you are installing Movable Type into your cgi-bin, remember that you need to upload docs, images, and styles.css into the directory outside of the cgi-bin that you chose earlier in Section 5.2.4.

Set the permissions on the following files to 755: mt.cgi, mt-comments.cgi, mt-add-notify.cgi, mt-load.cgi, mt-check.cgi, mt-xmlrpc.cgi, and mt-send-entry.cgi. If you are using your graphical FTP client to set the permissions, 755 permissions give read and execute access to all users (owner, group, and everyone else), and write access to just the owner. See Figure 5-8 for an example of 755 permissions.

Figure 5-8. Program permissions

If instead you are using the command line to set permissions, you should use the chmod command to set the permissions on each of the CGI files to 755 (Figure 5-9).

Figure 5-9. Changing permissions with chmod
figs/blog_0509.gif Creating your database directory

In your FTP program, open the directory you chose in Section 5.2.4 for the location of your Movable Type database.

Create a new directory called db.

If you are not running Movable Type under cgiwrap or suexec, set the permissions of the directory db to 777 using the chmod command. If you are using your graphical FTP client to set the permissions, 777 permissions give read, write, and execute access to all users (owner, group, and everyone else). See Figure 5-10 for an example of 777 permissions.

Figure 5-10. db Directory permissions
figs/blog_0510.gif Creating your blog directories

In your FTP program, create the directory where your blog files will be stored; this is the directory that you chose in Section 5.2.4 for the location of your blog directories.

If you are using a separate directory for your archives, create the directory where your archive files will be stored.

5.2.7 Required and Optional Perl Modules

Open your web browser and point it at the URL for mt-check.cgi on your site. For example, if your site is and you uploaded the Movable Type files into the /mt directory, you'd type

mt-check.cgi is a Perl script that checks whether the required modules are installed on your server. If you get a 500 Internal Server Error when running this script, check that you set the permissions to 755 (mentioned earlier in Section 5.2.6) and that you uploaded the file in ASCII mode. If you continue to get errors, look in the server's error log for clues as to what is wrong.

If the script runs successfully, it displays a list of Perl modules, and for each module it tells you whether or not the module is installed on your web server. Modules under the Checking for Required Modules section are required by Movable Type; modules under Checking for Optional Modules are optional and are needed only for certain features. These features are disabled automatically if you do not have the optional modules installed, but the rest of the system is still useable.

In the current release of Movable Type (2.1), the following modules are required by the system: HTML::Template, Image::Size, File::Spec, DB_File, and CGI::Cookie. These modules are optional: LWP::UserAgent, File::Temp, SOAP::Lite, and Image::Magick.

5.2.8 Initializing

Open your web browser and point it at the URL for mt-load.cgi on your site. For example, if your site is and you uploaded the files into the /mt directory, you'd type

mt-load.cgi is a Perl script that loads initialization data into the Movable Type databases: an initial author, a blog, and some starter templates. If you get a 500 Internal Server Error when running this script, check that you set the permissions to 755 and that you uploaded the file in ASCII mode.

If successful, mt-load.cgi reports its success. If unsuccessful, it reports an error. The error that occurs most often when running mt-load.cgi is a Permission Denied error when trying to initialize the databases. If this happens, it means either the permissions on your db directory are incorrect or the path to the db directory is incorrect.

After running mt-load.cgi successfully, you should remove mt-load.cgi from the directory where you installed Movable Type. Failure to remove mt-load.cgi could enable someone else to create a blog in your Movable Type installation and possibly gain access to your data. Failure to delete mt-load.cgi introduces a major security risk. Delete it now.

5.2.9 Troubleshooting

If you have problems installing Movable Type, head to the Movable Type support forums at The creators of the system, along with a dedicated set of expert volunteers, will help to answer your questions.

If after reading through the above steps you do not want to attempt to install Movable Type yourself, you can sign up for a paid installation at For $20, you can have Movable Type professionally installed and configured on your server.