三十而立

tipask下的文章

今天本地测试tipask,然后需要安装xunsearch,在安装时出现了错误

[vagrant@askbuy ~]$ cd /usr/local
[vagrant@askbuy local]$ ls
bin  etc  games  include  lib  lib64  libexec  sbin  share  src
[vagrant@askbuy local]$ sudo wget http://www.xunsearch.com/download/xunsearch-full-latest.tar .bz2
--2017-10-07 13:42:05--  http://www.xunsearch.com/download/xunsearch-full-latest.tar.bz2
Resolving www.xunsearch.com (www.xunsearch.com)... 202.75.216.233
Connecting to www.xunsearch.com (www.xunsearch.com)|202.75.216.233|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 10435852 (10.0M) [text/plain]
Saving to: ‘xunsearch-full-latest.tar.bz2’
100%[====================================================>] 10,435,852  10.0MB/s   in 1.0s
2017-10-07 13:42:06 (10.0 MB/s) - ‘xunsearch-full-latest.tar.bz2’ saved [10435852/10435852]
[vagrant@askbuy local]$ sudo tar -xjf xunsearch-full-latest.tar.bz2
[vagrant@askbuy local]$ ls
bin  games    lib    libexec  share  xunsearch-full-1.4.10
etc  include  lib64  sbin     src    xunsearch-full-latest.tar.bz2
[vagrant@askbuy local]$ cd xunsearch-full-1.4.10
[vagrant@askbuy xunsearch-full-1.4.10]$ ls
packages  README.md  setup.sh
[vagrant@askbuy xunsearch-full-1.4.10]$ sudo sh setup.sh
+==========================================+
| Welcome to setup xunsearch(full)         |
| 欢迎使用 xunsearch (完整版) 安装程序     |
+------------------------------------------+
| Follow the on-screen instructions please |
| 请按照屏幕上的提示操作以完成安装         |
+==========================================+
Please specify the installation directory
请指定安装目录 (默认为中括号内的值)
[/usr/local/xunsearch]:
Confirm the installation directory
请确认安装目录:/usr/local/xunsearch [Y/n]y
Checking scws ... no
Installing scws (1.2.3) ...
Extracting scws package ...
Configuring scws ...
-----
checking for a thread-safe mkdir -p... /bin/mkdir -p
checking for gawk... gawk
checking whether make sets $(MAKE)... yes
checking whether make supports nested variables... yes
checking for gcc... no
checking for cc... no
checking for cl.exe... no
configure: error: in `/usr/local/xunsearch-full-1.4.10/scws-1.2.3':
configure: error: no acceptable C compiler found in $PATH
See `config.log' for more details
-----
ERROR: failed to configure scws, see 'setup.log' for more detail

问题原因:是因为没有安装编译器
解决方案,安装g++

sudo yum install gcc-c++</code>
Is this ok [y/d/N]: y</code>//这里选择 Y就可以

看到:Complete!就说明安装成功

然后再重新执行

cd xunsearch-full-1.4.10
sudo sh setup.sh

结果又出现

configure: error: zlib.h not found - required for brass, chert and flint (you may need to install the zlib1g-dev or zlib-devel package)
-----
ERROR: failed to configure xapian-core-scws, see 'setup.log' for more detail

问题原因,没有安装 zlib-devel
解决方法,安装 zled-devl

sudo yum install zlib-devel
//中间还会选择Y

这次安装成功了

+=================================================+
| Installation completed successfully, Thanks you |
| 安装成功,感谢选择和使用 xunsearch              |
+-------------------------------------------------+
| 说明和注意事项:                                |
| 1. 开启/重新开启 xunsearch 服务程序,命令如下: |
|    /usr/local/xunsearch/bin/xs-ctl.sh restart
|    强烈建议将此命令写入服务器开机脚本中         |
|                                                 |
| 2. 所有的索引数据将被保存在下面这个目录中:     |
|    /usr/local/xunsearch/data
|    如需要转移到其它目录,请使用软链接。         |
|                                                 |
| 3. 您现在就可以在我们提供的开发包(SDK)基础上    |
|    开发您自己的搜索了。                         |
|    目前只支持 PHP 语言,参见下面文档:          |
|    /usr/local/xunsearch/sdk/php/README
+=================================================+

接下来就执行下面命令:

cd /usr/local/xunsearch/sdk/php/app
cp demo.ini tipask.ini
vi tipask.ini

加入如下代码:(这段代码来源于很早以前 官方的 整合教程)

project.name = tipask
project.default_charset = utf-8
server.index = 8383
server.search = 8384
[id]
type = id
[cid]
type = numeric
[cid1]
type = numeric
[cid2]
type = numeric
[cid3]
type = numeric
[author]

[authorid]
type = numeric

[answers]
type = numeric

[status]
type = numeric

[time]
type = numeric

[title]
type = title

[description]
type = body

最后:保存,重启xunsearch;(命令: /usr/local/xunsearch/bin/xs-ctl.sh start

然后配置开机启动

sudo vi /etc/rc.d/rc.local   //本地服务器才加sudo
/usr/local/search/bin/xs-ctl.sh start   // 加入这一条命令到启动项
sudo chmod +x /etc/rc.d/rc.local   //权限

如果没有意外,后台就可以启用xunsearch了,到tipask后台开启xunsearch使用吧。