Install Sphinx 3 on Fedora 30 (Thirty)

Scroll this

Sphinx is an open source full text search server. As of version 3, at
the moment of writing, it doesn’t come with official packages for
Fedora or Centos. So proper installation requires few manual steps.

In the following steps *sphinx* will be installed as a service, under
its own user and “ordinary” user will be able to run indexer in secure
and simple way.

1. Download tarball

From sphinxsearch.com/downloads/current/ download the latest version.
At the moment of writing it is Sphinx 3.1.1 (612d99f; Oct 17, 2018).

Run:

2. Create sphinx system user searchd

Create a system user without home and login shell:

3. Create systemd unit file

Save it as /etc/systemd/system/searchd.service:

4. Create necessary directories and config file

Run:

Make sure that /var/run/searchd will be created on reboot

Create file /usr/lib/tmpfiles.d/searchd.conf:

The /var/run/searchd is directory where sphinx pid will be saved.

Create Sphinx config file

Save sphinx config file as /etc/searchd/sphinx.conf.in:

Remember to enter correct db credentials for sql_* params in the
config file.

Change config file owner and permission:

The config file will contain your database credentials – so better to be
safe then sorry.

5. Start searchd daemon

In case you have SELinux enabled, run:

Run:

Check searchd daemon

And try also:

If mysql client made a successful connection – we are good for now.

6. Import test db and run a SphinxQL query

Import this sql file:

The sql file is based on /opt/sphinx-3.1.1/etc/example.sql

7. Enable non-root and non-searchd user to run indexer

Edit /etc/sudoers. Add line:

 

And then as “ordinary” user run:

The indexer will execute without the need to enter a password.

In the case of error: sql_connect: failed to load libmysqlclient check:

  • is /usr/lib64/mysql  in /etc/ld.so.conf (or included files), or add it to the
  • LD_LIBRARY_PATHis there a symlink /usr/lib64/mysql/libmysqlclient.so – if not – create it and run ldconfig -v

Run:

And then execute SphinxQL:

Expected result:

This shows that you have Sphinx search engine up an running!

Submit a comment