coreseek4.1以及php sphinx安装

如下是我实战sphinx的心得,写下来与你们分享:php

 

一,下载coreseek:mysql

1
2
3
$ wget http: //www .coreseek.cn /uploads/csft/4 .0 /coreseek-4 .1-beta. tar .gz
tar  xzvf coreseek-4.1-beta. tar .gz
cd  coreseek-4.1-beta


##前提:需提早安装操做系统基础开发库及mysql依赖库以支持mysql数据源和xml数据源

二,安装mmseglinux

1
2
3
4
5
cd  mmseg-3.2.14
$ . /bootstrap  #输出的warning信息能够忽略,若是出现error则须要解决
$ . /configure  --prefix= /usr/local/mmseg3
make  &&  make  install
cd  ..


三,安装coreseeksql

1
2
3
4
5
6
7
8
9
10
11
12
13
cd  csft-3.2.14 或者  cd  csft-4.0.1 或者  cd  csft-4.1
$ sh buildconf.sh  #输出的warning信息能够忽略,若是出现error则须要解决
$ . /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
    
##若是提示mysql问题,要安装下mysql的开发库
##$ yum install mysql-devel libxml2-devel expat-devel
    
##而后执行下上面的configure##若是出现错误提示:“ERROR: cannot find MySQL include files.......To disable MySQL support, use --without-mysql option.“,可按照以下方法处理:
##请找到头文件mysql.h所在的目录,通常是/usr/local/mysql/include,请替换为实际的
##请找到库文件libmysqlclient.a所在的目录,通常是/usr/local/mysql/lib,请替换为实际的
##configure参数加上:--with-mysql-includes=/usr/local/mysql/include --with-mysql-libs=/usr/local/mysql/lib,执行后,从新编译安装
make  &&  make  install
cd  ..


四,安装libsphinxclientbootstrap

1
2
3
4
cd  testpack /api/libsphinxclient
$ . /configure
make  &&  make  install
cd  ../../../


五,测试mmseg分词,coreseek搜索(须要预先设置好字符集为zh_CN.UTF-8,确保正确显示中文)api

1
2
3
4
5
cd  testpack
cat  var /test/test .xml  #此时应该正确显示中文
/usr/local/mmseg3/bin/mmseg  -d  /usr/local/mmseg3/etc  var /test/test .xml
/usr/local/coreseek/bin/indexer  -c etc /csft .conf --all
/usr/local/coreseek/bin/search  -c etc /csft .conf 网络搜索


六,安装php扩展sphinx
首先检查下是否是安装phpize,bash

1
2
3
4
5
6
7
8
9
10
$ phpize - v
##若是显示一些版本信息,证实安装成功,不然须要安装php-devel
##$ yum install php-devel
##而后下载sphinx扩展
$ wget http: //pecl .php.net /get/sphinx-1 .0.4.tgz
tar  xzvf sphinx-1.0.4.tgz
cd  sphinx-1.0.4
$ phpize
$ . /configure
make  &&  make  install

##成功的安装后自动将建立 extname.so并放置于PHP 的扩展库目录中。
##须要调整php.ini,加入 extension=extname.so这一行以后才能使用此扩展库。网络

1
$ php -m |  grep  sphinx

##若是出现sphinx的扩展,证实安装成功测试

 

七,将sphinx deamon加入rc.local开机自动启动ui

1
2
cp /usr/local/coreseek/etc/sphinx .conf.dist  /usr/local/coreseek/etc/sphinx .conf 
vi  /etc/rc . local

加入以下脚本

1
/usr/local/coreseek/bin/search  -c  /usr/local/coreseek/etc/sphinx .conf

 

八,将sphinx的配置目录的写权限开放(可选)

1
chmod  a+w  /usr/local/coreseek/etc/sphinx .conf
相关文章
相关标签/搜索