Ruby and Rails on XUbuntu 12.10

I do a fair bit of development. This generally means working in either Ruby on Rails, PHP, Perl or classic asp. I have also started to dabble in QT recently. On the odd occasion I will also write some Assembler using NASM. What I can never remember is the installation of Ruby and Rails on my Linux desktop. So thanks to a post by Andre Honsberg I once again have this installed. However I thought I would post the steps here so that I could remember them next time. This installation method uses RVM which allows multiple versions of Ruby and Rails to co-exist on the same machine. Very useful since two of the web applications that I work on have different Ruby and Rails versions.

Firstly we need some basic pacakges.

sudo apt-get install build-essential git-core curl mysql-client mysql-server libmysql-ruby libmysqlclient-dev ruby1.9.1-dev

Then we install RVM.

bash -s stable < <(curl -s https://raw.github.com/wayneeseguin/rvm/master/binscripts/rvm-installer)

And then we setup the environment so that we can actually install Ruby. Please replace YOURUSER with your username.

echo '[[ -s "/home/YOURUSER/.rvm/scripts/rvm" ]] && source "/home/YOURUSER/.rvm/scripts/rvm"' >> ~/.bashrc

Not lets install Ruby.

rvm install 1.9.3

And finally set as the default

rvm use --default 1.9.3

Now install rails

gem install rails

And that’s basically it.