Vagrant – rvm – ruby – puppet installation instructions

Problem

In order to install a vagrant box with rvm and puppet following the examples in the ‘Deploying Rails’ book, the updated steps needed are described below.
The two main differences are a) rvm system wide installation as recommended here, and b) the puppet 3.0.1 version support of ruby 1.9.3 here

Solution

So below are the steps followed to make it work.

  1. Remove system ruby
    sudo rm -rf /opt/vagrant_ruby/
  2. Remove vagrant_ruby.sh script as it adds a path that no longer exists:
    sudo rm /etc/profile.d/vagrant_ruby.sh
  3. Install rvm with system wide installation:
    curl -L get.rvm.io | sudo bash -s stable
  4. Add vagrant user and any other additional user to the rvm group:
    sudo usermod --append --groups rvm vagrant (or ubuntu)
  5. Exit and login back in to install ruby 1.9.3-p327 (current)
    vm$ exit
    $ vagrant ssh
    vm$ rvm install 1.9.3-p327
  6. install necessary ruby dependencies suggestest by previous command:
    sudo apt-get install build-essential openssl libreadline6 libreadline6-dev curl git-core zlib1g zlib1g-dev libssl-dev libyaml-dev libsqlite3-dev sqlite3 libxml2-dev libxslt-dev autoconf libc6-dev ncurses-dev automake libtool bison subversion pkg-config
  7. Creat a gemset to be used with the desired rvm ruby version:
    rvm gemset create rails3_2_11
  8. Use the created gemset to install puppet gem:
    rvm gemset use rails3_2_11
  9. Install puppet as the vagrant user and NOT as sudo:
    gem install puppet -v 3.0.1
  10. install the puppet user and group as per book instructions:
    vm$ sudo useradd --comment "Puppet" --no-create-home --system --shell /bin/false puppet
  11. Optionally create a puppet directory to put manifests and modules and create a .rvmrc file to use specified gemset, by adding the following line to puppet/.rvmrc:
    rvm gemset use rails3_2_11
  12. use rvmsudo instead of sudo to apply the puppet scripts:
    rvmsudo puppet apply --verbose puppet/manifests/site.pp