Skip to content

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!

Leave a Reply

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