Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

While trying to install Nagios 3.2.3, I ran their ./configure script and got these errors:

checking for main in -liconv... no
checking for gdImagePng in -lgd (order 1)... no
checking for gdImagePng in -lgd (order 2)... no
checking for gdImagePng in -lgd (order 3)... no
checking for gdImagePng in -lgd (order 4)... no

*** GD, PNG, and/or JPEG libraries could not be located... *********

Boutell's GD library is required to compile the statusmap, trends
and histogram CGIs.  Get it from, compile
it, and use the --with-gd-lib and --with-gd-inc arguments to specify
the locations of the GD library and include files.

NOTE: In addition to the gd-devel library, you'll also need to make
      sure you have the png-devel and jpeg-devel libraries installed
      on your system.

NOTE: After you install the necessary libraries on your system:
      1. Make sure /etc/ has an entry for the directory in
         which the GD, PNG, and JPEG libraries are installed.
      2. Run 'ldconfig' to update the run-time linker options.
      3. Run 'make clean' in the Nagios distribution to clean out
         any old references to your previous compile.
      4. Rerun the configure script.

NOTE: If you can't get the configure script to recognize the GD libs
      on your system, get over it and move on to other things.  The
      CGIs that use the GD libs are just a small part of the entire
      Nagios package.  Get everything else working first and then
      revisit the problem.  Make sure to check the nagios-users
      mailing list archives for possible solutions to GD library
      problems when you resume your troubleshooting.


Which package do I want? libgd2-xpm-dev? libgd2-noxpm-dev? php5-gd? I'm not looking to do any image processing myself - I just want to get Nagios working.

share|improve this question
up vote 5 down vote accepted

If you look at the quickstart guide on nagios' website, you'll notice that the guide for Ubuntu 7.10 and later asks you to install libgd2-xpm-dev with this command:

sudo apt-get install libgd2-xpm-dev

That should do it for ya! Of course you could always follow the Ubuntu Server guide and install the nagios packages instead of building it yourself.

share|improve this answer
Thanks a lot! The quickstart guide says "With Ubuntu 7.10" and doesn't mention the "later" part, which was what confused me since 7.10 was a long time ago. – coffee-grinder Mar 5 '11 at 16:45

I used commands like this:

sudo apt-get install php5-gd
sudo service apache2 restart
share|improve this answer
Voting up, this worked for me. I'm not sure if you need to install both libgd2-xpm-dev and do the above, but I did all 3 and it works now. – Parris Jan 25 '14 at 22:41

protected by Community Jun 18 '14 at 2:21

Thank you for your interest in this question. Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site (the association bonus does not count).

Would you like to answer one of these unanswered questions instead?

Not the answer you're looking for? Browse other questions tagged or ask your own question.