Getting rails 4 up and running with rbenv on Ubuntu 13.10

Tim Abell · December 4, 2013

Brain dump warning!

This is a follow up to http://timwise.blogspot.co.uk/2013/05/installing-ruby-2-rails-4-on-ubuntu.html and is just a list of steps needed to get a clean install of Ubuntu up to speed with an existing site.
<ul><li dir="ltr">Install rbenv to manage ruby versions</li><ul><li dir="ltr">https://github.com/sj26/rbenv-install</li><li dir="ltr">git clone https://github.com/sstephenson/rbenv.git ~/.rbenv</li></ul><li>Install ruby-build to manage installation of ruby versions into rbenv</li><ul><li>https://github.com/sstephenson/ruby-build</li><li>git clone https://github.com/sstephenson/ruby-build.git ~/.rbenv/plugins/ruby-build</li></ul><li>For convenience install dotmatrix - this will set up the rbenv environment correctly, amongst other things</li><ul><li>clone https://github.com/timabell/dotmatrix</li><li>run bin/install</li><li>restart any running terminal(s) to get rbenv</li></ul></ul><ul><li dir="ltr">get a project (includes a .ruby-version file for rbenv, and a Gemfile for bundle)</li><ul><li dir="ltr">git clone git@github.com:timabell/symbol-library.git</li></ul><li>sudo apt-get install libssl-dev libreadline-dev</li><ul><li dir="ltr">readline is needed for rails console, and has to be installed before ruby. If you’ve already installed ruby then just re-run rbenv install and it will overwrite the existing build with a version with readline support. ref: http://vvv.tobiassjosten.net/ruby/readline-in-ruby-with-rbenv/</li></ul><li dir="ltr">rbenv install x.x.x-xxxx</li><ul><li dir="ltr">autocompletes, yay!</li><li dir="ltr">.. or better still reads from .ruby-version I think so you can just run rbenv install if you are in the project folder</li></ul><li dir="ltr">gem install bundler
<ul><li dir="ltr">from the right directory so done for right ruby version</li><li dir="ltr">rbenv rehash</li></ul></li><li dir="ltr">bundle
<ul><li dir="ltr">will install all the gems for the project</li></ul></li><li dir="ltr">don't sudo apt-get install rbenv ~ doesn’t provide sufficiently up to date ruby</li><li dir="ltr">gem install rails --version 4.0.2 --no-ri --no-rdoc ~ don’t need this when you have a gem file with rails in it, bundle will do it for you</li><li dir="ltr">sudo apt-get install nodejs
<ul><li dir="ltr">for javascript runtime (rails server throwing an error without this)</li></ul></li><li dir="ltr">bundle exec rails server</li><li dir="ltr">bundle exec rails console</li><ul><li dir="ltr">needs readline (see above)</li></ul></ul><div>Other stuff I like in my install
<ul><li dir="ltr">dotmatrix bin/vimbundles
<ul><li dir="ltr">includes vim-rails and friends</li><li dir="ltr">full list https://github.com/timabell/dotmatrix/blob/master/bin/vimbundles.sh#L45</li></ul></li><li dir="ltr">console colours from bin/solarize.sh in dotmatrix/bin</li><li dir="ltr">tmux</li></ul><div>This is mostly for my own reference but maybe it’ll help someone else out.</div></div>

Share: Tweet | LinkedIn
Suggest improvments: page source on github