Rails on Debian Wheezy


As Debian Wheezy does not support Ruby >1.9, the easiest way to get a nice Rails configuration in place is to use the method outlined in the book Agile Web Development with Rails 4:

Install the needed packages (as root, or use sudo):

apt-get install apache2 curl git libmysqlclient-dev mysql-server
curl -sL https://deb.nodesource.com/setup_5.x | bash -
apt-get install --yes nodejs

We need the extra (to what the book says) curl here because Debian (at the time of writing at least), unlike Ubuntu, does not include nodejs as a package.

Now, install RVM (as the user we want to do development as):

curl -sSL https://get.rvm.io | bash -s -- --ignore-dotfiles
echo "source $HOME/.rvm/scripts/rvm" >> ~/.bash_profile

We use --ignore-dotfiles as otherwise Debian doesn't get .bash_profile updated.

Then, pull in any other packages that RVM needs (noting that the user needs to be in sudoers):

rvm requirements --autolibs=enable

Install the Ruby we want (2.0.0 in this example) and set it as the default:

rvm install 2.0.0
rvm -default 2.0.0

And finally install the Rails version we want (4.0.0 in this example):

gem install rails --version 4.0.0 --no-ri --no-rdoc