Install Sphinx Search In Fedora or RHL

Category: 

Sphinx is an open source full text search server, designed from the ground up with performance, relevance, and integration simplicity in mind. It's written in C++ and works on Linux (RedHat, Ubuntu, etc), Windows, MacOS, Solaris, FreeBSD, and a few other systems. It is the basic definition by Sphinx community about Sphinx Search server. In case of full text search, using of Sphinx reduces the load time for the search results. Today, lets discuss about how to install the Sphinx Server in a Fedora Linux. But this tutorial will be helpful for other distros as well.

To start with we will download the sphinx package first. This installation guide is based on Fedora 16 and Sphinx 2.0.3-release package.

So, download the packages from here,

  • Sphinx 2.0.3-release download the Source tarball (tar.gz).
  • Or, you can just use wget to download the package.
    wget http://sphinxsearch.com/files/sphinx-2.0.3-release.tar.gz

    Wget Sphinx Package

I thought of installing it in the /usr/local directory. So, navigate to the directory. Then copy the package over there. And then extract it. This will look like the below screenshot.
Extract Sphinx Package

After the extract the package will create a new directory as sphinx-2.0.3-release. I am attaching another screenshot for the reference.
Directory after extract

Now, we will configure the Sphinx. I am writing those as step by step. So you will know which one to follow first.

  1. Step 1. In the first step, we need to configure the Sphinx package. So to do that enter in the sphinx-2.0.3-release directory. Then, run the configuration program as,
    ./configure --prefix=/usr/local/sphinx

    This one will install sphinx in the /usr/local/sphinx directory. There are a lot of configuration options. I am giving a brief idea on those,

    • --prefix, which specifies where to install Sphinx; such as --prefix=/usr/local/sphinx (all of the examples use this prefix)
    • --with-mysql, which specifies where to look for MySQL include and library files, if auto-detection fails.
    • --with-pgsql, which specifies where to look for PostgreSQL include and library files.

    You can follow those ideas on Sphinx Documentations.
    Configuring Sphinx Package

  2. Step 2. This step is basically a troubleshooting step. But its optional. If during configuration you see an error as, ERROR : Cannot find MySQL Include files, then you need to follow this step. I was also got the error. So I had to do some changes to my MySQL installation. This error is thrown just because sphinx searches for the default MySQL connector. Good news for us that the error shows what to do to solve the error. This error can be solved by installing the mysql-devel package. As I got the error the shell showed me this like the screenshot below.
    MySQL Devel Package Error
    So, to solve the error open up the terminal and then install mysql-devel.
    yum install mysql-devel

    Install mysql devel
    Then you will be presented with a new screen where you can see the package size and its dependencies.
    Package Size

  3. Step 3. After mysql-devel installation, again configure the package. Then you will get the success screen as,
    Configuration Done
  4. Step 4. Now, it is time to install the configured package. So to do that again open up the terminal and type,
    make install

    make install sphinx

  5. Step 5. After a lot of logging in the terminal screen you will see the success message that installation is completed successfully.
    Sphinx Install Complete
    Open your file browser window and you will see after navigating to /usr/local, a new directory "sphinx" is created. That has the installed sphinx server.
    Installed Sphinx Directory
  6. Step 6. If you want to see the directory structure for sphinx then go on terminal, and type, "tree" command.
    [root@localhost sphinx]# pwd
    /usr/local/sphinx
    [root@localhost sphinx]# tree
    .
    ├── bin
    │   ├── indexer
    │   ├── indextool
    │   ├── search
    │   ├── searchd
    │   └── spelldump
    ├── etc
    │   ├── example.sql
    │   ├── sphinx.conf.dist
    │   └── sphinx-min.conf.dist
    ├── share
    │   └── man
    │       └── man1
    │           ├── indexer.1
    │           ├── indextool.1
    │           ├── search.1
    │           ├── searchd.1
    │           └── spelldump.1
    └── var
        ├── data
        └── log
     
    8 directories, 13 files
    [root@localhost sphinx]#
In the next tutorial, I will explain how to invoke Sphinx Server in Linux Environment and how to use the Sphinx API with PHP to make a useful Full text search to work.
If you face any problem then please write to me. I will try to solve the problems.

Rate this content: 

Average: 4.1 (7 votes)

Comments

Add new comment