Install Ruby from Source on Ubuntu
Sometimes compilation fails because of unmet system dependencies, or compilation succeeds but the new Ruby version exhibits weird failures at runtime. The following instructions are our recommendations for a sane build environment:
You can install Ruby from source. Download and unpack a tarball, then just do this:
By default, this will install Ruby into /usr/local. To change, pass the –prefix=DIR option to the ./configure script.