08 July 2015

Here are some instructions to install Ruby on Rails using rbenv.

Update the sources

sudo apt-get update

Next, let us install the pre-requisites

sudo apt-get -y install git-core curl zlib1g-dev build-essential libssl-dev libreadline-dev libyaml-dev libsqlite3-dev sqlite3 libxml2-dev libxslt1-dev libcurl4-openssl-dev python-software-properties libffi-dev

Now we come to the Rbenv instructions, copy paste the following instructions on your shell.

git clone https://github.com/sstephenson/rbenv.git ~/.rbenv

echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.bashrc

echo 'eval "$(rbenv init -)"' >> ~/.bashrc

Note: Zsh users please use ~/.zshrc in place of ~/.bashrc.``

git clone https://github.com/sstephenson/ruby-build.git ~/.rbenv/plugins/ruby-build

echo 'export PATH="$HOME/.rbenv/plugins/ruby-build/bin:$PATH"' >> ~/.bashrc

exec $SHELL

git clone https://github.com/sstephenson/rbenv-gem-rehash.git ~/.rbenv/plugins/rbenv-gem-rehash

rbenv install 2.2.2

rbenv global 2.2.2

echo "gem: --no-ri --no-rdoc" > ~/.gemrc

gem install bundler

gem install rails

gem install therubyracer

rbenv rehash

Check if its installed correctly

rails -v

Thanks for reading! Hope this helped!