准备源码包:sphinx-2.1.1;Sphinx的PHP模块:sphinx-1.1.0;结合中文分词的sphinx:coreseek-3.2.14
安装sphinx
上传sphinx源码包到服务器,解压并安装:tar -zxvf sphinx-2.1.1 cd sphinx-2.1.1 ./configure --prefix=/usr/local/sphinx --with-mysql=/usr make && make install;
这里配置./configure的时候遇到问题:configure:error:invalid MySQL root directore 'usr/bin';neither bin/mysql_config,nor include/ and lib/ were found where。
因为之前mysql是一键安装的,所以安装目录分散在多个地方,不知道--with应该写哪一个目录。试了所以目录都没有作用,百度查找答案发现是少了libmysqlclient-dev,
于是安装libmysqlclient-dev;此时又有报错:提示没有源,运行命令更新源:apt-get update;然后继续执行:apt-get install libmysqlclient-dev
继续执行./configure成功然后make && make install
将sphinx安装为PHP模块
安装为模块之前先得安装libsphinxclient。将coreseek-3.2.14源码包上传到服务器解压tar-zxvf coreseek-3.2.14