Installing OpenShift RHC Client Tools

The OpenShift Client tools known as rhc are built and packaged using the Ruby programming language. OpenShift integrates with the Git version control system to provide powerful, decentralized version control for your application source code.

OpenShift rhc can be run on any operating system with Ruby 1.8.7 or higher if you have the requisite user permissions to install programs. Instructions for specific operating systems are provided below. It is assumed that you are running the commands from a command line window, such as Command Prompt, or Terminal. If you are using Ruby Version Manager (rvm) see the instructions below.

Windows

RubyInstaller 1.9 provides the best experience for installing Ruby on Windows XP, Vista, and Windows 7. Download the newest version from the download page and launch the installer.

Important: During the installation you can accept all of the defaults, but it is mandatory that you select the "Add Ruby executables to your PATH" check box in order to run Ruby from the command line.

After the installation is completed, to verify that the installation is working run:

C:\Program Files\> ruby -e 'puts "Welcome to Ruby"'
Welcome to Ruby

If the 'Welcome to Ruby' message does not display, the Ruby executable may not have been added to the path. Restart the installation process and ensure the "Add Ruby executables to your PATH" check box is selected.

Installing Git

The next step is to install Git for Windows so that you can synchronise your local application source and your OpenShift application. Git for Windows offers the easiest Git experience on the Windows operating system and is the recommended default - if you use another version of Git please ensure it can be executed from the command line and continue to the next section.

Download and install the latest version of Git for Windows. Ensure that Git is added to your PATH so that it can be run from the command line. After the installation is completed, to verify that Git is correctly configured run:

C:\Program Files\> git --version
git version 1.7.11.msysgit.1

Installing the OpenShift gem

After Ruby and Git are correctly installed, use the RubyGems package manager (included in Ruby) to install the OpenShift client tools. Run:

C:\Program Files\> gem install rhc

RubyGems downloads and installs the rhc gem from www.rubygems.org/gems/rhc. The installation typically proceeds without errors. After installation is complete, run:

C:\Program Files\> rhc

The OpenShift interactive setup wizard displays and prompts you to complete the rest of the process. If you cannot run OpenShift client tools at this point, please contact us on IRC or post in our forums for more assistance.

Mac OS X

From OS X Lion onwards, Ruby 1.8.7 is installed by default. On older Mac systems, Ruby is shipped as part of the Xcode development suite and can be installed from your installation CD. If you are familiar with Mac development, you can also use MacRuby or see the Ruby installation page for help installing with homebrew.

To verify that Ruby is correctly installed run:

$ ruby -e 'puts "Welcome to Ruby"'
Welcome to Ruby

There are a number of options on Mac OS X for Git. We recommend the Git for OS X installer - download and run the latest version of the dmg file on your system. To verify the Git for OS X installation, run:

$ git --version
git version 1.7.11.1

With Ruby and Git installed, use the RubyGems library system to install and run the OpenShift gem. Run:

$ sudo gem install rhc

After the installation is complete, run:

$ rhc setup

The OpenShift interactive setup wizard displays and prompts you to complete the rest of the process. If you cannot run the OpenShift Client tools at this point, please contact us on IRC or post in our forums for more assistance.

Fedora

RHC client tools are available as an RPM and can be installed with the YUM package manager on Fedora. Keep in mind that this version is not updated as frequently as the the Ruby gem version.

To install using yum on Fedora:

$ sudo yum install rubygem-rhc

This installs Ruby, Git, and the other dependencies required to run the OpenShift client tools..

After the rhc client tools are installed, run:

$ rhc setup

The OpenShift interactive setup wizard displays and prompts you to complete the rest of the process. If you cannot run the OpenShift client tools at this point, please contact us on IRC or post in our forums for more assistance.

To update the OpenShift client tools to the latest version provided by the OpenShift team outside of yum, run:

$ sudo gem update rhc

The most recent version is downloaded and updated.

Red Hat Enterprise Linux 6

We recommend using the Ruby gem on RHEL. You need to install rubygems and git first with:

$ sudo yum install rubygems git

In order to install the rubygems package the RHEL Optional channel must be enabled. There are two ways of doing this from the command line:

# If you are using the Certificate-Based RHN tooling
$ sudo yum-config-manager --enable rhel-6-server-optional-rpms   

# If you are using RHN-Classic
$ sudo rhn-channel --add --channel=rhel-x86_64-server-optional-6

With the repository in place, you can now install the OpenShift client tools. Run:

$ sudo gem install rhc

To update the OpenShift client tools to the latest version run:

$ sudo gem update rhc

After OpenShift client tools are installed, run:

$ rhc setup

The OpenShift interactive setup wizard displays and prompts you to complete the rest of the process. If you cannot run the OpenShift client tools at this point, please contact us on IRC or post in our forums for more assistance.

Ubuntu

Use the apt-get command line package manager to install Ruby and Git before you install the OpenShift command line tools. Run:

$ sudo apt-get install ruby-full rubygems git-core

After you install both Ruby and Git, verify they can be accessed via the command line:

