CentOS 6.3安装Coreseek/Sphinx简要步骤及错误解决方法

安装过程

0.检测中文环境

locale

如果是下面的结果,则进行下一步:

LANG=zh_CN.UTF-8
LC_ALL=zh_CN.UTF-8

否则执行下面命令:

export LANG=zh_CN.UTF-8
export LC_ALL=zh_CN.UTF-8

1.安装依赖

yum install make gcc g++ gcc-c++ libtool autoconf automake imake mysql-devel libxml2-devel expat-devel

2.下载并解压

wget http://www.coreseek.cn/uploads/csft/3.2/coreseek-3.2.14.tar.gz
tar xzvf coreseek-3.2.14.tar.gz
cd coreseek-3.2.14

3.安装mmseg:

cd mmseg-3.2.14
./bootstrap
./configure --prefix=/usr/local/mmseg3
make && make install
cd ..

4.安装coreseek

cd csft-3.2.14
sh buildconf.sh
./configure --prefix=/usr/local/coreseek --without-unixodbc --with-mmseg --with-mmseg-includes=/usr/local/mmseg3/include/mmseg/ --with-mmseg-libs=/usr/local/mmseg3/lib/ --with-mysql
make && make install
cd ..

5.配置测试

/usr/local/coreseek/bin/indexer -c /usr/local/coreseek/etc/sphinx-min.conf.dist

错误解决

1.步骤4编译的时候发生错误

collect2: ld 返回 1 
make[2]: *** [indexer] 错误 1 
make[2]: Leaving directory `/setup/coreseek-3.2.14/csft-3.2.14/src' 
make[1]: *** [all] 错误 2 
make[1]: Leaving directory `/setup/coreseek-3.2.14/csft-3.2.14/src' 
make: *** [all-recursive] 错误 1

解决方法

vim ./src/MakeFile

搜索“LIBS = -lm -lexpat -L/usr/local/lib”,改成

LIBS = -lm -lexpat -liconv -L/usr/local/lib

然后重新编译

make clean
make && make install

2.步骤5的时候发生错误

error while loading shared libraries: libiconv.so.2: cannot open shared object file: No such file or directory

解决方法

echo /usr/lib >> /etc/ld.so.conf
ldconfig