CentOS 安装 Gearmand 和 PHP Gearman的步骤本人觉得有点复杂了,我看了很多很多的文章都不简单呀,下面大家来与小编来起来看看 Gearmand 和 PHP Gearman的安装方法吧。
本文是采用源码编译方式安装Gearmand 和 PHP Gearman,完成安装Gearman当前最新版本1.1.2。
你也可以采取傻瓜式一键安装,命令如下:
yum install gearmand
pecl install gearman
这样安装的方式是一键安装完成,关键是版本不是最新的。
本文接下来主要讲解源码编译安装最新版 gearmand 1.1.2 - A distributed job system。
安装 Gearmand 分发式队列系统
在编译过程会遇到以下几种错误,是由于你的系统默认缺少这依赖类库。
报错一:
checking for boostlib >= 1.39… configure: We could not detect the boost libraries (version 1.39 or higher). If you have a staged boost library (still not installed) please specify $BOOST_ROOT in your environment and do not give a PATH to –with-boost option. If you are sure you have boost installed, then check your version number looking in . See http://randspringer.de/boost for more documentation.configure: error: could not find boost
解决方法
yum install boost-devel
报错二:
configure: error: could not find gperf
解决方法
yum install gperf
报错三:
configure: error: Unable to find libevent
解决方法
yum install libevent-devel
报错四:
configure: error: Unable to find libuuid
解决方法
yum install libuuid-devel
你可以使用以下一条命令涵盖之前的4条命令:
yum install -y boost-devel gperf libevent-devel libuuid-devel
以上命令会一次性安装完所有的依赖类库。 完成所有必须的依赖包后,你会看到:
* CPP Flags: -fvisibility=hidden
* LIBS:
* LDFLAGS Flags:
* Assertions enabled: no
* Debug enabled: no
* Warnings as failure: no
* Building with libsqlite3 no
* Building with libdrizzle yes
* Building with libmemcached not found
* Building with libpq no
* Building with tokyocabinet no
* Building with libmysql no
* SSL enabled: no
* cyassl found: no
* openssl found: yes
* make -j: 2
* VCS checkout: no
* sphinx-build: :
编译安装
make && make install
安装完成后,会创建如下目录:
/bin/mkdir -p ‘/usr/local/include’
/bin/mkdir -p ‘/usr/local/include/libgearman-1.0′
/bin/mkdir -p ‘/usr/local/include/libgearman’
/usr/bin/install -c -m 644 libgearman/gearman.h ‘/usr/local/include/libgearman’
/bin/mkdir -p ‘/usr/local/include/libgearman-1.0/interface’
/bin/mkdir -p ‘/usr/local/lib/pkgconfig’
查看安装是否成功:
[root@localhost gearmand-1.1.12]# gearmand -V
gearmand 1.1.12 – https://bugs.launchpad.net/gearmand
宣告Gearmand 完成成功!
安装 PHP Gearman
wget wget http://pecl.php.net/get/gearman-1.1.2.tgz
tar zxf gearman-1.1.2.tgz
cd gearman
/usr/local/php/bin/phpize
./configure –with-php-config=/usr/local/php/bin/php-config
make & make install
编译完成后显示如下信息:
Installing shared extensions: /usr/local/php/lib/php/extensions/no-debug-non-zts-20121212/
接下来,通过PHPINFO查看安装情况11