Ruby on Rails Installation

From DreamHost
Jump to: navigation, search
DreamHost does not directly support any of the features described on this page and is not responsible for keeping this content updated or accurate. Use at your own risk!
There may be additional information on the talk page.

Please Note

All DreamHost accounts now have Ruby and Rails installed so you don't need to install Ruby or Rails (directions below) unless you have specific requirements that can't be met with the standard config. Even then, you can contact support and request specific gem packages for specific servers if you need them and they will try to accomodate you. To start using Ruby on Rails with Dreamhost, read the Ruby on Rails wiki page.

Installing by Hand

The following script will install the newest version of Ruby, along with RubyGems (a package management framework) and Ruby on Rails. To use it:

  1. Log in to your account using SSH
  2. Create a new file by entering the command:
    vim rubyinstall
  3. Copy the text below into your clipboard. In PuTTY, hit i for insert mode, then right-click to paste your clipboard contents, then hit Esc, type :wq (that's 'colon', 'w', 'q'), and press Enter to save and exit.
  4. Make the file executable by entering the command:
    chmod +x rubyinstall
  5. Run it by entering the command:
  6. You need to add $HOME/local/bin to your path, e.g. add export PATH=$HOME/local/bin:$PATH to your .profile/
  7. Once you've set the path up, generate or re-generate your site following these instructions.

Alternately, Tobias Lutke has enhanced the script some. You can run it from the shell using: curl | sh Note that this installs v. 1.8.2, which is the current dreamhost default. The script below installs 1.8.4.

The Install Script

(Note: Towards the end when the rails installation happens, you'll be prompted a few times about whether or not to install dependencies. Hit y and enter a few times when prompted.)

  • Updated to include readline support which is needed for ruby on rails' script/console, via Creative Stid Blog
  • Updated to fix the path so that the gems install
# setup directories
mkdir -p ~/local/usr/src/ruby
cd ~/local/usr/src/ruby

# Install readline
curl -O
tar xzvf readline-5.1.tar.gz
cd readline-5.1
./configure --prefix=$HOME/local
make install
cd ..

# install ruby
curl -O
tar xzvf ruby-1.8.4.tar.gz
cd ruby-1.8.4
./configure --prefix=$HOME/local --with-readline-dir=$HOME/local/
make install
cd ..

# fix path
export PATH=$HOME/local/bin:$PATH

# get rubygems
curl -O
tar xzvf rubygems-0.8.11.tgz
cd rubygems-0.8.11
$HOME/local/bin/ruby setup.rb config --prefix=$HOME/local
$HOME/local/bin/ruby setup.rb setup
$HOME/local/bin/ruby setup.rb install
cd ..

# Install RAILS
gem install rails --include-dependencies

# Install FastCGI
curl -O
tar xzvf fcgi-2.4.0.tar.gz
cd fcgi-2.4.0
./configure --prefix=$HOME/local
make install
cd ..

# Install FastCGI & MySQL gem packages
gem install fcgi -- --with-fcgi-dir=$HOME/local
gem install mysql -- --with-mysql-config
gem  update