Extrait du tutoriel d’IPS :
Installing Sphinx
cd /tmp wget http://sphinxsearch.com/downloads/sphinx-0.9.8.1.tar.gz tar xzvf sphinx-0.9.8.1.tar.gz cd sphinx-0.9.8.1
Next you need to configure, make and make install the package
./configure make make install
If you get an error at any of these steps, stop and correct it. For instance, if Sphinx cannot find your mysql binaries, you can tell it where they are by passing « –with-mysql (path) » to the ./configure command.
Once this is done, Sphinx is installed and ready to be used (though there is still more work to do).
You will need to copy the api/sphinxapi.php file provided in the Sphinx download to your forum root directory
cp api/sphinxapi.php /path/to/forums/here
Next, you should create the directories that Sphinx will store it’s log files and index files in. The suggested directory is /var/sphinx, however you can create the directory anywhere you wish. Just remember where you put it.
mkdir -p /var/sphinx/log
Configuring IPB
Now, login to your IPB admin control panel. Visit System -> System Settings -> Search Set-Up. Change « Type of search » to « Sphinx » in the dropdown, and configure the Sphinx settings appropriately. In most cases, you do not need to change any of the sphinx settings, however if you created a directory other than /var/sphinx, or if you are installing Sphinx on your MySQL server in a multi-server setup, you will need to adjust these appropriately. Save the settings.
Visit System -> Manage Applications & Modules next, and click on Build Sphinx Config. You will be presented with a downloadable copy of sphinx.conf. Download this file, and then upload it to your server (the exact location is unimportant, but remember where you put it).
Creating the index and starting the search daemon
Run the following command, replacing the path to the sphinx.conf file appropriately
/usr/local/bin/indexer --config /path/to/sphinx.conf --all
Once this is done, you need to start the search daemon.
/usr/local/bin/searchd --config /path/to/sphinx.conf
And once the search daemon is running, you should be able to use the search feature on your site, now using sphinx for it’s backend searching. Go give your search function a quick test to make sure everything is working before proceeding further.
Final « tweaks »
There are two more steps you need to do.
crontab -e */15 * * * * /usr/local/bin/indexer --config /path/to/sphinx.conf core_search_delta members_search_delta forums_search_posts_delta --rotate 0 4 * * * /usr/local/bin/indexer --config /path/to/sphinx.conf --all --rotate
Again, remember to replace the path to the sphinx configuration file appropriately. Also, you will note in the first cron job added that we have to specify which indexes we want to rebuild (only the _delta indexes). There should be at least one index for each application installed that supports Sphinx. Thus, if you install Calendar, Blog, Gallery and Downloads you should change the cron job like so
*/15 * * * * /usr/local/bin/indexer --config /path/to/sphinx.conf core_search_delta members_search_delta forums_search_posts_delta calendar_search_delta downloads_search_delta blog_search_delta gallery_search_delta gallery_search_comments_delta --rotate
If you omit one, it will simply mean that new content won’t be added to the index until the full search index is rebuilt at 4 AM. If in doubt, just search the sphinx.conf file you have downloaded for « _delta » and note all of the indexes you find that have this suffix.
Finally, in case you restart your server, you want to make sure that Sphinx is started back up when the server starts. The method of doing this will vary from system to system, so contact your system administrator if you are unsure. We generally use on CentOS the following:
nano /etc/init.d/rc.local or nano /etc/rc.local
and add to the file
rm -f /var/sphinx/*.spl /usr/local/bin/searchd --config /path/to/sphinx.conf