If you are a Ruby and VMware fan (heck, even if you are not a Ruby fan), you should check out the “unofficial” VMware Lab Fling – Ruby vSphere Console (RVC) created by Rich Lane of VMware. RVC is described as a Linux console UI for vSphere, built on the RbVmomi (another VMware Fling) bindings to the vSphere API. RVC is platform agnostic, as long as you can get Ruby/Gem installed, you can run RVC on Windows (I believe), UNIX/Linux and even OSX!

Rich just released another update today supporting Linked Clones functionality for virtual machines and maintenance mode for ESX(i) host. I wanted to check out the latest update and I thought give it a try on vMA, here are the instructions for installing Ruby, Gem (Ruby package manager) and RVC on vMA 4.1. If you do not want to manually go through this manual process, jump towards the bottom for an automated script that does all this for you :)

Step 1 – You will need to download a few dependencies for both Ruby and Gems, the easiest way to do so is to setup a YUM repo pointing to CentOS mirrors. You will need to create a .repo file under /etc/yum.repos.d and in this example, we’ll just call it /etc/yum.repos.d/CentOS-Base.repo

Copy the following into this file, make sure you create the file using sudo:

Step 2 – Install the following packages:

yum -y install gcc gcc-c++ zlib-devel openssl-devel readline-devel libxml2 libxml2-devel libxslt libxslt-devel

Step 3 – Download Ruby and Gems using wget:

wget ftp://ftp.ruby-lang.org/pub/ruby/1.8/ruby-1.8.7.tar.gz
wget http://rubyforge.org/frs/download.php/74619/rubygems-1.7.2.tgz

Step 4 – Install Ruby

tar -zxvf ruby-1.8.7.tar.gz
cd ruby-1.8.7
./configure
make
sudo make install
cd ..

You can verify that Ruby was installed correctly by running the following:

[vi-admin@vMA rubygems-1.7.2]$ ruby –version
ruby 1.8.7 (2008-05-31 patchlevel 0) [x86_64-linux]

Step 5 – Install Gem

tar -zxvf rubygems-1.7.2.tgz
cd rubygems-1.7.2
sudo ruby setup.rb

You can verify that Gem was installed correctly by running the following:

[vi-admin@vMA rubygems-1.7.2]$ gem –version
1.7.2

Step 6 – Update Gem (not necessary if you downloaded the latest version which is 1.7.2)

sudo gem update –system

Step 7 – Install ffi gem, this is used for faster tab competition

sudo gem install ffi

Step 8 – Install Ruby vSphere Console (RVC) gem

sudo gem install rvc

You can verify that RVC was installed correctly by running the following command:

[vi-admin@vMA ~]$ rvc -h
Ruby vSphere Console.

I also wrote a quick RVC installation script which does exactly the above without the manual labor.

Step 1 – Download installRVC.sh script to vMA:

wget http://vghetto.svn.sourceforge.net/viewvc/vghetto/other/installRVC.sh

Step 2 – Set the script to be executable:

chmod +x installRVC.sh

Step 3 – Run the installation script

sudo ./installRVC.sh

Once completed, you should get a successful message that RVC is installed on your vMA host.

Now you are ready to start playing with RVC!

Here is an example of the two latest features added by Rich

Linked Clone:

Maintenance Mode:

As you can see it is very easy to use and intuitive, what would be even cooler is to have the various objects be colorized so you can easily distinguish between them, perhaps feature enhancement Rich?

If there are other vSphere operations that you would like to see get implemented, drop your feedback on this VMTN thread which is being monitored by Rich. You can also follow Rich on twitter for the latest updates about RVC.

Hopefully VMware will make this into an official fling and put it on their VMware Lab’s website to get the word out!

5 thoughts on “How to install Ruby vSphere Console on vMA

  1. @Rich,

    Ruby can be installed from YUM, but I found that the repos had an older version of Ruby (1.8.5) IRRC and it had some issues with the latest version of Gem. I had to download 1.8.7 to have it function with the latest version of Gem, so I decided to compile it manually which wasn’t a big deal.

    Thanks for the one-liner, couldn’t get it to work with sudo. I’ve seen this one-liner in the Ruby community for setting up RVM

  2. When I do.

    yum -y install gcc gcc-c++ zlib-devel openssl-devel readline-devel libxml2 libxml2-devel libxslt libxslt-devel libffi libffi-devel

    I get

    No package libffi available.
    No package libffi-devel available

    Everything else goes like libxslt, etc.

    vma 4.1

  3. @n0t,

    Looks like those two packages actually aren’t on CentOS repo, guess you don’t actually need it and RVC will install fine. I’ll go ahead and update the instructions

Thanks for the comment!