janikvonrotz
4/23/2014 - 1:34 PM

Ubuntu: Install Ruby and RubyGems with RVM #Ruby #RubyGems

Ubuntu: Install Ruby and RubyGems with RVM #Ruby #RubyGems

Introduction

Ruby is a dynamic, open source programming language with a focus on simplicity and productivity. To install Ruby we are going to use RVM (ruby Version Manager). This installation differs from other as you don't run it with user privilegs, that means no more sudoing for this guide.

Requirements

  • Ubuntu server

Installation

First install RVM with the latest stable release version of Ruby by fetching the RVM install script with curl.

\curl -sSL https://get.rvm.io | bash -s stable --ruby

After the installation add you current user to the rvm group.

sudo adduser [username] rmv

For the same user add the rvm startup script to the bash profile.

echo "source $HOME/.rvm/scripts/rvm" >> ~/.bash_profile

Now log out from the cli and log in to load RVM properly.

Check the installed RVM version.

rvm -v

As RubyGems comes as built-in extension to RVM we don't need to install it.

Source

Installing RVM Setup Ruby On Rails on Ubuntu 14.04 Trusty Tahr
Ruby GitHub repository RubyGems download website

First let's see which is latest relase of ruby.

Download Ruby from the offical ftp server where [version] has to replaced with the latest release.

cd /usr/local/src
sudo wget http://ftp.ruby-lang.org/pub/ruby/ruby-[version].tar.gz

Untar the downloaded package.

sudo tar -xzvf ruby-[version].tar.gz
sudo rm ruby-[version].tar.gz
cd ruby-[version]/

Compile ruby.

sudo ./configure
sudo make
sudo make install

Check the Ruby version.

ruby -v

If everything's ok clone RubyGems from GitHub.

cd /usr/local/src
sudo git clone https://github.com/rubygems/rubygems.git

And install it with Ruby.

cd rubygems/
sudo ruby setup.rb

Check the RubyGems version.

gem -v