In this appendix, we will cover how to install Ruby on your personal system. To install the exact same version of Ruby utilized by Puppet, run the following command on one of the test hosts:
[vagrant@client~]$/opt/puppetlabs/puppet/bin/ruby--versionruby2.1.8p440(2015-12-16revision53160)[x86_64-linux]
As of the last update of this book, Puppet uses Ruby 2.1.8.
Macintosh systems come with a modern version of Ruby installed. You can utilize the system Ruby successfully for every purpose in this book. The only thing necessary is to install the Bundler gem:
$sudogeminstallbundler--no-ri--no-rdocFetching:bundler-1.11.2.gem(100%)Successfullyinstalledbundler-1.11.21geminstalled
If you’d prefer to install the exact version of Ruby that Puppet uses, install HomeBrew and then use the following commands:
$ brew install rbenv ruby-build ... $ eval "$(rbenv init -)" $ rbenv install 2.1.8 ... $ rbenv shell 2.1.8
Any time you wish to utilize this version of Ruby, just run these commands again:
$ eval "$(rbenv init -)" $ rbenv shell 2.1.8
Install the latest Ruby 2.1 (or whatever version Puppet uses today) from RubyInstaller for Windows. You should also install the 64-bit DevKit for Ruby.
After these are installed, use the gem command to install Bundler:
C:\>geminstallbundler--no-ri--no-rdocFetching:bundler-1.11.2.gem(100%)Successfullyinstalledbundler-1.11.21geminstalled
You can use the Ruby version that comes with your operating system. If you are using CentOS 7 as recommended in this book, it is easy to install Ruby into the system packages:
[vagrant@client~]$sudoyuminstall-yruby-develrubygemsrakelibxml2-devel
For any other operating system, use the system Ruby, rbenv, or RVM to install the Ruby version matching what Puppet uses (the latest version of Ruby 2.1).
Here is a quick installation of Ruby and Bundler using rbenv that should work on any Unix/Linux environment:
$ git clone https://github.com/rbenv/rbenv.git ~/.rbenv ... $ git clone https://github.com/rbenv/ruby-build.git ~/.rbenv/plugins/ruby-build $ export PATH=~/.rbenv/bin:$PATH $ eval "$(rbenv init -)" $ /opt/puppetlabs/puppet/bin/ruby --version ruby 2.1.8p440 (2015-12-16 revision 53160) [x86_64-linux] $ rbenv install 2.1.8 ... $ rbenv shell 2.1.8 $ gem install bundler Fetching: bundler-1.11.2.gem (100%) Successfully installed bundler-1.11.2 1 gem installed
In order for Bundler and Beaker to build correctly, you’ll need to install some development packages. On CentOS or RHEL systems, the following command is necessary:
[vagrant@client~]$sudoyuminstall-ygcc-c++libxml2-devellibxslt-devel
The Bundler gem is used for local install of all necessary dependencies:
$sudogeminstallbundler--no-ri--no-rdocFetching:bundler-1.11.2.gem(100%)Successfullyinstalledbundler-1.11.21geminstalled