Sphinx on Dreamhost

Published: March 10, 2009

If you wish to to install the Sphinx search engine on Dreamhost, you can and it is really quite easy and painless.

The first step is to download, compile and install sphinx into your home directory (as you do not have permissions to install this elsewhere):

cd ~/
mkdir -p local
wget http://sphinxsearch.com/downloads/sphinx-0.9.8.1.tar.gz
tar -xzf sphinx-0.9.8.1.tar.gz
cd sphinx-0.9.8.1/
./configure --prefix=$HOME/local/ --exec-prefix=$HOME/local/
make
install

Now you simply need to modify your $PATH to include ~/local/bin:

echo "export PATH=\"$PATH:~/local/bin\"" >> ~/.bash_profile
source ~/.bash_profile

Now you should have a working searchd and your only remaining concern is how to keeping it running, as Dreamhost will kill off long running processes. My solution was to add it to crontab:

* * * * * /home/you/local/bin/searchd --config /home/you/path/sphinx.conf

This appears to be a grey area with Dreamhost, but I’ve never really seen sphinx use any real CPU or memory (on my sites at least) and personally I think they should make it available as part of their standard build.