Howto install Ruby vSphere Console (RVC) on vMA 5.x

With the release of vSphere 5.5, VMware supports a new command line utility: Ruby vSphere Console (RVC). RVC is a Ruby based interactive object oriented command line utility. It was initially released as a Fling some years ago. RVC has support for both, the Windows version of vCenter Server and the vCenter Server Appliance (VCSA). It is similar to other command line tools like PowerCLI or ESXCLI and can be used to manage and troubleshoot vSphere environments. In this post I am going to show how to install RVC on the vSphere Management Assistant (vMA).

rvc

RVC Installation

Install Ruby (root permissions required)
vma:~ # sudo su
vma:~ # zypper install rubygems

Press a to trust
Press y to confirm installation

We need to update Ruby to Version 1.9.2. To manage Ruby Versions I am going to use RVM (Ruby Version Manager). This also requires some additional packages.
vma:~ # \curl -L https://get.rvm.io | bash -s stable
vma:~ # source /etc/profile.d/rvm.sh
vma:~ # zypper install patch automake bison gcc gcc-c++ libtool patch gdbm-devel glibc-devel libffi-devel libopenssl-devel readline-devel zlib-devel

Press 1 to resolving package dependencies
Press y to confirm installation

Install Ruby Version 1.9.2, RVC (Ruby Virtual Console) and FFI (Auto-complete library):
vma:~ # rvm install 1.9.2
vma:~ # gem install rvc
vma:~ # gem install ffi

That's it. You can now connect to an ESXi Hosts or a vCenter Server:
vma:~ # rvc 192.168.222.200
rvc-vma

Troubleshooting‎

ERROR: Error installing rvc:
nokogiri requires Ruby version >= 1.9.2.

Solution: Update Ruby to version >= 1.9.2

vma:~ # \curl -L https://get.rvm.io | bash -s stable
vma:~ # source /etc/profile.d/rvm.sh
vma:~ # zypper install patch automake bison gcc gcc-c++ libtool patch gdbm-devel glibc-devel libffi-devel libopenssl-devel readline-devel zlib-devel
vma:~ # rvm install 1.9.2


Error running 'requirements_opensuse_libs_install patch automake bison gcc gcc-c++ libtool patch gdbm-devel glibc-devel libffi-devel libopenssl-devel readline-devel zlib-devel',
please read /usr/local/rvm/log/1385998607_ruby-1.9.2-p320/package_install_patch_automake_bison_gcc_gcc-c++_libtool_patch_gdbm-devel_glibc-devel_libffi-devel_libopenssl-devel_readline-devel_zlib-devel.log
Requirements installation failed with status: 4.

Solution: Install required dependencies

vma:~ # zypper install patch automake bison gcc gcc-c++ libtool patch gdbm-devel glibc-devel libffi-devel libopenssl-devel readline-devel zlib-devel


Problem: gcc-4.5-19.1.x86_64 requires gcc45, but this requirement cannot be provided
uninstallable providers: gcc45-4.5.1_20101208-9.8.i586[opensuse]
gcc45-4.5.1_20101208-9.8.x86_64[opensuse]
Solution 1: downgrade of binutils-2.21.1-0.9.2.x86_64 to binutils-2.21-13.1.x86_64
Solution 2: do not install gcc-4.5-19.1.x86_64
Solution 3: do not install gcc-4.5-19.1.x86_64
Solution 4: break gcc-4.5-19.1.x86_64 by ignoring some of its dependencies

Choose from above solutions by number or cancel [1/2/3/4/c] (c):

