Installing Ruby from Source on Ubuntu 12.04 LTS

If you need to install ruby on server, I would suggest Compiling it from source because:

Here is what We will do:

Compile & Install Ruby v2.1.1

Here is what you will need:

Step 0: Update your System

It always a good idea to install all latest available patches for security & compatibility.

$ sudo apt-get update
$ sudo apt-get upgrade -y

Step 1: Install required Dependancies

$ sudo apt-get -y install build-essential libssl-dev libffi-dev libyaml-dev \
git libtool libxslt-dev libxml2-dev libpq-dev gawk curl pngcrush imagemagick \
python-software-properties libreadline libreadline-dev

# If you're on Ubuntu >= 12.10, change:
# python-software-properties to software-properties-common

Step 2: Install Ruby from Source

Download source tarball

$ wget

Extract & CD into it

$ tar xf ruby-2.1.1.tar.gz
$ cd ruby-2.1.1/

Now, last step do infamous configure, make & make install

$ ./configure --disable-install-doc
$ make && make install

If everything went well, you should have latest ruby installed

$ ruby -v
ruby 2.1.1p76 (2014-02-24 revision 45161) [x86_64-linux]

Note: Incase of upgrade to newer version, just do the step 2 again. changing 2.1.1 with the latest version no.