Skip to content

Instantly share code, notes, and snippets.

@kane-thornwyrd
Created January 5, 2012 09:45
Show Gist options
  • Save kane-thornwyrd/1564459 to your computer and use it in GitHub Desktop.
Save kane-thornwyrd/1564459 to your computer and use it in GitHub Desktop.
Sphinx search on Debian/GNU Linux (verbatim + update)
====== Sphinx on Debian/GNU Linux ======
This document explains how to build Sphinx debian package from source on a [[http://debian.org/|Debian]] GNU/Linux system.
===== 1. Why use a Debian-specific method? =====
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.
===== 2. Installation =====
==== 2.1. Getting appropriate libraries ====
To build Sphinx with [[http://mysql.com/|MySQL]], you need some mysql dev-libraries and "checkinstall" utility.
$ sudo aptitude install libmysql++-dev libmysqlclient16-dev checkinstall
[[http://postgresql.org/|PostgreSQL]] installation exactly the same, you only need to install "libpq-dev" instead of "libmysql++-dev" and run ./configure with "--with-pgsql" option.
==== 2.2. Compiling Sphinx ====
Next you should download and compile Sphinx:
$ cd /tmp
$ wget http://sphinxsearch.com/files/sphinx-2.0.3-release.tar.gz
$ tar xzf sphinx-2.0.3-release.tar.gz
$ cd sphinx-2.0.3-release
$ sudo mkdir /usr/local/var
$ ./configure
$ make
Then, instead of doing a "make install" let's build .deb-package (you must be a root):
$ sudo checkinstall
"checkinstall" will ask you some questions, you should answer them something like this:
0 - Maintainer: [ you{at}localhost.local ]
1 - Summary: [ Sphinx is a full-text search engine. ]
2 - Name: [ sphinx-2.0.3-release ]
3 - Version: [ 2.0.3 ]
4 - Release: [ 1 ]
5 - License: [ GPL ]
6 - Group: [ web ]
7 - Architecture: [ i386 ]
8 - Source location: [ sphinx-2.0.3-release ]
9 - Alternate source location: [ http://sphinxsearch.com/downloads/release/ ]
10 - Requires: [ ]
Please be patient with step #2, debian already have a package for sphinx2 (a speech recognition utility), therefore i renamed package to "sphinxsearch".
checkinstall automatically installs the new .deb package and put a copy of the package into that folder you were working in.
Now you can move .deb package wherever you want and delete working folder.
==== 2.3. Managing package ====
You're able to remove that package in a debian way in any time:
$ sudo dpkg -r sphinxsearch-0.9.8-svn
or
$ sudo aptitude remove sphinxsearch-0.9.8-svn
Installation now is also quite simple:
$ sudo dpkg -i sphinxsearch-0.9.8-svn_r1112-1_i386.deb
===== 3. Troubleshooting =====
If you get "ERROR: cannot find MySQL include files." while configuring, check that "libmysql++-dev" and "libmysqlclient15-dev" installed properly.
Make sure that you are using g++ rather than gcc by passing CXX=g++ to configure.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment