Download the latest version of Gearman from: https://launchpad.net/gearmand/
Add required libraries:
apt-get install build-essential libboost-thread-dev libboost-program-options-dev libevent-dev libcloog-ppl0 libmysqld-dev uuid-dev -y
Build Gearman:
./configure
make
make install
ldconfig
Add the MySQL DB:
CREATE DATABASE gearman;
CREATE USER 'gearman'@'localhost' IDENTIFIED BY 'password';
GRANT ALL PRIVILEGES ON gearman.* TO 'gearman'@'localhost';
FLUSH PRIVILEGES;
Create the upstart process:
nano /etc/init/gearmand.conf
description "Gearmand Server"
start on startup
stop on runlevel [016]
kill timeout 3
respawn
exec gearmand \
--log-file=/var/log/gearmand.log \
--queue-type=MySQL \
--mysql-host=192.168.1.10 \
--mysql-port=3306 \
--mysql-user=gearman \
--mysql-password=your_password \
--mysql-db=gearman \
--mysql-table=gearman_01
Start the daemon:
sudo service gearmand start
Install the PHP Extension:
sudo pecl install gearman
echo "extension=gearman.so" > /etc/php5/conf.d/gearman.ini
Install Supervisor:
sudo apt-get install python-setuptools
sudo easy_install supervisor
sudo su root
echo_supervisord_conf > /etc/supervisord.conf
http://edvanbeinum.com/how-to-install-and-configure-supervisord