Install Ruby 1.9.3 on a shared hosting non root

I’ve got through a bit of a hurdle to get Ruby 1.9.3 installed on my shared host.
My host is PlanetHoster, but this walkthrough should work with any host giving you a decent development suite (gcc, ld, make…), like 1and1, OVH…

This is how I did it:

  1. Get libyaml from LibYAML site, as it is a dependency for Ruby. Then compile it and install it locally.
    > mkdir libyaml
    > cd libyaml
    > wget http://pyyaml.org/download/libyaml/yaml-0.1.4.tar.gz
    > tar xvzf yaml-0.1.4.tar.gz
    > cd yaml-0.1.4
    > ./configure --prefix=/your/home/libyaml/yaml-0.1.4-install
    > make
    > make install
    
  2. Get Ruby from its sources in a local directory on your account. Then compile it and install it with the path to previously installed library.
    > mkdir ruby-1.9.3
    > cd ruby-1.9.3
    > wget http://cache.ruby-lang.org/pub/ruby/1.9/ruby-1.9.3-p484.tar.gz
    > tar xvzf ruby-1.9.3-p484.tar.gz
    > cd ruby-1.9.3-p484
    > ./configure --prefix=/your/home/ruby-1.9.3/ruby-1.9.3-p484-install --with-opt-dir=/your/home/libyaml/yaml-0.1.4-install
    > make
    > make install
    
  3. Add Ruby to your PATH. Set this line in your .bashrc if you want it to be definitive.
    > export PATH="/your/home/ruby-1.9.3/ruby-1.9.3-p484-install/bin:${PATH}"
    

And that’s all: you’ve got a fully running Ruby installation without root access:

> ruby -v
ruby 1.9.3p484 (2013-11-22 revision 43786) [x86_64-linux]
> gem -v
1.8.23

Enjoy!

About Muriel Salvan

I am a freelance project manager and polyglot developer, expert in Ruby and Rails. I created X-Aeon Solutions and rivierarb Ruby meetups. I also give trainings and conferences on technical topics. My core development principles: Plugins-oriented architectures, simple components, Open Source power, clever automation, constant technology watch, quality and optimized code. My experience includes big and small companies. I embrace agile methodologies and test driven development, without giving up on planning and risks containment methods as well. I love Open Source and became a big advocate.
Howto, Ruby, Web development , , , , , , ,

Leave a Reply

Your email address will not be published. Required fields are marked *