centos 安装libtool,centos7.6安装教程

各位老铁们,大家好,今天由我来为大家分享centos 安装libtool,以及centos7.6安装教程的相关问题知识,希望对大家有所帮助。如果可以帮助到大家,还望关注收藏下本站,您的支持是我们最大的动力,谢谢大家了哈,下面我们开始吧!

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原创,转载请注明出处.

centos安装ffmpeg添加ogg音频ffmpeg音频编码支持操作步骤

简单介绍

FFmpeg是一个自由软件,可以运行音频和视频多种格式的录影、转换、流功能[1],包含了libavcodec─这是一个用于多个项目中音频和视频的解码器库,以及libavformat——一个音频与视频格式转换库。(来自维基百科)

安装前提

由于在centos下使用 yum install ffmpeg是找不到安装包的,所以需要通过其他方法来安装:

一、安装ffmpeg

操作系统:centos 5.6

(一)安装编译环境

复制代码代码如下:

#yum install-y automake autoconf libtool gcc gcc-c++

(二)安装所需程序库的RPM包到 centos(因为centos自带的库中没有ffmpeg包,这里相当于是扩展)

复制代码代码如下:

#rpm-Uhv

(三)安装 Install ffmpeg等模块

复制代码代码如下:

yum-y install ffmpeg ffmpeg-devel

当然你也可以选择编译源码安装,只需要在安装之前,将 ffmpeg需要的支持库安装好就是了,我之所以选择这种安装方式就是不想再去逐个编译各种库。

安装好之后可以使用下面命令查看:

复制代码代码如下:

./configure--prefix=/usr

安装好之后,你的机器就添加了对 ogg音频的支持。这里你需要先安装 libogg,因为 libvorbis需要 libogg的支持。

重新编译 ffmpeg

接下来就需要重新编译安装一下 ffmpeg,这时候你需要去下载一个 ffmpeg的源码包

运行

复制代码代码如下:

ffmpeg

拷贝如下信息

复制代码代码如下:

configuration:--prefix=/usr--libdir=/usr/lib64--shlibdir=/usr/lib64--mandir=/usr/share/man--incdir=/usr/include--disable-avisynth--extra-cflags='-O2-g-pipe-Wall-Wp,-D_FORTIFY_SOURCE=2-fexceptions-fstack-protector--param=ssp-buffer-size=4-m64-mtune=generic-fPIC'--enable-avfilter--enable-libdirac--enable-libfaac--enable-libfaad--enable-libfaadbin--enable-libgsm--enable-libmp3lame--enable-libopencore-amrnb--enable-libopencore-amrwb--enable-libx264--enable-gpl--enable-nonfree--enable-postproc--enable-pthreads--enable-shared--enable-swscale--enable-vdpau--enable-version3--enable-x11grab

当然你可以将不需要的移除,

在 ffmpeg源码目录下运行

复制代码代码如下:

./configure--prefix=/usr--libdir=/usr/lib64--shlibdir=/usr/lib64--mandir=/usr/share/man--incdir=/usr/include--disable-avisynth--extra-cflags='-O2-g-pipe-Wall-Wp,-D_FORTIFY_SOURCE=2-fexceptions-fstack-protector--param=ssp-buffer-size=4-m64-mtune=generic-fPIC'--enable-avfilter--enable-libdirac--enable-libfaac--enable-libfaad--enable-libfaadbin--enable-libgsm--enable-libmp3lame--enable-libopencore-amrnb--enable-libopencore-amrwb--enable-libx264--enable-gpl--enable-nonfree--enable-postproc--enable-pthreads--enable-shared--enable-swscale--enable-vdpau--enable-version3--enable-x11grab--enable-libvorbis

最后的一项是--enable-libvorbis,这个就是加入 ogg的音频支持。

编译完成之后,运行

复制代码代码如下:

make&& make install

就完成 ffmpeg的安装了

简单测试

可以使用如下命令测试 amr到 ogg的转码:

复制代码代码如下:

ffmpeg-i xxx.amr-f ogg-acodec libvorbis-ac 2-ab 128k-ar 44100 xxx.ogg

可以使用如下命令测试 amr到 mp3的转码:

复制代码代码如下:

ffmpeg-i xxx.amr xxx.mp3

可见 ffmpeg对 mp3的支持还是好很多的。

转码成功可以看到类似下面的输出:

centos7怎么编译安装gcc-c++

方法/步骤

1

yum install glibc-static libstdc++-static-y

安装c和c++的静态库(据说如果系统中缺少libc.a和libstdc++.a编译时会出错,但是我没有那么多闲情逸致去试,实践过的朋友可以回复一下,分享一下经验,让大家都长长见识)

2

下载解压gcc,我的gcc目录是gcc-4.8.0

3

进入gcc目录,执行:

./contrib/download_prerequisites

这个神奇的脚本文件会帮我们下载、配置、安装那三个依赖的库。可以节约我们大量的时间和精力。

4

你以为这三个库自动下载了、自动make install了就没事了吗?错!

很多人在编译gcc的时候出现各种奇奇怪怪的错误就是这步没有做好。

它们还不在.so文件的搜索路径里面,需要加进去,最后切记切记一定要执行一下ldconfig。

大致做法为:

1,找到你的共享库文件被install到哪个目录了(updatedb+locate命令)。

2,如果你的库不是直接放在/lib或/usr/lib下,需要修改/etc/ld.so.conf文件,加入你的共享库的路径

3,如果在2中添加了共享库路径,切记要执行一下ldconfig,更新响应cache文件让系统能找到你的共享库。

5

建立临时目录,这个目录用以存放编译时的大量临时文件,是文档要求中必须的。

我是在gcc-4.8.0下建立了一个名为gcc-build-4.8.0的目录,进入它。

mkdir gcc-build-4.8.0

cd gcc-build-4.8.0

配置gcc编译选项

6

强烈建议阅读INSTALL目录下的说明文档,尤其是configure.html,以确定你的编译选项。

比较基本的选项有--enable-languages,说明你要让你的gcc支持那些语言,--disable-multilib不生成编译为其他平台可执行代码的交叉编译器。--disable-checking生成的编译器在编译过程中不做额外检查,也可以使用--enable-checking=xxx来增加一些检查。

网上还说了什么--with-gmp、--with-mpfr、--with-mpc这三个选项,但是如果你3,4步做好了,就不要配了,反之你还是老实点吧别抱侥幸心理了。

调用gcc-4.8.0目录下的configure文件:

例如:

../configure--enable-checking=release--enable-languages=c,c++--disable-multilib

7

执行

../make#不解释

执行编译命令(#在8核的虚拟机上进行编译,每个核分配2个编译任务)

make-j16

make install编译过程CPU核基本100%占用,整个编译用时11分50秒。

检查gcc版本

#你就等吧少年,建议晚上睡觉前做

当然上面三步一定要在前一步顺利结束的情况下进行,如果哪一步出错了,结果都显示error了,就不要再做后面的了。在shell的输出里搜索"error"看具体的出错点是什么,baidu、google一下为什么。

如果你求稳的话,可以在make install之前先make check一下。

阅读剩余
THE END