ubuntu 10.04 安装 Coreseek 详细指南

来源:互联网 发布:网络桥架规格 编辑:程序博客网 时间:2024/06/06 05:49

转载出处:http://hi.baidu.com/surendaxiao/item/c68972ddf44420f8ca0c3978

coreseek安装需要预装的软件:

apt-get install make gcc g++ automake libtool mysql-client libmysqlclient15-dev   libxml2-dev libexpat1-dev


系统版本:
Distributor ID: Ubuntu
Description:    Ubuntu 10.04 LTS
Release:        10.04
Codename:       lucid


Linux localhost 2.6.32-21-server #32-Ubuntu SMP Fri Apr 16 09:17:34 UTC 2010 x86_64 GNU/Linux
gcc (Ubuntu 4.4.3-4ubuntu5) 4.4.3

g++ (Ubuntu 4.4.3-4ubuntu5) 4.4.3



-----------------------割-------------------------------------------------------------------------------------

##一、基础安装:(此时尚不支持MySQL,完成第二步数据源支持后就支持)

##完成后:提供xml数据源支持,中文检索支持
##
##download http://www.coreseek.cn/uploads/csft/3.2/coreseek-3.2.14.tar.gz
$ tar xzvf coreseek-3.2.14.tar.gz


$ 请点击仔细查看README.txt


##切换到root用户,确保拥有完整的权限来安装软件
$ su root
##或者
$ sudo root bash
$ su -


$ cd coreseek-3.2.14

##中文测试环境检查:
$  locale
##以下为核心项,locale为zh_CN.UTF-8,就可以正常显示和输入中文;locale设置功能由操作系统自身支持,BSD/Linux均可开启;该功能,不是coreseek提供的!!!
##如果不能正常显示中文,则后面的中文测试部分无法正常进行,但不会影响coreseek的实际功能;
    LANG=zh_CN.UTF-8
   LC_ALL="zh_CN.UTF-8"

##如果显示的不是zh_CN.UTF-8,请参考以下网址进行设置:
##locale设置
##命令行显示中文
##putty显示中文
##SecureCRT显示中文


##确保可以正常显示,否则请检查当前环境的locale配置,以及当前环境或者客户端已设置好支持UTF-8中文字符显示
$ cat testpack/var/test/test.xml


##安装coreseek开发的mmseg,为coreseek提供中文分词功能
$ cd mmseg-3.2.14
##ubuntu环境下,需要使用ACLOCAL_FLAGS="-I /usr/share/aclocal" ./bootstrap
$ ./bootstrap
$ ./configure --prefix=/usr/local/mmseg3
$ make && make install
##如果提示libtool: unrecognized option `--tag=CC' ,请查看libtool问题解决方案
##安装完成后,mmseg使用的词典和配置文件,将自动安装到/usr/local/mmseg3/etc中

##中文分词测试,如果显示不正常,请检查当前环境下的locale和UTF-8中文字符显示设置
$  /usr/local/mmseg3/bin/mmseg -d /usr/local/mmseg3/etc src/t1.txt
    中文/x 分/x 词/x 测试/x 
    中国人/x 上海市/x 

Word Splite took: 1 ms.


##安装coreseek:
$ cd csft-3.2.14
##执行configure,进行编译配置:
$ sh buildconf.sh
$ ./configure --prefix=/usr/local/coreseek --without-python --without-unixodbc --with-mmseg --with-mmseg-includes=/usr/local/mmseg3/include/mmseg/ --with-mmseg-libs=/usr/local/mmseg3/lib/ --without-mysql
##coreseek4.x/sphinx1.x,请将--without-mysql更改为--with-mysql
$ make && make install
##如果提示mysql问题,可以查看MySQL数据源安装说明

##可能遇到的问题:

##如果提示libtool: unrecognized option `--tag=CC' ,请查看libtool问题解决方案

##有的系统下可能出现:expected `;' before ‘CSphTokenizer_UTF8SpaceSeg’,
##或者出现:configure: WARNING: unrecognized options: --with-mmseg, --with-mmseg-includes, --with-mmseg-libs
##是因为你没有进行随后的sh buildconf.sh操作
##生成当前系统对应的编译配置文件
##需要使用以下指令:
$ sh buildconf.sh

## Linux环境下,如遇到pthread问题,请先直接执行以下指令在进行configur:
$ LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib
$ export LD_LIBRARY_PATH


