I wanted to cut the amount of repositories that my systems were running and I recently came across Red Hats Software Collections (SCL). Software collections is a relatively new system that allows you to run some newer versions of popular packages including ruby, php, postgreSQL and more. I needed a newer version of Ruby (1.9.3) for my systems because I use a backup system that’s written in ruby from Michael van Rooijen. I know that Ruby 1.9.3 might not be new enough for some but it works for me. The following is a quick guide on how to get Centos 6.5 and Ruby 1.9.3 via software collections.
The standard CentOS repositories ships with software collections and its very easy to get them running. You can do so by running the following command.
<br /> yum install -y centos-release-SCL<br />
This will then give you access to the standard SCL’s that ship with CentOS/RHEL. You can build your own software collections if you like but I won’t go into that with this post. Now you will have the newer versions available to install such as ruby193. Run the following to install ruby193.
<br /> yum install -y ruby193<br />
I run minimal installs so I never have any other versions of software installed unless I need them so if I was to run ruby -v on the command line I would get the following:
<br /> [root@machine1 ~]# ruby -v<br /> -bash: ruby: command not found<br />
Now you might think that ruby hasn’t installed, it has it’s just not part of your path or current session. To enable ruby run the following command.
<br /> [root@machine1 ~]# source /opt/rh/ruby193/enable<br /> [root@machine1 ~]# ruby -v<br /> ruby 1.9.3p448 (2013-06-27) [x86_64-linux]<br />
As you can see we’ve now got access to ruby 1.9.3 from the software collections. There is a whole bunch of ruby193 packages available you can find them using search with yum. As I don’t use the standard ruby packages at all I want to make the SCL version my default version. The above commands are great for the current session but you would have to run source every login. A nice way to make sure that this is working across logout and reboots is to put the source command in the profile.
<br /> echo "source /opt/rh/ruby193/enable" | sudo tee -a /etc/profile.d/ruby193.sh<br />
This will make it available as default for all users.