php linux sphinx 安装

索引服务器搭建

 

所需要的软件:

pythonPython-2.5.tar.bz2

mmsegmmseg-3.1.tar.tar

mysqlmysql-5.0.22.tar.gz

csftcsft-3.1.tar.tar

libiconvlibiconv-1.13.1.tar.tar

安装Python

1.# bzip2 -d Python-2.5.tar.bz2

2.# tar -xvf Python-2.5.tar

3.#cd Python-2.5.tar

4.#./configure --prefix=/usr/local/python

5.#make && make install

 

 

安装mmseg

1.#tar -zxvf mmseg-3.1.tar.tar

2.#cd mmseg-3.1

3.#./configure --prefix=/usr/local/mmseg

4.#make && make install

 

 

安装csft

1.#tar –zxvf csft-3.1.tar.tar

2.#cd csft-3.1

3.# ./configure --prefix=/usr/local/csft --with-mysql=/usr/local/mysql --with-mysql-includes=/usr/local/mysql/include/mysql --with-mysql-libs=/usr/local/mysql/lib/mysql --with-mmseg-includes=/usr/local/mmseg/include/mmseg --with-mmseg-libs=/usr/local/mmseg/lib --with-mmseg

4.#make && make install

 

 

安装libiconv

可以暂时跳过这一步,如果在安装csft时,编译时出现找不到libiconv,再来进行安装。

1.#tar –zxvf libiconv-1.13.1.tar.tar

2.#cd libiconv-1.13.1

3.#./configure --prefix=/user/local/libiconv

4.#make && make install

 

安装mysql

1.#groupadd mysql

2.#useradd –g mysql mysql

3.#tar –zxvf mysql-5.0.22.tar.gz

4.#cd mysql-5.0.22

5.#./configure --prefix=/usr/local/mysql --with-mysqld-user=mysql --without-debug --with-big-tables --with-extra-charsets=all --with-pthread --enable-static --enable-thread-safe-client --with-client-ldflags=-all-static --with-mysqld-ldflags=-all-static --enable-assembler --without-isam --without-innodb --without-ndb-debug

6.#make && make install

7.#chmod +w /usr/local/mysql

8.#chown –R mysql:mysql /usr/local/mysql

9.#cp support-files/my-medium.cnf /usr/local/mysql/my.cnf

 

附:以下为附加步骤,如果你想在这台服务器上运行MySQL数据库,则执行以下两步。如果你只是希望让PHP支持MySQL扩展库,能够连接其他服务器上的MySQL数据库,那么,以下两步无需执行。
、以mysql用户帐号的身份建立数据表:

/usr/local/ mysql/bin/mysql_install_db --defaults-file=/usr/local/mysql/my.cnf --basedir=/usr/local/mysql --datadir=/usr/local/mysql/data --user=mysql --pid-file=/usr/local/mysql/mysql.pid --skip-locking --port=3306 --socket=/tmp/mysql.sock



、启动MySQL(最后的&表示在后台运行)

/bin/sh /usr/local/mysql/bin/mysqld_safe --defaults-file=/usr/local/mysql/my.cnf &

 

mysqld每次开机自动启动:

# cp -r support-files/mysql.server /etc/init.d/mysql

#cd /etc/rc.d/init.d
#chmod +x mysql
#chkconfig --del mysql
#chkconfig --add mysql

 

 

 

安装csft

1.#tar –zxvf csft-3.1.tar.tar

2.#cd csft-3.1

3.# ./configure --prefix=/opt/webserver/sphinx/csft --with-mysql=/opt/webserver/mysql --with-mysql-includes=/opt/webserver/mysql/include/mysql --with-mysql-libs=/opt/webserver/mysql/lib/mysql/ --with-mmseg-includes=/opt/webserver/sphinx/mmseg/include/mmseg --with-mmseg-libs=/opt/webserver/sphinx/mmseg/lib --with-mmseg

4.#make && make install

 

 

安装运行csft时出现的问题,及解决办法

 

问题1:编译时出现找不到libiconv

解决办法:

(1)       configure之后,修改src下的makefile文件,在LIBS这一行的后面添加-liconv,如下所示:LIBS = -lm -lexpat -L/usr/local/lib –liconv

(2)       make clean

(3)       make

(4)       make install

 

 

问题2:建索引时出现./indexer:error while loading shared libraries: libmysqlclient.so.16: cannot open shared object file: No such file or directory

解决办法:

(1)       ln -s /opt/webserver/mysql/lib/mysql/libmysqlclient.so.16 /usr/lib/libmysqlclient.so.16

 

 

问题3:建索引时出现./indexer: error while loading shared libraries: libiconv.so.2: cannot open shared object file: No such file or directory

解决办法:

1ln –s /opt/webserver/sphinx/libiconv/lib/libiconv.so.2 /usr/lib/libiconv.so.2

 

 

问题4:建索引时出现iniparser: cannot open/opt/webserver/sphinx/csft/var/data/dict/mmseg.ini

解决办法:

(1)       dict文件夹下新建文件mmseg.ini

(2)       输入内容如下:

 

merge_number_and_ascii=1;
number_and_ascii_joint=-;
compress_space=0;
seperate_number_ascii=1;

以上解释如下:

/*
merge_number_and_ascii:
字母和数字连续出现是非切分

number_and_ascii_joint:
连接数字和字母可用的符号,如'-' '.'
compress_space
:暂时无效
seperate_number_ascii
:是否拆分数字,如 1988 -> 1/x 9/x 8/x 8/x
*/

 

阅读更多
上一篇J2me socket
下一篇php linux sphinx 命令和建立索引
想对作者说点什么? 我来说一句

没有更多推荐了,返回首页

关闭
关闭
关闭