系统:centos 5.5
需要的软件包:boost_1_50_0.tar.gz gearman-1.0.2.tgz gearmand-0.34.tar.gz
1.安装boost
如果不安装boost的话,是安装不上gearmand和gearman的.
wget -c http://download.slogra.com/gearman/boost_1_50_0.tar.gz
tar zxf boost_1_50_0.tar.gz && cd boost_1_50_0
./bootstrap.sh --prefix=/usr/local/boost

如出现上图,则输入命令:
./b2 install
这一步安装等待的时间比较久,各位可以去喝个茶,休息休息下.

如没有问题,在/etc/profile里的最下方加入:
export CPPFLAGS=-I/usr/local/boost/include
export LDFLAGS=-L/usr/local/boost/lib
保存退出后运行
source /etc/profile
好了,boost就安装成功了.
2.安装gearmand
wget -c http://download.slogra.com/gearman/gearmand-0.34.tar.gz
tar zxf gearmand-0.34.tar.gz && cd gearmand-0.34
./configure --prefix=/usr/local/gearman
如果出现configure: error: Unable to find libevent,则输入命令:
yum -y install libevent libevent-devel
然后重新configure.
没有问题后再执行
make
这步出现./libgearman-1.0/gearman.h:53:27: error: tr1/cinttypes: No such file or directory错误,可以推断是gcc编译器的问题,执行命令:
yum install gcc44 gcc44-c++ libstdc++44-devel -y
然后在环境变量里加入:
export CC=/usr/bin/gcc44 or export CC=/usr/bin/gcc
export CXX=/usr/bin/g++44
保存退出后执行:
source /etc/profile
删除gearmand-0.34文件夹重新进行编译.
重新进行编译后执行make这步,如图

没有报错的话才能继续执行
make install
如果没有报错的话,那么恭喜你可以继续安装gearman了.
3.安装gearman
gearman是要整合到php中,所以你必须得有lamp环境.我服务器上已经有lamp环境,所以接下来就直接进行安装.
wget -c http://download.slogra.com/gearman/gearman-1.0.2.tgz
tar zxf gearman-1.0.2.tgz && cd gearman-1.0.2
/usr/local/php/bin/phpize
./configure --with-gearman=/usr/local/gearman/ --with-php-config=/usr/local/php/bin/php-config
make && make install
没有报错的话,去php.ini添加扩展语句
vi /etc/php.ini
extension=gearman.so
extension_dir = "/usr/local/php/lib/php/extensions/no-debug-non-zts-20090626/"
重启httpd
service httpd restart
好了,到此就全部安装成功.