2012-07-17

Install Ruby 1.9.3 from sources on Fedora 16

This is an easy way to install Ruby 1.9.3 from source on Fedora 16. Probably works on a bunch of other platforms too. Here we assume that you have no other ruby installed on the system.

Here it goes.

Install some needed libraries:

sudo yum install -y libyaml libyaml-devel gcc

Now let's download ruby and compile it:

wget http://ftp.ruby-lang.org/pub/ruby/1.9/ruby-1.9.3-p194.tar.gz
tar xzvf ruby-1.9.3-p194.tar.gz
cd ruby-1.9.3-p194
./configure --prefix /opt/ruby1.9.3/ --enable-shared && make
sudo make install

Then let's setup the profile to include ruby path and let's run it under sudo

sudo -s
cat <<EOF > /etc/profile.d/ruby.sh
export PATH=$PATH:/opt/ruby1.9.3/bin
EOF
chmod +x /etc/profile.d/ruby.sh
exit

That's it! Logout, login and now you can run ruby, irb or gem.

No comments:

Post a Comment