How to install Cheetah on Dreamhost
Installing Cheetah on Dreamhost’s shared servers is actually a snap, if you have access to a Linux development system. All you have to realize is that the servers are Intel-based Linux systems, Python setup utilities know how to build “dumb” distribution, and that python doesn’t care if you use symlinks to trick it.
- Skip this step, if you like, by downloading my precompiled Dreamhost-friendly version. Download: Cheetah-1.0.linux-i686.tar.gz (MD5 Signature: 5e64240ae6dd7eb0ffe92fdde61fe5ea)
- To build, go to a Linux computer, preferably Debian, with Python 2.3 installed.
- Download Cheetah. I’ve tested this with 1.0. I don’t know about 2.0, probably the same steps would work.
- Unpack Cheetah in a temp dir.
tar xzf Cheetah-1.0.tar.gz
- Compile a “dumb distribution”
cd Cheetah-1.0 python setup.py bdist_dumb --relative
- Copy the compiled distribution to Dreamhost. You’ll find it at “dist/Cheetah-1.0.linux-i686.tar.gz”
- Unpack the compiled Cheetah package in some directory. I’ll assume you are going to unpack it in your home directory.
tar xzf Cheetah-1.0.linux-i686.tar.gz
- It will unpack into two directories.
- lib/python2.3/site-packages/Cheetah — the compiled site packages
- bin — Cheetah compiler binary
- Now, you need to edit your ~/.bash_profile and add a couple lines:
PATH=$PATH:$HOME/bin PYTHONPATH=$PYTHONPATH:$HOME/lib/python2.3/site-packages export PATH PYTHONPATH
- Now, add the environment variables to your current session.
- At this point, Cheetah should work! Congratulations!
- If it compiles all right, but doesn’t work via the web, then you need to make sure your Cheetah dir is available from your web-context pythonpath. The easiest, hackiest, fastest way to do this is to simply make a symlink to Cheetah. This fools Python into seeing the “Cheetah” module in the same place it sees your project files. My domain has its Python cgi files right in the root, so I just did it like this:
cd ~/mydomain.com ln -s ~/lib/python2.3/site-packages/Cheetah .
Please let me know how this works for you, I’ll attempt to help you out if you run into problems.