This tutorial is mainly based on an RPM installation of MySQL, or an installation of MySQL where you prefer to have Sphinx installed as a plugin instead of statically into the MySQL server binary. Currently this installation method is the *only* safe way for servers running cPanel.
Assumed Setup:
CentOS 4.x or 5.x MySQL 5.1.30
wget http://sphinxsearch.com/downloads/sphinx-0.9.8.1.tar.gz tar xvzf sphinx-0.9.8.1.tar.gz
Now download the MySQL 5.1 sources for the exact version of mysql that is running on the server (mysql -V) – these are only going to be used to compile the Sphinx module, as you should already have MySQL 5.1 installed.
cd /usr/src wget http://www.percona.com/mysql/5.1.30/source/mysql-5.1.30.tar.gz tar -xvzf mysql-5.1.30.tar.gz cd mysql-5.1.30 cp -Rf /usr/src/sphinx-0.9.8.1/mysqlse/ storage/sphinx
Find the RPM configure command for MySQL by running 'mysqlbug'. Copy the configure line to something like notepad and add the following line to it:
Now compile the Sphinx module against the MySQL 5.1 sources, but DON'T install:
sh BUILD/autorun.sh ./configure --<copied configure line> make
If you look in storage/sphinx/.libs you'll find the loadable .so files that can plug in to MySQL easily. To install, create your plugins directory, copy the files, then add the directive to /etc/my.cnf and restart MySQL:
mkdir /var/lib/mysql/plugins cp -rf storage/sphinx/.libs/ha_sphinx.so* /var/lib/mysql/plugins
In my.cnf:
plugin_dir=/var/lib/mysql/plugins
(Restart MySQL)
Now log into MySQL and install:
mysql -u root mysql> INSTALL PLUGIN sphinx SONAME 'ha_sphinx.so';
To see if it has installed properly, do a listing of the active engines:
mysql> show engines; | CSV | YES | CSV storage engine ..... | SPHINX | YES | Sphinx storage engine 0.9.7