This has been a problem encountered by several developers including myself:

Getting RVM, Passenger and Rails3 to work

Here's a quick and short post. Supposing you already have updated Ubuntu and have Ruby installed.
These are the only commands you should need:

rvm install 1.9.2

rvm 1.9.2 --passenger

rvm 1.9.2
gem install passenger

rvmsudo passenger-install-nginx-module

#use rvm by default
rvm 1.9.2-preview3 --default

#edit the nginx config file. mine is on /opt/nginx/conf/nginx.conf. just change username 

passenger_root /home/username/.rvm/gems/ruby-1.9.2-preview3/gems/passenger-2.2.15;
passenger_ruby /home/username/.rvm/bin/passenger_ruby;

#reboot if you can. I recommend rebooting over restarting/stopping and starting nginx server. reboot was actually the fix I needed after following all the steps above. 

sudo reboot 

#.rvmrc file on your Rails 3 app should contain. this may be optional but in case you've set a different ruby version, this helps. 

if [[ -s "~/.rvm/environments/ruby-1.9.2-preview3" ]] ; then
  . "~/.rvm/environments/ruby-1.9.2-preview3"
  rvm --create use  "ruby-1.9.2-preview3"

If nothing works for you. Check your path, your ruby version and check whether bundler is installed.

How to installed bundler for Rails 3:

gem install bundler --pre

Most gems for Rails 3 require "--pre" by the way.

Installing gems

cd app/dir && bundle install

It's that simple. But something failed. I use mysql and pg gem. I use mysql gem for test and development environment because they work better for testing. But I use postgresql for production and staging. Mysql gem was not installed by bundler. You have to run this:

gem install mysql -- --with-mysql-config=/usr/bin/mysql_config

Hope this helped someone.

comments powered byDisqus

Hello! I am Kat. I've been a developer for several years. When I'm not sitting down, reading and working for long hours, I am traveling to some place of interest.
If you want to reach out, you can send me an email or add me up on Google Plus.