murshed ahmmad khan (usamurai) on May 1st, 2013
  • Sharebar

What is Gearman

Installing Gearman on CentOS 6.2

The latest Gearman version available in the EPEL repository is not always up to date. The latest version of Gearman at this moment is 1.1.6. So, here is the procedure to install the Latest version from source. It’s easy to install but I’ve run into some problems while installing that in an amazon EC2 large instance. So added the troubleshooting parts too.

Install Gearman’s dependencies

Use yum to install the dependencies that Gearman needs:

yum install uuid-devel libuuid libuuid-devel uuid boost-devel libevent libevent-devel

Download the latest gearmand source

Download the latest Gearman version from Launchpad. I’ve picked Gearman 1.1.6

# cd /usr/share/
# wget https://launchpad.net/gearmand/1.2/1.1.6/+download/gearmand-1.1.6.tar.gz

Untar, compile and install

Now unpack it (gearmand version 1.1.6 in this example):

# tar -xvzf gearmand-1.1.6.tar.gz

and then compile and install it:

# cd gearmand-1.1.6

# ./configure && make && make test && make install

That’s all, gearman is installed and ready to use.

Build Troubleshoot:

Unfortunately, for my case it shows couple of errors and then terminated. Here is how I resolved that.

1. While configuring, i’ve got the following error:

checking for the toolset name used by Boost for g++… configure: WARNING: could not figure out which toolset name to use for g++

checking for Boost headers version >= 1.39.0… no
configure: error: cannot find Boost headers version >= 1.39.0

Solution: The reason is either you don’t have the “boost-devel” package installed, but I had already installed it before in the first phase (yum install boost-devel). For my case, it seems that I didn’t install g++ (found in the gcc-c++ package). So Installing the gcc-c++ package fixed the issue. ref: Building Gearman 0.27 on CentOS 6

# yum install gcc-c++

2. Now it proceeds further but throws error while running “make”, while compiling the libhostile.c file:

