Login as root!
apt-get install build-essential gcc
# Add new system user sphinx
adduser –system –home /var/sphinx –uid 999 –disabled-password –disabled-login –group sphinx
# Create the dirs
mkdir /var/sphinx/bin
mkdir /var/sphinx/etc
mkdir /var/sphinx/log
mkdir /var/sphinx/lib
mkdir /var/sphinx/run
# Download and compile sphinx
wget http://sphinxsearch.com/downloads/sphinx-0.9.8-rc2.tar.gz
tar -xzvf sphinx-0.9.8-rc2.tar.gz
cd sphinx-0.9.8-rc2
./configure
make
make install
# Install sphinx binaries
cp src/indexer src/search src/searchd /var/sphinx/bin/
# Install sphinx configuration (remember to edit as it needs)
cp sphinx.conf.dist /var/sphinx/etc/
# Copy the startup script attached below, instead of attaching I posted that file as another post (https://veerasundaravel.wordpress.com/2008/06/20/sphinx-startup-script-related-to-sphinx-installtion/)
copy that post content and save as a init script file named sphinx
mv sphinx /etc/init.d/
chmod 755 /etc/init.d/sphinx
# This shows your run level
/sbin/runlevel | cut -b 3
# Lets say it is 2…
ln -s /etc/init.d/sphinx /etc/rc2.d/S92sphinx
# Add the correct ownership to sphinx
chown -R sphinx:sphinx /var/sphinx
# Give some restrictions…
chmod -R 711 /var/sphinx/
# Ok we almost done!!
cd /var/spinx/etc
cp -p sphinx.conf.dist sphinx.conf
# And edit this entries in sphinx.conf to look like this:
sql_host = localhost
sql_user = root
sql_pass = (your password)
sql_db = (your database name)
sql_port = 3306 # optional, default is 3306
# In section searchd
pid_file = /var/sphinx/run/searchd.pid
query_log = /var/sphinx/log/query.log
log = /var/sphinx/log/searchd.log
address = 127.0.0.1
# section index
path = /var/sphinx/lib/sphinx
Continue to edit the configuration and when you are ready…
Then start sphinx using the command!
/etc/init.d/sphinx start
now you are ready with sphinx, now you can install plugins like acts_as_sphinx, ultrasphinx etc to easily interact with sphinx using your rails application.
Related Articles
- Sphinx – Free open-source SQL full-text search engine (sphinxsearch.com)
- Extending WordPress search with Sphinx (Part III) (vocecommunications.com)