This document explains how to build Sphinx 0.9.8.1 ( and the Sphinx Mysql Storage Engine ) on Debian 5 ( lenny ) system.
CURRENT STATUS : even though I get this building, and can see the storage engine with “show engines” SphinxSE dies when you try and use the storage engine. discussion of this topic can be found here : http://sphinxsearch.com/forum/view.html?id=3294 Ill update the wiki with any findings.
It is easy to configure, compile and install Sphinx, but this method is not portable.
The Debian way is probably easier.
Even when building Sphinx manually, in the long run the Debian way will probably save labour, and is certainly the most reliable method.
Ive used these steps from a clean ( netinstall ) of Debian 5, only thing pre-installed on this box was SSH for remote access.
Im using Mysql 5.1 provided by the dotdeb repository, since 5.1 is not in the official debian repository at this point.
Modify /etc/apt/sources.list , add these lines to the bottom
deb http://packages.dotdeb.org stable all deb-src http://packages.dotdeb.org stable all
$ apt-get update
$ apt-get install ssh g++ automake make bison flex libtool libncurses5-dev zlib1g-dev checkinstall devscripts build-essential
Install Mysql-Server 5.1 from dotdeb repository, also install any build dependencies.
$ apt-get install mysql-server-5.1; $ apt-get build-dep mysql-server-5.1
Im going to build the sources in /root , feel free to exchange this for another location if you desire.
$ cd /root/ $ apt-get source mysql-server-5.1
download sphinx and mysql source from mysql.com ( the debian version has some missing files … ./Docs/ mainly :( )
$ wget http://dev.mysql.com/get/Downloads/MySQL-5.1/mysql-5.1.32.tar.gz/from/http://mysql.mirrors.ilisys.com.au/ $ wget http://www.sphinxsearch.com/downloads/sphinx-0.9.8.1.tar.gz
$ tar xvfz mysql-5.1.32.tar.gz $ tar xvfz sphinx-0.9.8.1.tar.gz
copy missing required files, so we can build sphinxSE
$ cp -a /root/mysql-5.1.32/Docs /root/mysql-dfsg-5.1-5.1.32
copy SphinxSE files to mysql source tree
$ cp -R /root/sphinx-0.9.8.1/mysqlse /root/mysql-dfsg-5.1-5.1.32/storage/sphinx
$ cd /root/mysql-dfsg-5.1-5.1.32/ $ sh BUILD/autorun.shRun Configure you can use the ” –with-plugins=sphinx ” switch if you want sphinx built static into your mysql binary. in this case I wish to build it as a separate .so plugin, so here we just do configure without any arguments
$ ./configure
make all mysql storage engines
$ make
copy the compiled SphinxSE binary to /root/
$ cp /root/mysql-dfsg-5.1-5.1.32/storage/sphinx/.libs/ha_sphinx.so /root/
$ mkdir /var/lib/mysql/plugins/ $ cp /root/ha_sphinx.so /var/lib/mysql/plugins/add the plugin_dir to your mysql config file
$ nano /etc/mysql/conf.d/sphinx.cnf [mysqld] plugin_dir=/var/lib/mysql/plugins/
Restart Mysql ( it will look in that plugin directory now )
$ /etc/init.d/mysql restart
tell Mysql about the Sphinx Storage Engine
$ mysql mysql mysql> INSTALL PLUGIN sphinx SONAME 'ha_sphinx.so';
you should see
"Query OK, 0 rows affected (0.00 sec)"
Verify its working correctly
mysql> show engines;
+------------+---------+----------------------------------------------------------------+--------------+------+------------+
| Engine | Support | Comment | Transactions | XA | Savepoints |
+------------+---------+----------------------------------------------------------------+--------------+------+------------+
>> Snip <<
| SPHINX | YES | Sphinx storage engine 0.9.8 | NO | NO | NO |
>> Snip <<
+------------+---------+----------------------------------------------------------------+--------------+------+------------+
install mysql client library development files
$ apt-get install libmysqlclient-dev
configure sphinx build enviroment
$ cd /root/sphinx-0.9.8.1 $ ./configure
build sphinx
$ make
instead of “make install” we are going to use “checkinstall” this will build a deb of sphinx-search so its easier to maintain
$ checkinstall
checkinstall will ask a bunch of questions. you can accept the defaults except for the “Package Name” when you see “Enter a number to change any of them or press ENTER to continue:”
select : 2 [Enter] then type : "sphinx-search" hit [Enter] to continue
you should now see
Done. The new package has been installed and saved to
/root/sphinx-0.9.8.1/sphinx-search_0.9.8.1-1_amd64.deb
You can remove it from your system anytime using:
dpkg -r sphinx-search
**********************************************************************
you can install this package with
$ dpkg -i sphinx-search_0.9.8.1-1_amd64.deb
You're able to remove that package in a debian way in any time:
$ sudo dpkg -r sphinx-search