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:
- 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
- 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
- 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!