As part of a project we're working on, we needed to install the BOSH CLI on a Digital Ocean droplet running CentOS 7. The directions at bosh.io provided a list of all the packages that needed to be installed prior to installing the gem:

yum install gcc ruby ruby-devel mysql-devel postgresql-devel postgresql-libs sqlite-devel libxslt-devel libxml2-devel yajl-ruby  

After installing all of these I still had an error when I attempting to install the BOSH CLI gem:

Running patch with /usr/local/share/gems/gems/nokogiri-1.6.6.2/ports/patches/libxml2/0001-Revert-Missing-initialization-for-the-catalog-module.patch...  
Running 'patch' for libxml2 2.9.2... ERROR, review '/usr/local/share/gems/gems/nokogiri-1.6.6.2/ext/nokogiri/tmp/x86_64-redhat-linux-gnu/ports/libxml2/2.9.2/patch.log' to see what happened.  
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of necessary libraries and/or headers.  Check the mkmf.log file for more details.  You may need configuration options.  

I ran into a similar issue on Mac OS X - I need to install nokogiri. Fortunately, that seems a little more straightforward on CentOS. If you do a search for nokogiri packages you will come up dry:

~# yum search nokogiri
Loaded plugins: fastestmirror  
Loading mirror speeds from cached hostfile  
 * base: mirror.thelinuxfix.com
 * extras: mirrors.lga7.us.voxel.net
 * updates: mirrors.lga7.us.voxel.net
Warning: No matches found for: nokogiri  
No matches found  

The reason is that you need to install the appropriate EPEL (Extra Packages for Enterprise Linux) package:

yum install epel-release  

This is actually very quick as the package is only about 14k.

After you have installed EPEL, you will be able to find the appropriate nokogiri package:

~# yum search nokogiri
...
===================== N/S matched: nokogiri ======================
rubygem-nokogiri-doc.x86_64 : Documentation for rubygem-nokogiri  
rubygem-nokogiri.x86_64 : An HTML, XML, SAX, and Reader parser

  Name and summary matches only, use "search all" for everything.

Install rubygem-nokogiri.x86_64:

yum install rubygem-nokogiri.x86_64  

Then install the BOSH CLI:

gem install bosh_cli --no-ri --no-rdoc  

This will take a five or so minutes. To test the installation, check the version:

~# bosh version
BOSH 1.2881.0  

Notes:

  • Everything here was done as root.
  • If you run gem install bosh_cli bosh_cli_plugin_micro --no-ri --no-rdoc instead of just gem install bosh_cli --no-ri --no-rdoc the installation will take much longer and may appear to initially freeze.