A recent stable release of Ruby with Rails 3.2.8 and a large collection of Ruby gems. This Software Collection gives developers on Red Hat Enterprise Linux 6 access to Ruby 1.9, which provides a number of new features and enhancements, including improved Unicode support, enhanced threading, and faster load times.
You can get started in three easy steps:
# 1. Install a package with repository for your system: # On CentOS, install package centos-release-scl available in CentOS repository: $ sudo yum install centos-release-scl # On RHEL, enable RHSCL repository for you system: $ sudo yum-config-manager --enable rhel-server-rhscl-7-rpms # 2. Install the collection: $ sudo yum install ruby193 # 3. Start using software collections: $ scl enable ruby193 bash
The last command runs the Bash shell in the environment with ruby193 Software Collection enabled, which means that at this point you are able to use ruby just as a normal application. Some examples of available commands follow:
$ ruby my-app.rb $ gem install activeresource $ bundle $ irb
In order to view the individual components included in this collection, including additional rubygems plugins, you can run:
$ sudo yum list ruby193\*
Community Project: Maintained by upstream communities of developers. The software is cared for, but the developers make no commitments to update the repositories in a timely manner.
Related software collections
Some packages from this collection require packages provided by these collections:
This collection provides packages, which may be required by some package from these collections:
Related COPR projects
Yum Repositories Nov. 12, 2014, 3:12 p.m.
|Operating system||Package with repo||Browse files|
|CentOS 6||yum install centos-release-scl-rh||x86_64|
|CentOS 7||yum install centos-release-scl-rh||x86_64|
|RHEL 6||yum-config-manager –enable rhel-server-rhscl-6-rpms|
|RHEL 7||yum-config-manager –enable rhel-server-rhscl-7-rpms|
Ruby on Rails 3.2 on Red Hat Enterprise Linux 6 with Software Collections
While Red Hat Enterprise Linux is known for its stability and flexibility, you might not think of it first when looking for the latest version of your web application framework. If you’re a developer working with Ruby and Ruby on Rails, you probably want to take advantage of their new features. Sure, you can use RVM, but sometimes you just want to get supported system packages.
Software Collections (often abbreviated as SCL) allows you to run more recent versions of software than what ships with your current version of Red Hat Enterprise Linux. This article will show you how to start development of a Rails 3.2 application running on Ruby 1.9.3 – all on RHEL 6, using only RPM packages, alongside your default Ruby installation. This tutorial assumes that you are familiar with Ruby on Rails basics, such as creating a new application and using bundler. It is also beneficial (although not necessary) to understand how Software Collections work in general.
Installing the ruby193 Collection
Throughout this tutorial, we will be using the ruby193 SCL. To get started, we will need to add it to Yum repositories. Grab a copy of the repofile and put it in
Now you can install all the packages needed for creating a Rails 3.2 application just by running (with proper privileges, of course)
yum install ruby193
While this takes some time, you’ll have all the packages that you need for this exercise.
Kickstarting a New Application
Now that the collection is installed, you can create a new Rails application. It is important to note that all Ruby-related commands must be run in the SCL enabled environment. Otherwise they will not work or may trigger unexpected behavior.
You can run Ruby-related commands in the SCL enabled environment in two ways.
1. Run every command in SCL enabled environment like this:
scl enable ruby193 "ruby -v"
2. Run a subshell (more convenient and comfortable) that will be SCL enabled itself:
scl enable ruby193 "bash"
In this subshell, you can run any command as you normally would without having to remember to use “
scl enable" for every command. Don’t forget to enable the SCL every time you run anything that needs Ruby (e.g. rspec, minitest, rails, …).
To create a new application called “app”, you need to issue the command:
rails new app
This will create a standard Rails 3.2 application with one small change in the way that Bundler is run.
Normally, when creating a new Rails application, the generator calls “
bundle install", which results in installing the newest versions of all Gems; this would render the SCL packaged Gems useless, as most of them would be rendered obsolete by newer versions and not be used. If you are choosing the collection for development, you probably don’t want that. The default generator has been altered to run “
bundle install --local", which utilizes the newest local versions of Gems (the ones from the collection). If you don’t like this setup, you can always delete
app/Gemfile.lock and run “
bundle install" in the app directory to get the newest versions.
Generally, if you want to start using a new Gem that is part of the collection (run
"yum list 'ruby193-*'" to see the complete list, not all are installed by default), you have to
- install it with Yum (
"yum install ruby193-rubygem-foo")
- add it to
- run “
bundle install --local".
If you want to use a classic Gem from rubygems.org, you only need to add it to
Gemfile and run “
Running the Application
Now that the application is created, you can try to run it. Use:
cd app rails s
You will get an error message containing this string:
Gemfile in your favorite text editor and uncomment the line that reads:
# gem 'therubyracer', :platforms => 'ruby'
Next run “
bundle install --local" again. Now try running the development server again:
Success! You can now go to http://0.0.0.0:3000/ to see the title page of your new Ruby on Rails 3.2 application on RHEL 6. Everything is set, so you can start coding just as you are used to.
Red Hat Software Collections or Red Hat Developer Toolset are part of most Red Hat Enterprise Linux subscriptions and all RHEL Developer Subscriptions. They can be found in the Software Collections channel. For more information about Red Hat Software Collections or Red Hat Developer Toolset, visit https://access.redhat.com/products/Red_Hat_Enterprise_Linux/Developer/.
Be sure to join developers.redhat.com which lets you get Red Hat software for your software development. Both the program and software are free!