Build ruby from source. RVM won’t work out of the box because it tries to use sudo. It’s quite easy.
cd mkdir build cd build http://cache.ruby-lang.org/pub/ruby/2.0/ruby-2.0.0-p247.tar.gz tar xzf ruby-2.0.0-p247.tar.gz cd ruby-2.0.0-p247 ./configure --prefix /home/adamish/ruby # <=== make sure you install to your own home directory make install
Make your custom ruby default. Add the following to your ~/.bash_profile
export GEM_HOME="$HOME/.gems" export GEM_PATH="$GEM_HOME" export PATH=~/ruby/bin:$PATH
Install rails
gem install rails --no-document
Create dummy site for testing
rails new HorseApp mv HorseApp/* . # move to top level
Add following lines to Gemfile
# required for JS runtime gem 'therubyracer' # required for FCGI wrapper gem 'fcgi'
Install the new gems
bundle install
Create FCGI wrapper script – public/dispatch.fcgi
#!/home/adamish/ruby/bin/ruby ENV['RAILS_ENV'] = 'development' ENV['HOME'] ||= `echo ~`.strip ENV['GEM_HOME'] = File.expand_path('~/.gems') ENV['GEM_PATH'] = File.expand_path('~/.gems') require 'fcgi' require File.join(File.dirname(__FILE__), '../config/environment.rb') class Rack::PathInfoRewriter def initialize(app) @app = app end def call(env) env.delete('SCRIPT_NAME') parts = env['REQUEST_URI'].split('?') env['PATH_INFO'] = parts[0] env['QUERY_STRING'] = parts[1].to_s @app.call(env) end end Rack::Handler::FastCGI.run Rack::PathInfoRewriter.new(HorseApp::Application)
Add following to .htaccess
<IfModule mod_fastcgi.c> AddHandler fastcgi-script .fcgi </IfModule> <IfModule mod_fcgid.c> AddHandler fcgid-script .fcgi </IfModule> Options +FollowSymLinks +ExecCGI RewriteEngine On RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^(.*)$ public/dispatch.fcgi/$1 [QSA,L] ErrorDocument 500 "Rails application failed to start properly"
Try it out! You should see the standard “Welcome aboard – You’re riding Ruby on Rails!” development starter page.