Notice: Function _load_textdomain_just_in_time was called incorrectly. Translation loading for the hueman domain was triggered too early. This is usually an indicator for some code in the plugin or theme running too early. Translations should be loaded at the init action or later. Please see Debugging in WordPress for more information. (This message was added in version 6.7.0.) in /var/www/CloudIngenium.com/htdocs/wp-includes/functions.php on line 6114
How to: Install Ruby in an Ubuntu Server to use it with NewRelic’s Plugins – Knowledge eXchange

How to: Install Ruby in an Ubuntu Server to use it with NewRelic’s Plugins

How to: Install Ruby in an Ubuntu Server to use it with NewRelic’s Plugins: Memcached & NginX

Everytime I try to install a plugin for New Relic I find myself trying to figure out how to perform each of the steps. Also, most of them require other applications to be installed as well like Ruby and Java. At the end of the day I find myself struggling to figure out the actual commands I need to execute as well as the best way to install the requirements. So finally I decided it was time to create a collection of instructions to facilitate the installation of this plugins.

As mentioned, one of the common requirements you will find is to have Ruby installed. There are like gazillions (well, perhaps two hands full) of ways to install Ruby. I did my research and decided this was the best way to fit my needs and works for those who are only looking into having Ruby installed to run the New Relic plugins. This instructions you’ll probably find will be referenced by the different plugin installation instructions that I start to develop. Hopefully this saves you a lot of time like me.

O. Summary (Just the commands)

For those who’ve done this in the past and just want to get it over with quickly:

sudo bash

apt-get install ruby2.0

apt-get install ruby2.0-dev

apt-get install build-essential

gem install bundler

And for those who are going through this for the first time: Step by Step with explanations:

I. Install Ruby

I am assuming you are just installing this for New Relic so there is no need to do RVM to manage versions, etc. (If you need Ruby for other things… say a Web Server using Ruby on Rails then I recommend the RVM install.) Simply use your best friend apt-get and done! It is an old stable version but then again the requirements state 1.8.7 or higher and 1.9.1 is higher. Update: You can install Ruby 2.0 from apt-get now, you just need to use a different package name at the end “ruby2.0″.

sudo apt-get install ruby2.0

If you only do that you’ll get the following error if you continue to install the agent:

Fetching gem metadata from http://rubygems.org/………..
Fetching additional metadata from http://rubygems.org/..
Resolving dependencies…
Using daemons (1.1.9)

Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.

/usr/bin/ruby1.9.1 extconf.rb
/usr/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require’: cannot load such file — mkmf (LoadError)
from /usr/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require’
from extconf.rb:1:in `<main>’
Gem files will remain installed in /var/lib/gems/1.9.1/gems/json-1.8.1 for inspection.
Results logged to /var/lib/gems/1.9.1/gems/json-1.8.1/ext/json/ext/generator/gem_make.out
An error occurred while installing json (1.8.1), and Bundler cannot continue.
Make sure that `gem install json -v ’1.8.1′` succeeds before bundling.

or

Fetching gem metadata from http://rubygems.org/………..
Fetching additional metadata from http://rubygems.org/..
Resolving dependencies…
Installing daemons (1.1.9)

Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.

/usr/bin/ruby2.0 extconf.rb
mkmf.rb can’t find header files for ruby at /usr/lib/ruby/include/ruby.h
Gem files will remain installed in /var/lib/gems/2.0.0/gems/json-1.8.1 for inspection.
Results logged to /var/lib/gems/2.0.0/gems/json-1.8.1/ext/json/ext/generator/gem_make.out
An error occurred while installing json (1.8.1), and Bundler cannot continue.
Make sure that `gem install json -v ’1.8.1′` succeeds before bundling.

To resolve this error you need to install the dev tools:

sudo apt-get install ruby2.0-dev

Furthermore, you will then come across this error that requires make:

Fetching gem metadata from http://rubygems.org/………..
Fetching additional metadata from http://rubygems.org/..
Resolving dependencies…
Using daemons (1.1.9)

Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.

/usr/bin/ruby2.0 extconf.rb
creating Makefile

make “DESTDIR=”
sh: 1: make: not found
Gem files will remain installed in /var/lib/gems/2.0.0/gems/json-1.8.1 for inspection.
Results logged to /var/lib/gems/2.0.0/gems/json-1.8.1/ext/json/ext/generator/gem_make.out
An error occurred while installing json (1.8.1), and Bundler cannot continue.
Make sure that `gem install json -v ’1.8.1′` succeeds before bundling.

so install it:

apt-get install build-essential

II. Install Bundler for Ruby

You can get the instructions from here: https://github.com/carlhuda/bundler or simply do the following:

gem install bundler

III. You’re done!

Now you have Ruby installed and you are ready to proceed to installing any of your favorite plugins like:

Enhanced by Zemanta

You may also like...

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.