<p>安装xunsearch 出现failed to configure scws和configure: error: zlib.h not found</p><p>今天本地测试tipask,然后需要安装xunsearch,在安装时出现了错误</p><pre class="brush:bash;toolbar:false">[vagrant@askbuy~]$cd/usr/local
[vagrant@askbuylocal]$ls
binetcgamesincludeliblib64libexecsbinsharesrc
[vagrant@askbuylocal]$sudowgethttp://www.xunsearch.com/download/xunsearch-full-latest.tar.bz2
--2017-10-0713:42:05--http://www.xunsearch.com/download/xunsearch-full-latest.tar.bz2
Resolvingwww.xunsearch.com(www.xunsearch.com)...202.75.216.233
Connectingtowww.xunsearch.com(www.xunsearch.com)|202.75.216.233|:80...connected.
HTTPrequestsent,awaitingresponse...200OK
Length:10435852(10.0M)[text/plain]
Savingto:'xunsearch-full-latest.tar.bz2'
100%[====================================================&gt;]10,435,85210.0MB/sin1.0s
2017-10-0713:42:06(10.0MB/s)-'xunsearch-full-latest.tar.bz2'saved[10435852/10435852]
[vagrant@askbuylocal]$sudotar-xjfxunsearch-full-latest.tar.bz2
[vagrant@askbuylocal]$ls
bingamesliblibexecsharexunsearch-full-1.4.10
etcincludelib64sbinsrcxunsearch-full-latest.tar.bz2
[vagrant@askbuylocal]$cdxunsearch-full-1.4.10
[vagrant@askbuyxunsearch-full-1.4.10]$ls
packagesREADME.mdsetup.sh
[vagrant@askbuyxunsearch-full-1.4.10]$sudoshsetup.sh
+==========================================+
|Welcometosetupxunsearch(full)|
|欢迎使用xunsearch(完整版)安装程序|
+------------------------------------------+
|Followtheon-screeninstructionsplease|
|请按照屏幕上的提示操作以完成安装|
+==========================================+
Pleasespecifytheinstallationdirectory</pre><pre class="brush:bash;toolbar:false">请指定安装目录(默认为中括号内的值)
[/usr/local/xunsearch]:
Confirmtheinstallationdirectory
请确认安装目录:/usr/local/xunsearch[Y/n]y
Checkingscws...no
Installingscws(1.2.3)...
Extractingscwspackage...
Configuringscws...
-----
checkingforathread-safemkdir-p.../bin/mkdir-p
checkingforgawk...gawk
checkingwhethermakesets$(MAKE)...yes
checkingwhethermakesupportsnestedvariables...yes
checkingforgcc...no
checkingforcc...no
checkingforcl.exe...no
configure:error:in`/usr/local/xunsearch-full-1.4.10/scws-1.2.3':
configure:error:noacceptableCcompilerfoundin$PATH
See`config.log'formoredetails
-----
ERROR:failedtoconfigurescws,see'setup.log'formoredetail</pre><p>问题原因:是因为没有安装编译器</p><p>解决方案,安装g++</p><p>sudo yum install gcc-c++</code></p><p>Is this ok [y/d/N]: y</code>//这里选择 Y就可以</p><p>看到:Complete!就说明安装成功</p><p>然后再重新执行</p><p>cd xunsearch-full-1.4.10</p><p>sudo sh setup.sh</p><p>结果又出现</p><p>configure: error: zlib.h not found - required for brass, chert and flint (you may need to install the zlib1g-dev or zlib-devel package)</p><p>-----</p><p>ERROR: failed to configure xapian-core-scws, see 'setup.log' for more detail</p><p>问题原因,没有安装 zlib-devel</p><p>解决方法,安装 zled-devl</p><p>sudo yum install zlib-devel</p><p>//中间还会选择Y</p><p>这次安装成功了</p><p>+=================================================+</p><p>| Installation completed successfully, Thanks you |</p><p>| 安装成功,感谢选择和使用 xunsearch |</p><p>+-------------------------------------------------+</p><p>| 说明和注意事项: |</p><p>| 1. 开启/重新开启 xunsearch 服务程序,命令如下: |</p><p>| /usr/local/xunsearch/bin/xs-ctl.sh restart</p><p>| 强烈建议将此命令写入服务器开机脚本中 |</p><p>| |</p><p>| 2. 所有的索引数据将被保存在下面这个目录中: |</p><p>| /usr/local/xunsearch/data</p><p>| 如需要转移到其它目录,请使用软链接。 |</p><p>| |</p><p>| 3. 您现在就可以在我们提供的开发包(SDK)基础上 |</p><p>| 开发您自己的搜索了。 |</p><p>| 目前只支持 PHP 语言,参见下面文档: |</p><p>| /usr/local/xunsearch/sdk/php/README</p><p>+=================================================+</p><p>接下来就执行下面命令:</p><pre class="brush:bash;toolbar:false">cd/usr/local/xunsearch/sdk/php/app
cpdemo.initipask.ini
vitipask.ini</pre><p>加入如下代码:(这段代码来源于很早以前 官方的 整合教程)</p><pre class="brush:bash;toolbar:false">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</pre><p>最后:保存,重启xunsearch;(命令: /usr/local/xunsearch/bin/xs-ctl.sh start)</p><p>然后配置开机启动</p><pre class="brush:bash;toolbar:false">sudovi/etc/rc.d/rc.local//本地服务器才加sudo
/usr/local/search/bin/xs-ctl.shstart//加入这一条命令到启动项
sudochmod+x/etc/rc.d/rc.local//权限</pre><p>如果没有意外,后台就可以启用xunsearch了,到tipask后台开启xunsearch使用吧。</p>