LOOKING FOR UBUNTU 14 INSTALL INSTRUCTIONS? Go here: http://www.hostingadvice.com/how-to/install-gearman-ubuntu-14-04/
I’m sure you’ve already visited many, many sites which explain how to install GearmanD on Ubuntu – but you’ve continued searching because something broke or didn’t quite work out. I too was in the same situation and spent 3 days battling through bits and pieces of information scattered across the web.
Here is the process I went through to install Gearman 1.1.7 on a Rackspace/OpenStack Ubuntu 12.04 instance which (assuming decent connection etc) should take less than 30 minutes!
Make a server instance
Obviously skip this part if you are working in Rackspace cloud or have already provisioned an Ubuntu instance.
- Log into your control panel at https://lon.manage.rackspacecloud.com for UK Rackspace customers or https://manage.rackspacecloud.com for US customers
- Click “Hosting”
- Click “Cloud Servers”
- Scroll down and click “Select” next to Ubuntu 12.04 LTS (Precise Pangolin)
- Give your server a name
- Select your server size – the size you choose will be dependent on the workload/throughput you expect your server to do, if you need lots of things done quickly with no regard to expense choose a larger server, however if you just want this gearmand server to plod through jobs then a smaller server will probably do.
- Click “Launch”
- Make a note of the password which is shown during set up – you will need it to log in to the server.
All you need to do is:
apt-get install gearmand-server
Install Ubuntu Update & Gearman Prerequisites/Dependancies
- Log into your server using your SSH client (I use puTTY)
- If you’ve just created the instance, change your password by entering:
- Update & Upgrade your Ubuntu to have the latest patches etc by running:
apt-get update apt-get upgrade
- Because my Ubuntu instance was a clean install I needed to install the LAMP stack – there will be dependencies in here which Gearman requires – such as MySQL – if you’re not installing the LAMP stack you will need to do some futher reading! I use tasksel to do my LAMP install (because I’m lazy)
- Install Gearman’s dependencies:
apt-get install build-essential libboost-thread-dev libboost-thread1.46-dev libcloog-ppl0 libboost-program-options-dev libevent-dev php5-dev libcloog-ppl0
- Figure out which version of Gearman you need by visiting https://launchpad.net/gearmand – in my case I’m using 1.1.7 so in the subsequent instructions change 1.1.7 to your version number
- Get the version of Gearman you require and unpack it:
cd /usr/src wget http://launchpad.net/gearmand/1.2/1.1.7/+download/gearmand-1.1.7.tar.gz tar -xvzf gearmand-1.1.7.tar.gz cd gearmand-1.1.7
- Make & Install GearmanD
./configure make && make install cd ..
All being well you should now have Gearman install and nothing broke/exploded or otherwise shit its pants during the install process.
Installing the PECL Extension for Gearman
To use Gearman with PHP we need to install the PECL extension – to do that we:
- Figure out which version we need by visiting http://pecl.php.net/package/gearman – in my case I’m using 1.1.1 so in the subsequent instructions change 1.1.1 to your version number
- Download & unpack the appropriate file
wget http://pecl.php.net/get/gearman-1.1.1.tgz tar -xvzf gearman-1.1.1.tgz
- Install the PECL extension:
cd gearman-1.1.1 phpize ./configure make make install cd ..
Update PHP with Gearman Extension
You made it to the last step! Getting PHP to recognise Gearman…
- You need to update your php.ini file(s) with the Gearman extension. As I intend to use Gearman both from the command line and Apache I need to update both of my php.ini files. To locate them I used:
- Which told me I need to edit /etc/php5/apache2/php.ini and /etc/php5/cli/php.ini. I’m not a huge fan of vi so I use nano to edit instead:
nano -w /etc/php5/apache2/php.ini nano -w /etc/php5/cli/php.ini
I added the following to each php.ini file:
You should now have a working Gearman server – hopefully it took you less than 30 minutes and can now go make a nice cup of tea!