Tutorial: ruby

Looking to the Ruby packages of Redhat, Debian, etc you will see that they are quite old. But you can install quite any version of Ruby (including JRuby, MacRuby, etc) with the help of rvm.io. Another advantage of rvm is that every user installs his own Ruby and his own set of gems. You are also able to install different versions of Ruby at the same time and switch between every installed version.

So let's install Ruby 2.0.0:

  • Create .gemrc in your home folder to ensure that rdoc and ri are not installed for every gem (save space and time)

    echo -e "install: --no-rdoc --no-ri\nupdate: --no-rdoc --no-ri" > ~/.gemrc
    
  • Install rvm/ruby dependencies

    sudo apt-get install curl git git-core libcurl3 libcurl3-gnutls liberror-perl /
    libldap-2.4-2 libsasl2-2 libsasl2-modules libssh2-1 patch
    
    sudo apt-get install g++ gcc libc6-dev libreadline6 libreadline6-dev zlib1g-dev /
    libssl-dev libyaml-dev libsqlite3-dev sqlite3 libxml2-dev libxslt-dev libxslt1-dev /
    autoconf libc6-dev libgdbm-dev ncurses-dev libncurses5-dev automake libtool bison /
    pkg-config libffi-dev openssl zlib1g zlib1g-dev
    
  • Install rvm with local user

    curl -L https://get.rvm.io | bash -s stable
    
  • Add rvm to your path (one time only - this is added to your .bashrc)

    source ~/.rvm/scripts/rvm
    
  • Compile and install iconv and openssl to easy your life

    rvm pkg install iconv
    rvm pkg install openssl
    
  • Browse list of available Ruby versions

    rvm list known
    
  • Install Ruby

    rvm install 2.3.0
    
  • Run Ruby

    ruby -v
    

Optional: Install MySQL client:

apt-get install mysql-client-5.5 libmysqlclient15-dev