Installing Movable Type on Tiger

Posted on February 13, 2008. Filed under: Apache, Hosting, Leopard, OSX, Servers, Software, Web Development | Tags: , , , , , , , , |


One of the biggest phenomenons to hit the Internet in the past few years has been the personal weblog: blog for short. A blog is basically a Web site that allows its owner to post his thoughts, ideas and daily happenings. Some use it as a personal diary, some as a soapbox for their beliefs.

Note: This article is written for installing Movable Type on โ€œTigerโ€ (Mac OS X 10.4.x). The Panther and older OS X versions of this article, have been relocated to their own seperate, permanent pages.

Many people host a weblog on a third-party web server hosted by someone else, but with MacOS X, we have the tools we need to set up a fully functional weblog on our system. This blog could be served to the entire world via the Internet, or just used as a personal diary on your own system. It doesn’t matter. Weblogs are what you make of them. There are several systems we could use to set up a weblog on our Mac, but for this article I have chosen Movable Type from Six Apart. I chose this solely because I have the most experience with it, as I have used it for almost four years on my personal Web site. Movable Type is designed using a Perl backend. Perl is an interpreted programming language that is capable of doing almost anything you wish. Tiger ships with Perl 5.8.6, which is more than enough for this process. The backend of our weblog will use SQLite. SQLite is the database system that is bundled with Mac OS X Tiger and powers the Core Data framework. Several major Mac applications use SQLite as well. A few examples are Freshly Squeezed Software’s PulpFiction and Michael Tsai’s SpamSieve. This article will assume that you are running a fresh install of MacOS X 10.4 or later and have the MacOS X Developer Tools installed. You should also be comfortable working in the command line and editing system configuration files. If this scares you, you may want to sign up for a service such as Six Apart’s TypePad. Let’s get started… ### Downloads First let’s download all of the files you are going to need to complete this exercise. We are only going to need DBI, DBD::SQLite and Movable Type 3.16. DBD::SQLite is a Perl module that will interface between SQLite and Movable Type. DBI stands for Database Interface and was written by Tim Bunce. The DBI module then speaks to the DBD module. The DBD module we will be using is DBD::SQLite. The biggest advantage of DBI is that you can talk to the database without having to talk on the network to the actual database server or dealing with the server’s libraries. Movable Type is simply a collection of Perl scripts that run the entire weblog system. * Movable Type * DBI * DBD::SQLite ### Apache In terminal, we need to edit our Apache config file. We are basically going to allow for cgi scripts to be executed on the Mac. By default CGI Scripts are located in /Library/WebServer/CGI-Executables/. We need to uncomment the line in the httpd.conf file that reads # AddHandler cgi-script .cgi I am going to explain how to do it using the vi text editor, but you are more than welcome to use your favorite editor of choice. ๐Ÿ™‚ httpd.conf

sudo vi /etc/httpd/httpd.conf Go down to the line we want to edit and remove the # in front of _AddHandler_ by pressing the x key. Next type in _:wq_ to write and quit vi. Next, type the following into the Terminal window: sudo apachectl graceful The last command simply restarts the apache server without having to restart your system. Oh, the power of Unix. ### Connecting to SQLite Before we can establish a connection between Movable Type and SQLite, we need to install the Perl modules we downloaded earlier. Double-click on each file to extract the folders that live inside. We need to compile these modules so that our database will show up when we test Movable Type. It’s a relatively simple process. Type the following commands in the Terminal: cd ~/Desktop/DBI-1.48 perl Makefile.PL make sudo make install Now we need to install the SQLite module. cd ~/Desktop/DBD-SQLite-1.08 perl Makefile.PL make sudo make install Now that we have our perl modules set up, we can celebrate. We are finally ready to set up Movable Type! ### Movable Type cd ~/Desktop/MT-3.16-full-en_US/ vi mt.cfg Place a # before DataSource ./db Set your CGIPath to equal _http://localhost/cgi-bin/_ Add the following lines to your file. ObjectDriver DBI::sqlite Database /Library/WebServer/CGI-Executables/db/mtdbmovabletype.sql Set StaticWebPath to _/mt-static/_ Remove the # before _NoTempFiles 1_ :wq Ok, that is a lot of steps, so let’s go through what each one of them is. mt.cfg is the configuration file that gives basic information for the perl backend about your weblog. We set the CGIPath to equal where we are putting the cgi files. On your local system, it is /Library/WebServer/CGI-Executables/. StaticWebPath is where Movable Type’s images, docs, and other similar files will be stored. We set that to http://localhost/mt-static/ so that the directories are housed in /Library/WebServer/Documents/mt-static/. It should be noted that if you are going to set up your blog to be available for people on the Internet, you should replace all instances of localhost with your external IP address or domain name. The next set of commands is basically telling Movable Type to use the SQLite database. Now you see why we had to set up the DBI and DBD stuff earlier. We turned off NoTempFiles because Tiger was having issues when trying to build the index files. If anyone can find a solution to the problem, please post it in the comments. Let’s jump to the Finder. Yes, I am serious. After all of the love we have been giving the command line we are going back to the good old graphical filesystem. We need to install the Movable Type application onto our Webserver. First, lets copy the static files to the /Library/WebServer/Documents/mt-static/ folder. Make sure to copy the following files to that directory.

  • styles.css
  • mt.js
  • images
  • docs
  • index.html