Solution: Use Solution 1 to downgrade binutils.

  1. Getting Started with Ruby vSphere Console (RVC) | Virten.net - pingback on December 4, 2013 at 7:56 pm
  2. Nokogiri install/compile pukes all over itself when attempting this recipe on vMA 5.5.0.1. I don't know enough about linux, ruby or rvc to even begin to troubleshoot, but the fact that VMware didn't put RVC into the VMA by default is not a good sign.

  3. I had an issue because it was still defaulting to ruby 1.8.7, see how I fixed it below.

    vma1:~ # gem install rvc
    Fetching: mini_portile-0.6.0.gem (100%)
    Fetching: nokogiri-1.6.3.1.gem (100%)
    ERROR: Error installing rvc:
    nokogiri requires Ruby version >= 1.9.2.
    vma1:~ # ruby --version
    ruby 1.8.7 (2011-02-18 patchlevel 334) [x86_64-linux]
    vma1:~ # rvm use 2.1.2 --default
    Using /usr/local/rvm/gems/ruby-2.1.2
    /usr/local/rvm/rubies/ruby-2.1.2/lib/ruby/2.1.0/yaml.rb:4:in `':
    It seems your ruby installation is missing psych (for YAML output).
    To eliminate this warning, please install libyaml and reinstall your ruby.
    /usr/local/rvm/rubies/ruby-2.1.2/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:55:in `require': libyaml-0.so.2: cannot open shared object file: No such file or directory - /usr/local/rvm/rubies/ruby-2.1.2/lib/ruby/2.1.0/x86_64-linux/psych.so (LoadError)
    from /usr/local/rvm/rubies/ruby-2.1.2/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:55:in `require'
    from /usr/local/rvm/rubies/ruby-2.1.2/lib/ruby/2.1.0/psych.rb:1:in `'
    from /usr/local/rvm/rubies/ruby-2.1.2/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:55:in `require'
    from /usr/local/rvm/rubies/ruby-2.1.2/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:55:in `require'
    from /usr/local/rvm/rubies/ruby-2.1.2/lib/ruby/2.1.0/yaml.rb:5:in `'
    from /usr/local/rvm/rubies/ruby-2.1.2/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:55:in `require'
    from /usr/local/rvm/rubies/ruby-2.1.2/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:55:in `require'
    from /usr/local/rvm/rubies/ruby-2.1.2/lib/ruby/2.1.0/rubygems.rb:616:in `load_yaml'
    from /usr/local/rvm/rubies/ruby-2.1.2/lib/ruby/2.1.0/rubygems/config_file.rb:328:in `load_file'
    from /usr/local/rvm/rubies/ruby-2.1.2/lib/ruby/2.1.0/rubygems/config_file.rb:197:in `initialize'
    from /usr/local/rvm/rubies/ruby-2.1.2/lib/ruby/2.1.0/rubygems/gem_runner.rb:74:in `new'
    from /usr/local/rvm/rubies/ruby-2.1.2/lib/ruby/2.1.0/rubygems/gem_runner.rb:74:in `do_configuration'
    from /usr/local/rvm/rubies/ruby-2.1.2/lib/ruby/2.1.0/rubygems/gem_runner.rb:39:in `run'
    from /usr/local/rvm/rubies/ruby-2.1.2/bin/gem:21:in `'
    vma1:~ # zypper install libyaml-0-2
    Loading repository data...
    Reading installed packages...
    Resolving package dependencies...

    The following NEW package is going to be installed:
    libyaml-0-2

    1 new package to install.
    Overall download size: 47.0 KiB. After the operation, additional 131.0 KiB will be used.
    Continue? [y/n/? shows all options] (y): y
    Retrieving package libyaml-0-2-0.1.3-3.1.x86_64 (1/1), 47.0 KiB (131.0 KiB unpacked)
    Retrieving: libyaml-0-2-0.1.3-3.1.x86_64.rpm [done (1.6 KiB/s)]
    Installing: libyaml-0-2-0.1.3-3.1 [done]
    Additional rpm output:
    warning: /var/cache/zypp/packages/opensuse/suse/x86_64/libyaml-0-2-0.1.3-3.1.x86_64.rpm: Header V3 RSA/SHA256 signature: NOKEY, key ID 3dbdc284

    vma1:~ # rvm use 2.1.2 --default
    Using /usr/local/rvm/gems/ruby-2.1.2
    vma1:~ # ruby --version
    ruby 2.1.2p95 (2014-05-08 revision 45877) [x86_64-linux]
    vma1:~ # gem install rvc
    Fetching: mini_portile-0.6.0.gem (100%)
    Successfully installed mini_portile-0.6.0
    Fetching: nokogiri-1.6.3.1.gem (100%)
    Building native extensions. This could take a while...
    Building nokogiri using packaged libraries.
    Building libxml2-2.8.0 for nokogiri with the following patches applied:
    - 0001-Fix-parser-local-buffers-size-problems.patch
    - 0002-Fix-entities-local-buffers-size-problems.patch
    - 0003-Fix-an-error-in-previous-commit.patch
    - 0004-Fix-potential-out-of-bound-access.patch
    - 0005-Detect-excessive-entities-expansion-upon-replacement.patch
    - 0006-Do-not-fetch-external-parsed-entities.patch
    - 0007-Enforce-XML_PARSER_EOF-state-handling-through-the-pa.patch
    - 0008-Improve-handling-of-xmlStopParser.patch
    - 0009-Fix-a-couple-of-return-without-value.patch
    - 0010-Keep-non-significant-blanks-node-in-HTML-parser.patch
    - 0011-Do-not-fetch-external-parameter-entities.patch
    ************************************************************************
    IMPORTANT! Nokogiri builds and uses a packaged version of libxml2.

    If this is a concern for you and you want to use the system library
    instead, abort this installation process and reinstall nokogiri as
    follows:

    gem install nokogiri -- --use-system-libraries

    If you are using Bundler, tell it to use the option:

    bundle config build.nokogiri --use-system-libraries
    bundle install

    However, note that nokogiri does not necessarily support all versions
    of libxml2.

    For example, libxml2-2.9.0 and higher are currently known to be broken
    and thus unsupported by nokogiri, due to compatibility problems and
    XPath optimization bugs.
    ************************************************************************
    Building libxslt-1.1.28 for nokogiri with the following patches applied:
    - 0001-Adding-doc-update-related-to-1.1.28.patch
    - 0002-Fix-a-couple-of-places-where-f-printf-parameters-wer.patch
    - 0003-Initialize-pseudo-random-number-generator-with-curre.patch
    - 0004-EXSLT-function-str-replace-is-broken-as-is.patch
    - 0006-Fix-str-padding-to-work-with-UTF-8-strings.patch
    - 0007-Separate-function-for-predicate-matching-in-patterns.patch
    - 0008-Fix-direct-pattern-matching.patch
    - 0009-Fix-certain-patterns-with-predicates.patch
    - 0010-Fix-handling-of-UTF-8-strings-in-EXSLT-crypto-module.patch
    - 0013-Memory-leak-in-xsltCompileIdKeyPattern-error-path.patch
    - 0014-Fix-for-bug-436589.patch
    - 0015-Fix-mkdir-for-mingw.patch
    ************************************************************************
    IMPORTANT! Nokogiri builds and uses a packaged version of libxslt.

    If this is a concern for you and you want to use the system library
    instead, abort this installation process and reinstall nokogiri as
    follows:

    gem install nokogiri -- --use-system-libraries

    If you are using Bundler, tell it to use the option:

    bundle config build.nokogiri --use-system-libraries
    bundle install
    ************************************************************************
    Successfully installed nokogiri-1.6.3.1
    Fetching: builder-3.2.2.gem (100%)
    Successfully installed builder-3.2.2
    Fetching: trollop-2.0.gem (100%)
    Successfully installed trollop-2.0
    Fetching: rbvmomi-1.8.1.gem (100%)
    Successfully installed rbvmomi-1.8.1
    Fetching: backports-3.6.0.gem (100%)
    Successfully installed backports-3.6.0
    Fetching: highline-1.6.21.gem (100%)
    Successfully installed highline-1.6.21
    Fetching: zip-2.0.2.gem (100%)
    Successfully installed zip-2.0.2
    Fetching: terminal-table-1.4.5.gem (100%)
    Successfully installed terminal-table-1.4.5
    Fetching: rvc-1.8.0.gem (100%)
    Successfully installed rvc-1.8.0
    Parsing documentation for backports-3.6.0
    Installing ri documentation for backports-3.6.0
    Parsing documentation for builder-3.2.2
    Installing ri documentation for builder-3.2.2
    Parsing documentation for highline-1.6.21
    Installing ri documentation for highline-1.6.21
    Parsing documentation for mini_portile-0.6.0
    Installing ri documentation for mini_portile-0.6.0
    Parsing documentation for nokogiri-1.6.3.1
    Installing ri documentation for nokogiri-1.6.3.1
    Parsing documentation for rbvmomi-1.8.1
    Installing ri documentation for rbvmomi-1.8.1
    Parsing documentation for rvc-1.8.0
    Installing ri documentation for rvc-1.8.0
    Parsing documentation for terminal-table-1.4.5
    Installing ri documentation for terminal-table-1.4.5
    Parsing documentation for trollop-2.0
    Installing ri documentation for trollop-2.0
    Parsing documentation for zip-2.0.2
    Installing ri documentation for zip-2.0.2
    Done installing documentation for backports, builder, highline, mini_portile, nokogiri, rbvmomi, rvc, terminal-table, trollop, zip after 20 seconds
    10 gems installed
    vma1:~ # gem install ffi
    Fetching: ffi-1.9.3.gem (100%)
    Building native extensions. This could take a while...
    Successfully installed ffi-1.9.3
    Parsing documentation for ffi-1.9.3
    Installing ri documentation for ffi-1.9.3
    Done installing documentation for ffi after 17 seconds
    1 gem installed
    vma1:~ #

Leave a Comment

NOTE - You can use these HTML tags and attributes:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>

Trackbacks and Pingbacks: