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