centos libxml,centos官网
大家好,关于centos libxml很多朋友都还不太明白,今天小编就来为大家分享关于centos官网的知识,希望对各位有所帮助!
centos下coreseek安装及使用方法
Coreseek中文全文检索引擎
Coreseek是一款中文全文检索/搜索软件,以GPLv2许可协议开源发布,基于Sphinx研发并独立发布,专攻中文搜索和信息处理领域,适用于行业/垂直搜索、论坛/站内搜索、数据库搜索、文档/文献检索、信息检索、数据挖掘等应用场景,用户可以免费下载使用
一,coreseek简介
官方
Coreseek是一款中文全文检索/搜索软件,以GPLv2许可协议开源发布,基于Sphinx研发并独立发布,专攻中文搜索和信息处理领域,适用于行业/垂直搜索、论坛/站内搜索、数据库搜索、文档/文献检索、信息检索、数据挖掘等应用场景。商业使用(例如,嵌入到其他程序中)需要获得商业授权。
Coreseek是一个支持中文的全文搜索引擎,意图为其他应用提供高速、低空间占用、高相关度结果的中文全文搜索能力。CoreSeek可以非常容易的与SQL数据库和脚本语言集成。
在Sphinx发行版本中提供的原生搜索API支持PHP、Python、Perl、Rudy和Java。搜索API非常轻量化,可以在几个小时之内移植到新的语言上。第三方API接口和插件提供了对Perl、C#、Haskell、Ruby-on-Rails支持,以及对其他可能的语言或者框架的支持。
版本介绍
Coreseek 3.2稳定版
Coreseek 4.1测式版
Coreseek 5最新版
二,安装Coreseek
注:本文是以centos+mysql做为数据源支持为基础的coreseek安装教程.mysql安装略过.
1,下载coreseek 3.2稳定版,下载其他版本请去官网自行下载
cd/usr/local/src/
wget
tar xzvf coreseek-3.2.14.tar.gz
cd coreseek-3.2.14
安装coreseek之前需要先安装需要预装的软件:yum install make gcc g++ gcc-c++ libtool autoconf automake imake mysql-devel libxml2-devel expat-devel(注:这是centos 64位
其他系统请参考
2,安装mmseg
$ cd mmseg-3.2.14
$./bootstrap#输出的warning信息可以忽略,如果出现error则需要解决
$./configure--prefix=/usr/local/mmseg3
$ make make install
$ cd..
##如果提示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.
3,安装coreseek
$ cd csft-3.2.14
##执行configure,进行编译配置:
$ sh buildconf.sh
$./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 includes file则使用下面的编译命令
./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-includes=/alidata/server/mysql/include/--with-mysql-libs=/alidata/server/mysql/bin/
make make install
4,测式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()
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()
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()
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()
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()
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()
using config file'etc/csft.conf'...
listening on all interfaces, port=9312
三,配置coreseek支持mysql数据源
1,配置csft_mysql.conf文件
复制mysql配置文件到coreseek安装目录etc/下(比如/usr/local/coreseek/etc/)
cp/usr/local/src/coreseek-3.2.14/testpack/etc/csft_mysql.conf/usr/local/coreseek/etc/
cd/usr/local/coreseek/etc/
vi csft_mysql.conf
下面加红部分是需要你自己配置的
官方参考文档:数据源配置:mysql数据源
其他数据源请参考官方
==============================================================
#源定义
sourcephperz
{
type= mysql
sql_host=localhost
sql_user=root
sql_pass=xxxx
sql_db=phperz
sql_port= 3306
sql_query_pre= SET NAMES utf8
sql_query=SELECT id,title,descs,status from article
#sql_query第一列id需为整数
#title、content作为字符串/文本字段,被全文索引
sql_attr_uint=status#从SQL读取到的值必须为整数
#sql_attr_timestamp= date_added#从SQL读取到的值必须为整数,作为时间属性
sql_query_info_pre= SET NAMES utf8#命令行查询时,设置正确的字符集
sql_query_info=SELECT* FROM article WHERE id=$id#命令行查询时,从数据库读取原始数据信息
}
#index定义
indexphperz
{
source=phperz#对应的source名称
path=/usr/local/coreseek/var/data/phperz#请修改为实际使用的绝对路径,例如:/usr/local/coreseek/var/...
docinfo= extern
mlock= 0
morphology= none
min_word_len= 1
html_strip= 0
#中文分词配置,详情请查看:
charset_dictpath=/usr/local/mmseg3/etc/#BSD、Linux环境下设置,/符号结尾
#charset_dictpath= etc/#Windows环境下设置,/符号结尾,最好给出绝对路径,例如:C:/usr/local/coreseek/etc/...
charset_type= zh_cn.utf-8
}
#全局index定义
indexer
{
mem_limit= 128M
}
#searchd服务定义
searchd
{
listen= 9312
read_timeout= 5
max_children= 30
max_matches= 1000
seamless_rotate= 0
preopen_indexes= 0
unlink_old= 1
pid_file=/usr/local/coreseek/var/log/searchd_mysql.pid#请修改为实际使用的绝对路径,例如:/usr/local/coreseek/var/...
log=/usr/local/coreseek/var/log/searchd_mysql.log#请修改为实际使用的绝对路径,例如:/usr/local/coreseek/var/...
query_log=/usr/local/coreseek/var/log/query_mysql.log#请修改为实际使用的绝对路径,例如:/usr/local/coreseek/var/...
}
==============================================================
2,建立索引
路经部分需要改成你自己的地址
/usr/local/coreseek/bin/indexer-c/usr/local/coreseek/etc/csft_mysql.conf--all
可能出现的错误
ERROR: index'phperz': sql_connect: Can't connect to local MySQL server through socket'/var/lib/mysql/mysql.sock'(2)(DSN=mysql://root:***@localhost:3306/phperz).
这是因为mysql的sock文件路经不正确导致的.
确认一下你的mysql.sock路经,建立一个软连接,比如
ln-s/tmp/mysql.sock/var/lib/mysql/mysql.sock
四,coreseek+php使用方式
复制安装止录下的/usr/local/src/coreseek-3.2.14/testpack/api/sphinxapi.php文件到你的项目里
你的程序里include sphinxapi.php
php使用方法见/usr/local/src/coreseek-3.2.14/testpack/api/test.php
另附我的使用方法:
===============================================================
$wd= trim($_GET['wd']);
include_once(JF_PATH./config/sph_cfg.php);
include_once(JF_PATH./include/sphinxapi.php);
$cl= new SphinxClient();
$cl-SetServer(SPH_SERVER_HOST, SPH_SERVER_POST);
$cl-SetConnectTimeout(3);
$cl-SetArrayResult(true);
$cl-SetMatchMode(1);
$cl-SetFilter(status, array(1));
$cl-SetLimits(0, 10);
$res=$cl-Query($wd, phperz_www);
if($res['matches']){
$rownum=$res['total'];
foreach($res['matches'] as$k=$v){
$re=$this-db-get_one(select* from article where id=.$v['id']);
if(!empty($re)){
$list[]=$re;
}
}
}
print_r($list);
===============================================================
五,coreseek日常维护
启动
/usr/local/coreseek/bin/searchd-c/usr/local/coreseek/etc/csft_mysql.conf
停止
/usr/local/coreseek/bin/searchd-c/usr/local/coreseek/etc/csft_mysql.conf--stop
建立索引
/usr/local/coreseek/bin/indexer-c/usr/local/coreseek/etc/csft_mysql.conf--all
重建索引
/usr/local/coreseek/bin/indexer-c/usr/local/coreseek/etc/csft_mysql.conf--all--rotate
你需要把启动命令加到开机自启动里
把重建索引命令加到计划任务里每天执行
本文为phperz原创,转载请注明出处.
64位CentOS64安装配置流量监控工具ntopng
ntopng是网络流量实时监控显示工具,能够自动从网络上识别有用的信息,不少人在安装的时候出现了不少问题,下面小编就给大家介绍下CentOS 6.4如何安装ntopng,一起来了解下吧。
64位CentOS 6.4安装网络监控 ntopng
1、配置默认yum源
实验使用阿里的镜像
1、备份
mv/etc/yum.repos.d/CentOS-Base.repo/etc/yum.repos.d/CentOS-Base.repo.def
2、下载新的CentOS-Base.repo到/etc/yum.repos.d/
CentOS 5
wget-O/etc/yum.repos.d/CentOS-Base.repo
CentOS 6
wget-O/etc/yum.repos.d/CentOS-Base.repo
3、之后运行yum makecache生成缓存
2、安装epel源及给国内镜像
1、下载安装
wget
chmod u+x epel-release-6-8.noarch.rpm
rpm-ivh epel-release-6-8.noarch.rpm
2、备份(如有配置其他epel源)
mv/etc/yum.repos.d/epel.repo/etc/yum.repos.d/epel.repo.backup
mv/etc/yum.repos.d/epel-testing.repo/etc/yum.repos.d/epel-testing.repo.backup
3、下载新repo到/etc/yum.repos.d/
epel(RHEL 6)
wget-O/etc/yum.repos.d/epel.repo
3、安装依赖库
yum install libpcap-devel glib2-devel GeoIP GeoIP-devel libxml2-devel libxml2-devel redis wget rrdtool
下载安装libzmq3,网站为:
wget
chmod u+x libzmq3-3.2.2-5.1.x86_64.rpm
rpm-ivh libzmq3-3.2.2-5.1.x86_64.rpm
解决如下出错:
[root@net1~]# rpm-ivh ntopng-1.2.2-8420.x86_64.rpm
warning: ntopng-1.2.2-8420.x86_64.rpm: Header V4 DSA/SHA1 Signature, key ID 7921df34: NOKEY
error: Failed dependencies:
librrd.so.4()(64bit) is needed by ntopng-1.2.2-8420.x86_64
libzmq.so.3()(64bit) is needed by ntopng-1.2.2-8420.x86_64
rrdtool》= 1.3.8 is needed by ntopng-1.2.2-8420.x86_64
4、安装及配置ntopng
1、下载
网站:
wget
wget
2、安装
chmod u+x ntopng-1.2.2-8420.x86_64.rpm ntopng-data-1.2.2-8420.noarch.rpm
rpm-ivh ntopng-1.2.2-8420.x86_64.rpm
rpm-ivh ntopng-data-1.2.2-8420.noarch.rpm
5、配置ntopng
1、查看默认配置文件
[root@net1~]# cd/etc/ntopng/
[root@net1 ntopng]# ls
ntopng.conf.sample ntopng.start
注,ntopng.conf.sample文件是配置文件样例,ntopng.start是ntopng启动时需要的配置文件(测试的ntopng版本此文件为空)。
[root@net1 ntopng]# cat ntopng.conf.sample
-G=/var/tmp/ntopng.gid
注,-G指定运行所用进程号文件。
修改后的内容为:
[root@net1 ntopng]# cat ntopng.conf
-G=/var/tmp/ntopng.pid
--local-networks“10.1.1.0/24”
--interface eth1
--user nobody
--http-port 8888
注,--local-network“指定本地子网段”;--interface eth1指定监听eth1网卡上的流量;--user z指定ntopng运行时使用的账户为nobody;--http-port指定web服务端口为8888,如果不指定默认为3000。
6、启动ntopng
注,在运行ntopng之前,要确认先启动redis服务,redis为ntopng提供键值存储。我们这边重新启动一下redis服务。
service redis start
service ntopng start
7、测试访问一下
默认的用户名和密码是admin。
上面就是CentOS 6.4安装ntopng的介绍了,在安装完ntopng后,记得要测试访问,且在安装前,需要配置yum源并进行相关备份。
如何在CentOS Linux下安装ASTERISK和FreePBX
下面给出在linux上安装Asterisk,FreePBX的基本步骤。
1.首先是更新系统(可选)
在命令行中输入
sudo apt-get update
sudo apt-get upgrade
2.安装LAMP(Apache2+MySQL+PHP)
在命令行输入
sudo tasksel
选择 LAMP Server
3.添加额外的PHP软件包
sudo apt-get install php5-gd php-pear php-db sox curl
4.安装phpmyadmin(可选)
sudo apt-get install phpmyadmin
5.安装asterisk
sudo apt-get install asterisk asterisk-mysql asterisk-mp3
6.安装Freepbx准备工作
在安装Freepbx我们先要想好将Freepbx安装在哪个目录下,FreePBX为asterisk的Web管理应用,可以帮助用户配置Asterisk等。
1) Ubuntu的Web根目录为/var/www,因此我们可以把FreePBX安装到/var/www/freepbx目录下,为便于管理,创建三个子目录conf设置文件
log存放日志
public WEB应用。
sudo mkdir/var/www/freepbx/
sudo mkdir/var/www/freepbx/conf
sudo mkdir/var/www/freepbx/log
sudo mkdir/var/www/freepbx/public
2)创建设置文件/var/www/freepbx/conf/vhost.conf
sudo vim/var/www/freepbx/conf/vhost.conf
输入以下内容
<VirtualHost*:80>
ServerName freepbx
ServerAlias freepbx
ServerAdmin james.shen@guidebee.com
ErrorLog/var/www/freepbx/log/error.log
CustomLog/var/www/freepbx/log/access.log combined
DocumentRoot/var/www/freepbx/public
<Directory/var/www/freepbx/public>
Options Indexes FollowSymLinks MultiViews
Order allow,deny
AllowOverride All
Allow from all
</Directory>
<Directory/var/www/freepbx/public/admin>
AuthType Basic
AuthName"Restricted Area"
AuthUserFile freepbx-passwd
Require user admin
</Directory>
</VirtualHost>
修改 ServerAdmin到你自己的Email地址。
3)将vhost添加到 Apache的sites-enabled目录下
sudo ln-s/var/www/freepbx/conf/vhost.conf/etc/apache2/sites-available/freepbx
cd/etc/apache2/sites-enabled/
sudo ln-s../sites-available/freepbx
4)创建用户和密码来验证合法用户可以来配置FreePBX(有权限访问该网页)
sudo htpasswd-c/etc/apache2/freepbx-passwd admin
5)重启Apache
sudo/etc/init.d/apache2 restart
有了这些准备工作后,就可以开始安装FreePBX了
7.安装FreePBX
1)下载FreePBX安装包
cd/tmp
wget
cd/usr/src
sudo tar xvzf/tmp/freepbx-2.8.1.tar.gz
cd freepbx-2.8.1/
2)创建数据库
mysqladmin create asterisk-u root-p
mysqladmin create asteriskcdrdb-u root-p
mysql-u root-p asterisk< SQL/newinstall.sql
mysql-u root-p asteriskcdrdb< SQL/cdr_mysql_table.sql
3)创建数据库用户
mysql-u root-p
在SQL命令行输入GRANT ALL PRIVILEGES ON asterisk.* TO asterisk@localhost IDENTIFIED BY‘badasspassword’;
GRANT ALL PRIVILEGES ON asteriskcdrdb.* TO asterisk@localhost IDENTIFIED BY‘badasspassword’;
flush privileges;
quit;
注意将badasspassword换成你自己选择的密码。
4)备份modules.conf, FreePBX安装时会修改Apache的配置文件
sudo cp/etc/asterisk/modules.conf~/asterisk-modules.conf
5)安装FreePBX
sudo./install_amp
输入对应的参数
Enter your USERNAME to connect to the'asterisk' database:
[asteriskuser] asterisk
Enter your PASSWORD to connect to the'asterisk' database:
[amp109] badasspassword
Enter the hostname of the'asterisk' database:
[localhost]
Enter a USERNAME to connect to the Asterisk Manager interface:
[admin]
Enter a PASSWORD to connect to the Asterisk Manager interface:
[amp111]
Enter the path to use for your AMP web root:
[/var/www/html]
/var/www/freepbx/public
Enter the IP ADDRESS or hostname used to access the AMP web-admin:
[xx.xx.xx.xx] freepbx
Enter a PASSWORD to perform call transfers with the Flash Operator Panel:
[passw0rd] password
Use simple Extensions [extensions] admin or separate Devices and Users [deviceanduser]?
[extensions]
Enter directory in which to store AMP executable scripts:
[/var/lib/asterisk/bin]
6)恢复asterisk-modules.conf
sudo cp~/asterisk-modules.conf/etc/asterisk/modules.conf
7)添加asterisk用户
sudo adduser www-data asterisk
修改权限/etc/amportal.conf中添加
AMPASTERISKUSER=www-data
AMPASTERISKGROUP=asterisk
AMPASTERISKWEBUSER=www-data
AMPASTERISKWEBGROUP=asterisk
重启amportal
sudo amportal start
8)使用amport启动Asterisk
sudo update-rc.d-f asterisk remove
sudo sed-e s/BACKGROUND=0/BACKGROUND=1/-i/usr/sbin/safe_asterisk
修改/etc/rc.local
在exit 0前添加
/usr/local/sbin/amportal start
至此,安装完毕。