Ruby on Rails – CentOS 5.6/5.7
- February 4th, 2012
- Posted in Documentation
- Write comment
This one presented quite a challenge for me. It seems that the magical solution is using the right versions. There are a number of ways (supposedly) to install ruby on rails. I started out trying to use ruby packages included in CentOS. I quickly realized that was not going to work. It kept running all kinds of issues with libraries missing or incorrect versions. So then, I opted to just build from source. Well, this got me much closer but I ended up having an openssl issue that I thought I resolved, but the gem command was having all kinds of issues. Something clearly was not right. So, I then went back to using RVM, which I had tried earlier. This time I started completely over with a new HPCloud CentOS 5.6 image. The following is what worked for me.
As I mentioned above, I started with a clean HPCloud CEntOS 5.6 image ( ami-000004d2 – local (CentOS 5.6 Server 64-bit) ).
# yum groupinstall “Development Libraries” “Development Tools”
The next step, of course, turned my 5.6 instance into a 5.7 instance:
# yum update
# shutdown -r now
Add the EPEL repository:
# cd /usr/local/src
# wget http://download.fedora.redhat.com/pub/epel/5/i386/epel-release-5-4.noarch.rpm
# rpm -ivh epel-release-5-4.noarch.rpm
# yum install git
Remove certificate requirement for curl, when installing rvm:
# echo insecure >> ~/.curlrc
# bash -s stable < <(curl -s https://raw.github.com/wayneeseguin/rvm/master/binscripts/rvm-installer)
# vigr
...
rvm:x:500:root
Update environment variables:
# source /etc/profile.d/rvm.sh
Install other dependencies for ruby determined by running rvm requirements:
# yum install -y gcc-c++ patch readline readline-devel zlib zlib-devel libyaml-devel libffi-devel openssl-devel make bzip2 autoconf automake libtool bison iconv-devel
# rvm install 1.9.2
# rvm use 1.9.2
Note: You can use the following command to make this version the system default:
# rvm use 1.9.2 –default
To verify that all is right at this point:
# type rvm | head -1
rvm is a function is the expected output.
# cd $(rvm gemdir)
The following will install the gem command:
# rvm rubygems current
This will allow you to install rails:
# gem install rails
This has allowed me (rails is not needed for this) to install hpcloud command to manage my Storage Object.
# wget http://build.hpcloud.com/sites/default/files/downloads/hpfog.tar
# tar -xvf hpfog.tar
# wget http://build.hpcloud.com/sites/default/files/downloads/hpcloud.tar
# tar -xvf hpcloud.tar
# gem install hpfog-x.x.x.gem
# gem install hpcloud-x.x.x.gem
# hpcloud
Tasks:
hpcloud account:setup # set up or modify your credentials
hpcloud acl
Just in case anyone else stumbles upon this blog. The location of the repo has changed. It can now be fetched via
wget http://dl.fedoraproject.org/pub/epel/5/i386/epel-release-5-4.noarch.rpm
Be sure to get the version that matches your processors architecture
@Ben
Thanks for the update.