Sunday, December 1, 2013

How to install Ruby with Rbenv and tools in Ubuntu 13.10 / Mint 16

Install some basics
$ sudo apt-get install zlib1g zlib1g-dev build-essential sqlite3 libsqlite3-dev openssl libssl-dev curl git libmagick++-dev

Use git to install rbenv and the ruby-build plugin
$ git clone https://github.com/sstephenson/rbenv.git ~/.rbenv
$ git clone git://github.com/sstephenson/ruby-build.git .rbenv/plugins/ruby-build

Mint
$ echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.bash_profile
$ echo 'eval "$(rbenv init -)"' >> ~/.bash_profile

Ubuntu
$ echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.bashrc
$ echo 'eval "$(rbenv init -)"' >> ~/.bashrc

Close and reopen terminal
$ type rbenv
Should return rbenv is a function at the prompt

List Ruby versions known to rbenv
$ rbenv install -l

Install the version you require and set it as global
rbenv install 2.0.0-p353
rbenv rehash
rbenv global 2.0.0-p353

Add ssh key
ssh-keygen
ssh-agent /bin/bash
ssh-add ~/.ssh/id_rsa
cat ~/.ssh/id_rsa.pub
Copy & paste result as a new ssh key to your Github / Bitbucket account

Add git global config
git config --global push.default simple
git config --global user.name "name surname"
git config --global user.email email@example.com
git config --global color.ui auto

gem install bundler
Restart terminal to use bundle command within a project folder

Pre-load environment for fast rails commands
gem install zeus
Restart terminal to use zeus commands
  • zeus start
  • zeus test xxx
  • zeus s
  • zeus rake