本文默认已经安装好 lamp

  1. 安装软件
  2. View Code SHELL
    yum install gcc
     
    yum install gcc-c++
     
    yum install python
     
    yum install python-devel
     
    yum install gtk+
     
    yum install libtool
     
    yum install automake
    yum install autoconf
     
    yum install mysql-devel

下载mmseg

wget http://www.coreseek.cn/uploads/sources/mmseg3_0b3.tar.gz

下载coreseek
wget http://www.coreseek.cn/uploads/sources/csft3.1b3.tar.gz

解压缩两个文件包
tar -xzvf mmseg3_0b3.tar.gz
tar -xzvf csft3.1b3.tar.gz

编译mmseg
cd /mmseg.3_0b3
./configure –prefix=/usr/local/mmseg
make
make install

注意:如果在这一步出错,且出错提示为:css/UnigramCorpusReader.cpp:89: error: ’strncmp’ was not declared in this scope
则需手工编辑.src/css目录下UnigramCorpusReader.cpp 文件,在其第一行加上

#include <string.h>
然后执行make clean 再重新 make,make install即可通过

在这一步安装完了后,将会在 /usr/local 下产生 mmseg目录,
手工修改 /usr/local/mmseg/include/mmseg/freelist.h
vi   /usr/local/mmseg/include/mmseg/freelist.h
在上面添加
#include <string.h>

编译coreseek
cd  /opt/software/csft3.1b3/
到这里都一切正常;下面就开始可能有问题出现
第一configure

./configure –prefix=/usr/local/coreseek –with-python –with-mysql –with-mmseg-includes=/usr/local/mmseg/include/mmseg –with-mmseg-libs=/usr/local/mmseg/lib/

make

make install

可能的错误一:

pydatasource.cpp:742: 错误:从类型 ‘const char*’ 到类型 ‘char*’ 的转换无效
pydatasource.cpp:742: 错误:  初始化实参 2,属于 ‘PyObject* PyObject_GetAttrString(PyObject*, char*)’
make[2]: *** [pydatasource.o] 错误 1
make[2]: Leaving directory `/opt/csft3.1b3/src’
make[1]: *** [all] 错误 2
make[1]: Leaving directory `/opt/csft3.1b3/src’
make: *** [all-recursive] 错误 1

解决办法:yum install python-devel  或者 去了–with-python

可能错误二:

sphinxutils.cpp:793: error: cannot convert ‘int*’ to ‘Py_ssize_t*’ for argument ‘2’ to ‘int PyDict_Next(PyObject*, Py_ssize_t*, PyObject**, PyObject**)’
sphinxutils.cpp:802: warning: unused variable ‘nRet’
make[2]: *** [sphinxutils.o] 错误 1
make[2]:正在离开目录 `/home/syu/sphinx/csft3_0b4/src’
make[1]: *** [all] 错误 2
make[1]:正在离开目录 `/home/syu/sphinx/csft3_0b4/src’
make: *** [all-recursive] 错误 1

解决办法:手工打开 src目录下的 sphinxutils.cpp 修改第789行左右int pos = 0; 修改为   Py_ssize_t pos = 0;

执行make clean 重新make & make install 即可

此步安装完成后,将在/usr/local/下生成 coreseek 目录.

  • sphinx.conf配置
  • 创建目录

    mkdir /usr/local/coreseek/log
    mkdir /usr/local/coreseek/pid

    mkdir /usr/local/coreseek/data/dict

    编辑sphinx.conf

    View Code SHELL
    cp /usr/local/coreseek/etc/sphinx.conf.dist  /usr/local/coreseek/etc/sphinx.conf
    vi /usr/local/coreseek/etc/sphinx.conf
    /usr/local/coreseek/bin/searchd --config /usr/local/coreseek/etc/sphinx.conf --all
    /usr/local/coreseek/bin/searchd --config /usr/local/coreseek/etc/sphinx.conf

    出处: 马丁博客http://www.blags.org/

    本文链接地址: http://www.blags.org/centos-install-sphinx-notes/

    原创文章,转载请注明出处,否则视为侵权。