How to install Rails 2.3 Edge on DreamHost

DreamHost is one of the best (cheap 'n' realiable) Hosting for Rails. It offers a lot of services SSH, Mysql, Backup,... (like Site5) but the Rails support is better because you can choose among different technologies: Fcgi(deprecated), Passenger/mod_rails and Webrick(just for test), Mongrel.

Currently the gem installed is Rails 2.2.2, but you have a shell so you can choose (in Theory) whatever Rails version you like.

Some errors you could encounter. Happy DEBUG-gin'!

Manage (ruby)gems by yourself

Managed Hosting are nice because are cheaper than VPN/Virtual Servers, but they manage your environment and this is not good. A bad automatized update could break your apps and to control the dependencies is alwais the best choice.

The gems already present will be used but the priority is on the gems you choose to install in your $HOME.
Here how to setup the Enviroment.

# This is ~/.bash_profile
umask 002
PS1='[\h]$ '
# Added by me
source ~/.bashrc

# This is ~/.bashrc
export PATH="$HOME/.gemlocal/bin:${PATH}"
export GEM_HOME=$HOME/.gemlocal

# This is ~/.gemrc
gemhome: /home/your-username/.gemlocal
- /home/your-username/.gemlocal
- /usr/lib/ruby/gems/1.8
gem: --no-rdoc --no-ri

Re-login and execute:

mkdir ~/.gemlocal
gem install rack --source
gem install sqlite3-ruby
gem install rails --version 2.3.0 --source=

Check the output of "rails -v" and "which rails"

Setup the Domain with Passenger/Rack/Apache

Passenger is a smart webserver and it scales well.

Go to the DH Panel(Domains > Manage Domains) and setup a new domain that points to "/home/your-username/rails-app/public" and don't forget to enable the mod_rails and disable FastCGI.

rails rails-app

..and Congratulations! You should see this Welcome message.

Conclusion and debugging

Remember that You can obtain the "development" mode forcing ENV['RAILS_ENV'] = 'development' in config/environment.rb, very useful to understand what happens, and you can restart the server with "touch tmp/restart.txt" in your rails-app folder.

That's all.


PS: If you need a PROMO CODE to subscribe to DreamHost, the code: WHATZAMERICA gives to you the 60$ of discont on every yearly plan.


corso javascript