wget https://launchpad.net/gearmand/1.2/1.1.12/+download/gearmand-1.1.12.tar.gz
tar zxvf gearmand-1.1.12.tar.gz
cd gearmand-1.1.12/
./configure
configure: error: could not find boost
sudo apt-get install libboost-dev
接着重新執行:./configure
configure: error: Could not find a version of the library!
sudo apt-get install libboost-all-dev
接着重新執行:./configure
configure: error: could not find gperf
sudo apt-get install gperf*
接着重新執行:./configure
configure: error: Unable to find libevent
sudo apt-get install libevent-dev
接着重新執行:./configure
configure: error: Unable to find libuuid
sudo apt-get install uuid-dev
./configure
sudo make
sudo make install
這裏要等一段時間。。
gearman
第一次運行會看到以下提示:
gearman: error while loading shared libraries: libgearman.so.8: cannot open shared object file: No such file or directory
(這表示系統不知道libgearman.so.8 放在哪個目錄下。 要在/etc/ld.so.conf中加入libgearman.so.8所在的目錄。 檢查了下,文件所在目錄爲/usr/local/lib。 因此出現這個問題的原因是libgearman.so.8剛生成,沒有加入到ld.so.cache中,所以這時需要重新運行一下 /sbin/ldconfig( ldconfig命令的作用):)
sudo /sbin/ldconfig
此時再執行 gearman 則已安裝成功!
安裝完Job Server之後,用gearmand –d命令啓動
gearmand -d
第一次運行會看到以下提示:
gearmand: Could not open log file "/usr/local/var/log/gearmand.log", from "/home/wangyulu/下載/gearmand-1.1.12", switching to stderr. (No such file or directory)
在提示的目錄下創建好/log/gearmand.log文件,再次執行上述命令,就正常啓動了job server。
sudo gearmand -d
到這裏就已經完全ok了
安裝PHP Gearman擴展
wget http://pecl.php.net/get/gearman-1.1.2.tgz
sudo tar zxvf gearman-1.1.2.tgz
cd gearman-1.1.2/
sudo phpize (這裏可能會提示沒有此命令,執行 sudo apt-get install php5-dev 安裝)
sudo ./configure
sudo make
sudo make install
sudo echo "extension=gearman.so" >> /etc/php5/apache2/php.ini (注意這裏php.ini位置)
sudo /etc/init.d/apache2 restart
這時查看php_info時就應該看到 gearman擴展了