rhel5.7下安装gearmand及启动的方法
本文简述了在rhel5.7下安装gearmand及启动的方法,供大家学习参考!
首先,到官网https://launchpad.net/gearmand/下载gearmand的源码包,传到rhel5.7的系统上,并解压。
运行configure:
[@localhostgearmand-1.1.11]#./configure--prefix=/usr/local/gearman--with-mysql--with-sqlite3=no
这时候会出现报如下错误:
checkingforBoostheadersversion>=1.39.0...no configure:error:cannotfindBoostheadersversion>=1.39.0 ok,http://sourceforge.net/projects/boost/files/boost/1.55.0/boost_1_55_0.tar.gz/download
此时需要下载boost,并解压:
./bootstrap.sh--prefix=/usr/local/boost/ ./b2install
这个过程需要等待一段时间,详情可参考官网:dochttp://www.boost.org/doc/libs/1_55_0/more/getting_started/unix-variants.html
安装完成之后,回到gearman目录,执行如下命令:
CPPFLAGS=-I/usr/local/boost/includeLDFLAGS=-L/usr/local/boost/lib./configure--prefix=/usr/local/gearman--with-mysql--with-sqlite3=no
这时还会报如下错误:
checkingforgperf...no configure:error:couldnotfindgperf
紧接着执行yum安装:
再次执行以上的configur,再没有报错。OK,可以进行编译了。
在执行make命令时,报了很多的错,其中看到有个:
./libgearman-1.0/gearman.h:53:27:error:tr1/cinttypes:Nosuchfileordirectory
可以推断是gcc编译器的问题,执行命令:
yuminstallgcc44gcc44-c++libstdc++44-devel-y
安装完毕之后执行:
CXX=/usr/bin/g++44CC=/usr/bin/gcc44CPPFLAGS=-I/usr/local/boost/includeLDFLAGS=-L/usr/local/boost/lib./configure--prefix=/usr/local/gearman--with-mysql--with-sqlite3=no
make&&makeinstall
至此,安装成功,执行以下命令启动(队列持久化保存)
/usr/local/gearman/sbin/gearmand-p4730-L0.0.0.0--log-file=/tmp/gearmand-4730.log--pid-file=/tmp/gearmand-4730.pid-qMySQL--mysql-host=localhost--mysql-user=root--mysql-db=gearman--verboseDEBUG-d
启动时,发现有报如下错误:
/usr/local/gearman/sbin/gearmand:errorwhileloadingsharedlibraries:libboost_program_options.so.1.55.0:cannotopensharedobjectfile:Nosuchfileordirectory
那么很明显,是由于链接文件找不到的缘故所导致的。执行如下命令:
vi/etc/ld.so.conf.d/gearman.conf
插入以下内容,保存退出
/usr/local/boost/lib/ /usr/local/gearman/lib/
执行命令
ldconfig
再次执行上面的启动命令,至此即可启动gearmand.