libhostile/function.c: In function ‘print_function_cache_usage’:
libhostile/function.c:54:3: error: ‘for’ loop initial declarations are only allowed in C99 mode
libhostile/function.c:54:3: note: use option -std=c99 or -std=gnu99 to compile your code
CC libhostile/libhostile_libhostile_la-poll.lo
make[1]: *** [libhostile/libhostile_libhostile_la-function.lo] Error 1
make[1]: *** Waiting for unfinished jobs….
libhostile/poll.c: In function ‘poll’:
libhostile/poll.c:93:9: error: ‘for’ loop initial declarations are only allowed in C99 mode
libhostile/poll.c:93:9: note: use option -std=c99 or -std=gnu99 to compile your code
make[1]: *** [libhostile/libhostile_libhostile_la-poll.lo] Error 1
make[1]: Leaving directory `/usr/share/gearmand-1.1.6′
make: *** [all] Error 2

The solution was hard to find, but as it suggests it is failing because the -std=c99 is required. The libhostile C code requires C99. There are some bug reports for this, but forcing the CFLAGS environment variable will fix this.

Solution: Run ./configure –help, you will see a list of configurable variables.

[.. gearmand-1.1.6]# ./configure –help

Some influential environment variables:
CC C compiler command
CFLAGS C compiler flags
LDFLAGS linker flags, e.g. -L if you have libraries in a
nonstandard directory

I tried to specify gnu99 library,
# CFLAGS=-std=gnu99 ./configure && make && make test && make install

or you can also use c99, and it works:

# CFLAGS=-std=c99 ./configure && make && make test && make install

ref: libpq configuration on ubuntu

3. Finally I ran into the mysql.h header file missing error while in “make”:

libgearman-server/plugins/queue/mysql/queue.cc:49:19: fatal error: mysql.h: No such file or directory
compilation terminated.

Solution: The solution is simple, i had missing “mysql-devel” package. So installing it solves the problem.

# yum install mysql-devel

so now you can run the gearman as below:

# gearmand -d -u root

Next to code Gearman’s client and worker process you need to install Gearman PHP extension. It’s very easy and straightforward, to do so, please follow this link: Installing Gearman PHP extension on CentOS

Reference:
You might also look into this:
1. Installing Gearman on CentOS 6.2
2. Getting started with Gearman
3. Gearman 0.14 on CentOS 5.5 and PHP bindings

Hope that it’ll help someone.

25 Responses to “Install Gearman daemon from source in CentOS”

  1. thanks, that really helps me a lot ~~

  2. A nice and well written article.
    It helped me a lot.

  3. West Ham boss Sam Allardyce ‘I believe that, with no disrespect to Nigel Adkins because he came via a very difficult spell and got Southampton up and out of the relegation zone, you draw on experience. Being in the Premier League for as long as I have with three clubs you already know what to expect. He was just an excited 000000 enthusiast who knew web design and was unaware how protective some forum admins could be, as well as some members who dedicate themselves to simply a single forum. Need

  4. Recently, I been taking photos for them in the form of candids, group photos, and staff headshots. All that media is live now, which means you definitely run across some of my stuff while perusing their site. So spare a thought for the ”common” brushtail possum which is rapidly becoming ”uncommon” in nonurban areas. These are easily made or can be purchased at cost price from wildlife organisations. Cookies have been of concern for Internet privacy, given that they can be used for tracking 0

  5. Bryant had played Clark in junior tournaments about a dozen times, losing just once. After a rough patch late in the first set, she settled down and finished it off.kind of got recorded on myself in the first set, Bryant said. The majority of the front 000000 consists of a Gorilla Glass panel for the display, with touchsensitive areas that expand past the screen for use with the gestures needed to navigate around the user interface. This didn’t take long to master these, and six years on few peo

  6. I have read several just right stuff here. Definitely price bookmarking for revisiting.
    I wonder how a lot attempt you put to create any such excellent informative site.

  7. Greetings I am so glad I found your webpage, I really found you
    by accident, while I was searching on Yahoo for something else, Nonetheless I am here now and would just
    like to say thank you for a tremendous post and a all round thrilling blog (I
    also love the theme/design), I dont have time to read through it all at
    the moment but I have bookmarked it and also added in your
    RSS feeds, so when I have time I will be back to
    read a great deal more, Please do keep up the excellent jo.

  8. Usually posts some really interesting stuff like this. If youre new to this site.

  9. always a significant fan of linking to bloggers that I love but dont get lots of link appreciate from

  10. that is the finish of this article. Here you will find some web pages that we think youll appreciate, just click the hyperlinks over

  11. usually posts some quite exciting stuff like this. If youre new to this site

  12. we like to honor many other net web sites around the web, even when they arent linked to us, by linking to them. Below are some webpages worth checking out

  13. always a significant fan of linking to bloggers that I really like but dont get a lot of link adore from

  14. That is the end of this article. Right here youll locate some web sites that we assume youll enjoy, just click the hyperlinks.

  15. usually posts some really interesting stuff like this. If youre new to this site

  16. usually posts some extremely intriguing stuff like this. If youre new to this site

  17. we like to honor numerous other internet web-sites around the net, even when they arent linked to us, by linking to them. Below are some webpages worth checking out

  18. we prefer to honor quite a few other online web pages around the internet, even if they arent linked to us, by linking to them. Below are some webpages really worth checking out

  19. we prefer to honor several other online websites on the net, even if they arent linked to us, by linking to them. Beneath are some webpages worth checking out

Trackbacks/Pingbacks

  1. Install Gearman PHP extension from PECL | exploring the IT underworld
  2. GearmanD | Phil Mellor - PHP Developer
  3. CentOS 上安装Gearman及其PHP扩展 | William Sang
  4. php安装gearman扩展实现异步分步式任务 | 小喵爱你
  5. Install Gearman PHP extension from PECL
  6. CentOS 上安装Gearman及其PHP扩展 – 日入一书

Leave a Reply