How to Install Ruby-RVM

package-managementruby

I want to install a rails environment on Ubuntu 11.04. I tried:

$ sudo apt-get install ruby-rvm

But got the error:

Unable to locate package ruby-rvm

My other PC has Ubuntu 11.10, and this works fine there:

$ sudo apt-get install ruby-rvm
$ rvm install ruby-1.9.3-p125
$ sudo gem update --system
$ sudo gem install rails

Best Answer

The ruby-rvm package is only present since Ubuntu 11.10. Furthermore, one of its dependencies, libreadline-gplv2-dev, only exists under this name since Ubuntu 11.10.

There is a version of ruby-rvm in the Canonical-SIG 3rd party testing PPA. It's for testing, so there may be bugs. See Add a Personal Package Archive (PPA) in the Ubuntu documentation for how to install software from a PPA.

You can grab the package source and compile it on your machine. Download the source from the Ubuntu 11.10 package page (you need all three files: .dsc, .orig.tar.gz and .debian.tar.gz). Install development tools and build dependencies, compile the package, install run-time dependencies and install the package.

wget http://archive.ubuntu.com/ubuntu/pool/universe/r/ruby-rvm/ruby-rvm_1.6.9-0ubuntu2.dsc http://archive.ubuntu.com/ubuntu/pool/universe/r/ruby-rvm/ruby-rvm_1.6.9.orig.tar.gz http://archive.ubuntu.com/ubuntu/pool/universe/r/ruby-rvm/ruby-rvm_1.6.9-0ubuntu2.debian.tar.gz
sudo apt-get install build-essential fakeroot debhelper ruby
dpkg-source -x ruby-rvm_1.6.9-0ubuntu2.dsc
cd ruby-rvm*
dpkg-buildpackage -rfakeroot -b -nc -us -uc
cd ..
apt-get install adduser bison curl file git libreadline5-dev libsqlite3-dev libxml2-dev zlib1g-dev
dpkg -i ruby-rvm_1.6.9-0ubuntu2_*.deb
Related Question