Installing and Configuring Sphinx

Sphinx is an important component of the Locum library. It is well worth your time to read through the Sphinx documentation because you will be able to greatly customize it to exactly match your needs. Of course, Locum is distributed with a Sphinx configuration file that should work out of the box with very little modification.

Locum was designed to run on Sphinx 0.9.8, which can be downloaded here.

Also, make sure the following are installed on your system (package names may vary by Linux distribution. For more detailed information on these prerequisites, see the Sphinx home page):

  • g++
  • libg++
  • make
  • libmysql++-dev

Here are the recommended steps to get Sphinx installed (run as root):

cd ~
wget http://sphinxsearch.com/downloads/sphinx-0.9.8.tar.gz
tar zxvf sphinx-0.9.8.tar.gz
cd sphinx-0.9.8
./configure --prefix=/usr/local/sphinx
make
make install

Next, we'll make sure that the PHP API is available in the install tree. From the same source directory do:

mkdir /usr/local/sphinx/lib
cp api/sphinxapi.php /usr/local/sphinx/lib/

Next, you have to create a sphinx user, a PID directory and set the right ownership so we can install a nice init script ( !!! make sure you do '>>' and NOT '>'):

echo "sphinx:x:999:999:Sphinx User,,,:/usr/local/sphinx/:/bin/true" >> /etc/passwd
echo "sphinx:x:999:999:Sphinx User,,,:/usr/local/sphinx/:/bin/true" >> /etc/passwd-
echo "sphinx:x:999:" >> /etc/group
echo "sphinx:x:999:" >> /etc/group-
mkdir /usr/local/sphinx/var/run
chown -R sphinx.sphinx /usr/local/sphinx/var
cd /etc/init.d
wget http://www.thesocialopac.net/sites/thesocialopac.net/files/sphinx
chmod +x /etc/init.d/sphinx

Finally, you're going to copy the Locum-specific Sphinx configuration file into place.

cp /usr/local/lib/locum/sphinx/sphinx.conf /usr/local/sphinx/etc/

Once that's copied over, edit it, and replace all instances of "locum_db_user" and "locum_db_pass" with the MySQL username and password you set up in the initial preparation.

Sphinx should now be ready. We will do a little more with it when we get in to installing Locum.

Comments

Unable to create Sphinx user

I've gotten to the point in the installation where you create the sphinx user. When I run this command:

sudo echo "sphinx:x:999:999:Sphinx User,,,:/usr/local/sphinx/:/bin/true" >> /etc/passwd

I get this:

-bash: /etc/passwd: Permission denied

Any ideas what I may be doing wrong?

Manually Copy & Paste

Hi George,

I had the same problem on Ubuntu Server 8.10. I believe the problem is that Ubuntu may not allow a user even with sudo privileges to echo to the passwd file. I had to open up the mentioned files and manually paste the lines in.

Brian