## 如果出现undefined reference to `libiconv'的类似错误,可以按照如下方法处理:
##方法一:(Linux使用)
## 直接执行:export LIBS="-liconv"
##然后make clean,再次configure后,进行编译安装make && make install
## 方法二:
## 首先configure,然后vim src/makefile
## 在其中搜索lexpat,在其后加上 -liconv
## 修改后该行应该为:-lexpat -liconv -L/usr/local/lib
## 然后再次make && make install
## 方法三:
## 首先configure,然后vim config/config.h
## 在其中搜索USE_LIBICONV,将其后的1修改为0
## 然后再次make && make install



##配置测试,测试是否可以正确运行
$ /usr/local/coreseek/bin/indexer -c /usr/local/coreseek/etc/sphinx-min.conf.dist
##以下为正常测试时的提示信息:
    Coreseek Fulltext 3.2 [ Sphinx 0.9.9-release (r2117)]
    Copyright (c) 2007-2010,
    Beijing Choice Software Technologies Inc (http://www.coreseek.com)

     using config file '/usr/local/coreseek/etc/sphinx-min.conf.dist'...
    total 0 reads, 0.000 sec, 0.0 kb/call avg, 0.0 msec/call avg
    total 0 writes, 0.000 sec, 0.0 kb/call avg, 0.0 msec/call avg
##
##csft-4.0版显示:ERROR: nothing to do.
##
##至此,coreseek基础环境可以正常安装,我们可以开始后续的工作啦。
##注意:基础环境仅支持xml数据源;如需要mysql或者python数据源,请继续按照下面的步骤操作!!!



---------------------------------------------------------------------------------------------------------------------------



##二、数据源支持:支持MySQL数据源


##完成后:提供mysql数据源支持和xml数据源支持
##系统需要安装相关的基础依赖库,否则无法支持对应的功能
##freebsd6/7/8:
$ pkg_add -r mysql50-client libxml2 expat

##centos5.4/5.5: fedora12/13 : rhel5.5
$ yum install mysql-devel libxml2-devel expat-devel

##debian5 : ubuntu9/10:
$ apt-get install mysql-client libmysqlclient15-dev   libxml2-dev libexpat1-dev

##gentoo10:
##安装环境自带了libmysqlclient libxml2 libexpat

##opensuse10/11:
##yast安装 libmysqlclient-devel libxml2 libxml2-devel libexpat-devel

##slackware13.0/13.1:
$ slapt-get --install mysql libxml2 expat

##archlinux-2010:
$ pacman -S libmysqlclient   libxml2 expat

##重新编译安装coreseek,以支持mysql数据源和xml数据源
$ cd csft-3.2.14
$ make clean
$ ./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
##以上configure参数请正确拷贝,不要遗漏或者随意修改
$ make && make install

##如果出现错误提示:“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,执行后,重新编译安装


-----------------------------------------------------------------------------------------------------------------------------


##三、coreseek中文全文检索测试

$ cd testpack
$  /usr/local/coreseek/bin/indexer -c etc/csft.conf
##以下为正常情况下的提示信息:
    Coreseek Fulltext 3.2 [ Sphinx 0.9.9-release (r2117)]
    Copyright (c) 2007-2010,
    Beijing Choice Software Technologies Inc (http://www.coreseek.com)

     using config file 'etc/csft.conf'...
    total 0 reads, 0.000 sec, 0.0 kb/call avg, 0.0 msec/call avg
    total 0 writes, 0.000 sec, 0.0 kb/call avg, 0.0 msec/call avg
##
##csft-4.0版显示:ERROR: nothing to do.
##
$  /usr/local/coreseek/bin/indexer -c etc/csft.conf --all
##以下为正常索引全部数据时的提示信息:(csft-4.0版类似)
    Coreseek Fulltext 3.2 [ Sphinx 0.9.9-release (r2117)]
    Copyright (c) 2007-2010,
    Beijing Choice Software Technologies Inc (http://www.coreseek.com)

     using config file 'etc/csft.conf'...
    indexing index 'xml'...
    collected 3 docs, 0.0 MB
    sorted 0.0 Mhits, 100.0% done
    total 3 docs, 7585 bytes
    total 0.075 sec, 101043 bytes/sec, 39.96 docs/sec
    total 2 reads, 0.000 sec, 5.6 kb/call avg, 0.0 msec/call avg
    total 7 writes, 0.000 sec, 3.9 kb/call avg, 0.0 msec/call avg

$  /usr/local/coreseek/bin/indexer -c etc/csft.conf xml
##以下为正常索引指定数据时的提示信息:(csft-4.0版类似)
    Coreseek Fulltext 3.2 [ Sphinx 0.9.9-release (r2117)]
    Copyright (c) 2007-2010,
    Beijing Choice Software Technologies Inc (http://www.coreseek.com)

     using config file 'etc/csft.conf'...
    indexing index 'xml'...
    collected 3 docs, 0.0 MB
    sorted 0.0 Mhits, 100.0% done
    total 3 docs, 7585 bytes
    total 0.069 sec, 109614 bytes/sec, 43.35 docs/sec
    total 2 reads, 0.000 sec, 5.6 kb/call avg, 0.0 msec/call avg
    total 7 writes, 0.000 sec, 3.9 kb/call avg, 0.0 msec/call avg

$  /usr/local/coreseek/bin/search -c etc/csft.conf
##以下为正常测试搜索时的提示信息:(csft-4.0版类似)
    Coreseek Fulltext 3.2 [ Sphinx 0.9.9-release (r2117)]
    Copyright (c) 2007-2010,
    Beijing Choice Software Technologies Inc (http://www.coreseek.com)

     using config file 'etc/csft.conf'...
    index 'xml': query '': returned 3 matches of 3 total in 0.093 sec

    displaying matches:
    1. document=1, weight=1, published=Thu Apr  1 22:20:07 2010, author_id=1
    2. document=2, weight=1, published=Thu Apr  1 23:25:48 2010, author_id=1
    3. document=3, weight=1, published=Thu Apr  1 12:01:00 2010, author_id=2

    words:


$  /usr/local/coreseek/bin/search -c etc/csft.conf -a Twittter和Opera都提供了搜索服务
##以下为正常测试搜索关键词时的提示信息:(csft-4.0版类似)
    Coreseek Fulltext 3.2 [ Sphinx 0.9.9-release (r2117)]
    Copyright (c) 2007-2010,
    Beijing Choice Software Technologies Inc (http://www.coreseek.com)

     using config file 'etc/csft.conf'...
    index 'xml': query 'Twittter和Opera都提供了搜索服务 ': returned 3 matches of 3 total in 0.038 sec

    displaying matches:
    1. document=3, weight=24, published=Thu Apr  1 12:01:00 2010, author_id=2
    2. document=1, weight=4, published=Thu Apr  1 22:20:07 2010, author_id=1
    3. document=2, weight=3, published=Thu Apr  1 23:25:48 2010, author_id=1

    words:
    1. 'twittter': 1 documents, 3 hits
    2. '和': 3 documents, 15 hits
    3. 'opera': 1 documents, 25 hits
    4. '都': 2 documents, 4 hits
    5. '提供': 0 documents, 0 hits
    6. '了': 3 documents, 18 hits
    7. '搜索': 2 documents, 5 hits
    8. '服务': 1 documents, 1 hits

$  /usr/local/coreseek/bin/searchd -c etc/csft.conf
##以下为正常开启搜索服务时的提示信息:(csft-4.0版类似)
    Coreseek Fulltext 3.2 [ Sphinx 0.9.9-release (r2117)]
    Copyright (c) 2007-2010,
    Beijing Choice Software Technologies Inc (http://www.coreseek.com)

    using config file 'etc/csft.conf'...
    listening on all interfaces, port=9312
##如要停止搜索服务,请使用/usr/local/coreseek/bin/searchd -c etc/csft.conf --stop
##如要已启动服务,要更新索引,请使用/usr/local/coreseek/bin/indexer -c etc/csft.conf --all --rotate

##然后,请参考csft-3.2.14下api目录中的相关文件,使用PHP、Python、Ruby、Java来测试搜索服务;也可以前往< ahref="/products-install/step_by_step/">搜索服务建立三步曲,查看第三步使用PHP测试。

##四、继续
##通过以上步骤,coreseek已经安装测试完成,可以提供正常的xml数据源索引以及提供对应的搜索服务了
##下一步工作,请查看手册,准备好mysql数据信息,以及进行mysql数据源的测试,并在您的应用中调用搜索服务;mysql数据源的配置可参考testpack/etc/csft_mysql.conf文件

    中文分词核心配置
    Coreseek 3.2/Sphinx(0.9.9)中文手册 



##如有问题,请前往:http://www.coreseek.cn/forum/ 提问,我们将在第一时间解答
##如果您需要获得专业的支持,请前往:http://www.coreseek.cn/contact/ 与我们取得联系,洽谈支持与合作事宜

##祝您使用快乐!!

原创粉丝点击