How to Install Gearman on Ubuntu 12.04

Gearman is a fantastic, open-source parallel task runner and/or job server. It is simple to implement and works across many different languages. In fact, you can call workers that run in one language from clients in another language. When scaling and parallelization become things you want to tackle, this can be a very useful feature.

Our goal behind this post isn’t to describe Gearman or tell you how great it is; it’s to cover the installation process on Ubuntu 12.04, because it can be confusing, and the Gearman page doesn’t do a great job of describing the process.

The installation is really simple though — you’ll see.

Step 1: Install Python-Software-Properties & the Gearman PPA

In case you don’t have python-software-properties installed, we will need to install it. There is also a Gearman PPA for Ubuntu, so we will add that to our repository list and do an update.

 Step 2: Install the Gearman Job Server & Dev Tools & Perform Upgrade

Now that we have the respository installed, let’s go ahead and install the Job Server and Tools.

This is pretty straightforward.

 Step 3: Use PECL to Install Gearman (CLI, Client, Worker)

Using PECL, we can simply install the other needed parts of Gearman now.

 Step 4: Update Our php.ini (CLI and Server) to Use Gearman

Now we need to tell PHP to use the extension. If you aren’t sure whether you will be using a web-server-based Gearman or the CLI version, you can install both to be safe. It is important to note that PHP has two separate php.ini files for CLI and Server.

For the CLI php.ini (/etc/php5/cli/php.ini)

Open your php.ini in your favorite text editor.

Add the following line in the “Dynamic Extensions” section of your php.ini.

 For the Apache-based php.ini (/etc/php5/apache2/php.ini)

Open your php.ini in your favorite text editor. Please note that this is a different file than the one we just discussed.

Add the “Dynamic Extension” again in this file.

Restart Apache:

Step 5: Try the Examples

Now, you can try the examples found here to verify that you are all set up on Gearman.


Well done! After a simple and straightforward installation, you now have a fantastic task runner.

Have fun with it!

Ryan Frankel

Ryan Frankel has been a professional in the tech industry for more than 10 years and has been developing websites for more than 15. With his background in integrated circuit design and digital signal processing, he has a fundamental understanding of hardware systems and the software that runs them. Ryan now sits as the CTO of Digital Brands Inc. and manages all of the server infrastructure of their websites, as well as their development team. In addition, Ryan has a passion for guitars, good coffee, and puppies.