$ ruby -e 'puts "Welcome to Ruby"'
Welcome to Ruby
$ git --version
git version 1.7.11.1

If either program is not available from the command line, please add them to your PATH.

With Ruby and Git correctly installed, you can now use the RubyGems package manager to install the OpenShift client tools. From a command line, run:

$ sudo gem install rhc

If you are using an Ubuntu 11.10 or older (and derivates such as Mint) and are using the system Ruby, you may see errors related to invalid date formats when installing the OpenShift client tools gem. You may need to run the following commands before doing the gem install rhc command:

$ sudo gem install rubygems-update 
$ sudo update_rubygems

Read more about this problem and its symptoms.

After the OpenShift client tools are installed, run:

$ rhc setup

The OpenShift interactive setup wizard displays and prompts you to complete the rest of the process. If you cannot run the OpenShift client tools at this point, please contact us on IRC or post in our forums for more assistance.

Ruby Version Manager

Ruby Version Manager allows you to install and run multiple versions of Ruby. When installing the OpenShift client tools gem onto a system with RVM, you need to install the gem to the global gemset, making it available to all versions of Ruby.

$ rvm gemset use global
$ gem install rhc

No matter which version of Ruby you are running, the rhc command will be available.

Staying Current

Once you've installed the rhc gem, it's very easy to update. Ruby includes a built in mechanism for updating libraries. Just run:

$ gem update rhc

or

$ sudo gem update rhc

and you'll get the latest version of the tools. Be sure to check your specific Operating System instructions above if you have any problems.

Other sources of reference material

For more help see our Get Help page.

Check out the detailed installation guide for RHC client tools.

The "detailed installation guide for RHC client tools" link is 404. Please fix since there are Linux users that don't use RH/Fedora/Ubuntu.

Hi, I also noticed that the Windows instruction says to run the command:

$ rhc

to complete the installation, but I had to run:

$ rhs setup

this is the same as for the other operating instructions.

Hope this helps.

Blessings, Ian Hogan, Systems Integrator, THINKronicity Pty Ltd.

Windows rhc setup instruction is still incorrect.

Command to run after rhc installation should be :
$ rhc setup

Instead of :
$ rhc


Regards,

Thanks for reporting the broken link. It's been fixed. Let us know how it goes.

I followed the steps but still not working for me:

/usr/local/lib/site_ruby/1.8/rubygems/dependency.rb:296:in to_specs': Could not find 'rhc' (>= 0) among 0 total gem(s) (Gem::LoadError) from /usr/local/lib/site_ruby/1.8/rubygems/dependency.rb:307:into_spec' from /usr/local/lib/site_ruby/1.8/rubygems/core_ext/kernel_gem.rb:47:in `gem' from /usr/local/bin/rhc:18

Can you enter a bug here: https://bugzilla.redhat.com/enter_bug.cgi?product=OpenShift%20Origin

Please include steps to reproduce and OS/ruby version used.

The " detailed installation guide for RHC client tools" now points to 404 not found page.

See: https://access.redhat.com/site/documentation/en-US/OpenShift/2.0/html/Getting_Started_Guide/index.html

Can you update this guide to include Arch Linux, there is an automated non-official (Arch User Repository) package to install RHC that does well. and the installation is as easy as:

sudo yaourt rhc

you can find it here: https://aur.archlinux.org/packages/rhc/

FYI, this was missing the bit about adding the rhc gem to your .bashrc path on Debian/Ubuntu (but it's in the detailed docs in the link):

export PATH=/var/lib/gems/1.8/bin:$PATH

Quick and nice.........was able to execute the steps for windows in a jiffy :) thanks so much!!

The following RVM and rhc installation steps is what I did to get a successful installation on Ubuntu & Lubuntu 12.04

Install required packages:

$  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`

Note: Complete these steps with a regular user account. Do not use sudo or Root privileges.

Install RVM Packages

$  curl -L https://get.rvm.io | bash -s stable --ruby

Install a version of ruby

$ rvm install 1.9.3

Add this line to the end of the .bashrc file in user's home directory

[[ -s "$HOME/.rvm/scripts/rvm" ]] && . "$HOME/.rvm/scripts/rvm" `   This loads RVM into a shell session.

$  rvm gemset use global

$  gem install rhc

$  source ~/.bashrc

Type $ rhc and you should see a list of available rhc commands. now you have rvm & rhc properly configured and you can get started

Find more information on RVM here: https://rvm.io/rvm/install/

Install instructions for the OpenShift client tools are also available via our online documentation.

The link in that sentence is incorrect, it contains quotes and breaks when clicked.

Thomas - The url above is a curl request and is not intended to be clicked. The url was automatically hyper-linked by this forum when I posted the data. In any case don't click on the hyperlink. Copy and paste the entire curl request.

-angel

Thank you for reporting the issue. It's working now. The link is to:
https://docs.redhat.com/docs/en-US/OpenShift/2.0/html/Getting_Started_Guide/

The documentation web site and associated link have been updated: https://access.redhat.com/knowledge/docs/en-US/OpenShift/2.0/html/Getting_Started_Guide/index.html