Also, go ahead and create a new folder and call it _archives_. This is where we will hold all of our blog entries.

CGI-Executables

Now, let’s move back a level and enter the CGI-Executables folder. Copy the following files into it.

  • examples
  • extlib
  • lib
  • mt-add-notify.cgi
  • mt-atom.cgi
  • mt-check.cgi
  • mt-comments.cgi
  • mt-db-pass.cgi
  • mt-load.cgi
  • mt-search.cgi
  • mt-send-entry.cgi
  • mt-set-reg.cgi
  • mt-tb.cgi
  • mt-view.cgi
  • mt-testbg.cgi
  • mt-xmlrpc.cgi
  • mt.cfg
  • mt.cgi
  • php
  • plugins
  • schemas
  • search_templates
  • tmpl
  • tools

We are almost done. Now we need to jump back into Terminal and set some permissions for our scripts and create a folder for our database. cd /Library/WebServer/CGI-Executables/ chmod 755 mt*.cgi mkdir db chmod 777 db cd .. sudo chmod 777 Documents cd Documents chmod 777 archives What we just did is set the cgi scripts to be read and executed by group and others, while you can read, write and execute. If you don’t understand what that means, it is simply a Unix permissions thing. We then created a db folder that will house our SQLite databse. The last two commands set read, write, and execute commands for the archives and Documents folder. I ran into a lot of permissions issues by trying to lock the Documents folder with 755. The archives folder must be 777 though. If you want a more secure set up, I would recommend you recompile Apache with suexec installed. Sadly, Tiger’s version of Apache doesn’t have it compiled in. Everything is set up, let’s test. Pop open Safari and go to the following url. http://localhost/cgi-bin/mt-check.cgimt-check checks for installed perl modules on your system. You should have everything you need installed. If you find you are missing some of the modules, or want to install extra ones, Six Apart does a great job of giving you a walkthrough. This is important…. http://localhost/cgi-bin/mt-load.cgi This step sets up the tables, an initial author and some starter templates in your database. Assuming you have followed my instructions to their exact specifications, the script should report SUCCESS! You have a working Movable Type installation. With Movable Type 3.16, the application has the ability to run several tasks in the background. We need to test to make sure this will work on your system so click on the link below to do that: http://localhost/cgi-bin/mt-testbg.cgi As long as you see two unique numbers listed on the page, you will be fine. Delete mt-load.cgi from /Library/WebServer/CGI-Executables. Leaving it on your system is a big security vulnerability, because each time you run it, it is going to reset your database to the initial values. Congratulations, Movable Type is ready to go. ### Basic Configuration http://localhost/cgi-bin/mt.cgi Movable Type Login Screen

Now that we have the weblog configured, let’s go through some basic configuration. The link above is where you will do all of your blogging. It houses the configuration, templates and a basic editor. You will be greeted with a login prompt. The mt-load.cgi script created a default user name Melody and a password of Nelson. The first thing you are going to want to do is change that username and password. To accomplish this, just head to the Edit Your Profile link. Change the username and password to something you can easily remember. Next, let’s edit the default weblog to fit your specifications. The default is creatively named Weblog, but you may want to change that to something to describe you. I have my personal one as just my name, but others have been far more creative. ๐Ÿ™‚
Next, go to the Weblog Config button and let’s double check some values.

Save those changes, and start blogging, because you are ready. Simply go to the New Entry button and make your first entry. To view your content simply pop open Safari and visit http://localhost/### Conclusion We accomplished a lot. We set up a full-fledged content management system on our Mac using nothing but free or donationware software. This article merely gets you set up with a basic Movable Type installation. There is a vast world of plugins, configuration changes, and tips and tricks out there. Here are a few resources to check out.

Make a Comment

Leave a reply to ordersomabuyg Cancel reply

6 Responses to “Installing Movable Type on Tiger”

RSS Feed for Mac OSX Hosting! Comments RSS Feed

[…] Movable Type on Tiger This entry was written by montanaflynn. Bookmark the permalink. Follow any comments here with the RSS feed for this post.Content related […]

[…] Installing Movable Type on Tiger By montanaflynn Oh, the power of Unix. ### Connecting to SQLite Before we can establish a connection between Movable Type and SQLite, we need to install the Perl modules we downloaded earlier. Double-click on each file to extract the folders that live … Mac OSX Hosting! – https://macosxhosting.wordpress.com […]

Wonderful pages! Keep up the grat work.

Wow Cool !
Super Man
Nice Site

When i press the loginbutton after installation, all my mac does is downloading a mt-1.cgi file… What is wrong?!

Hi! I was surfing and found your blog post… nice! I love your blog. ๐Ÿ™‚ Cheers! Sandra. R.


Where's The Comment Form?

  • Blog Stats

    • 161,160 hits
  • Enter your email address to subscribe to this blog and receive notifications of new posts by email.

    Join 21 other subscribers

Liked it here?
Why not try sites on the blogroll...