Loading...

Linux Mongrel and Rails

2007-05-15   [ 0 comments ]

A quick update (although this site deserves much more than a quick update)...

What should you do when you cannot run the following command from the shell?

rails -v

Good question - but don't fret. Its a simple answer to what appears to be a disconcerting problem. All of my development and deployment servers up until a few days ago - have all recognized the ruby and rails command from the shell. But just recently on a new setup - I had the pleasure of experiencing this strange situation.

ruby and rails were both installed, but rails -v was not a recognized shell command!

Lucky enough - I have had the pleasure of being a novice system admin for the past 2 years, and as such I realized the command was not in my /usr/bin directory. So where was it, and why wasn't it setup like all the other installs I have done?

I thought perhaps it was a problem with the gem install method - so I then opted to install rails via "sudo apt-get install rails", but to my dismay that also failed to fix the problem.

After a quick locate of the rails gem:

locate rails | less

I discovered that it was sitting inside the following directory: /usr/lib/ruby/gems/1.8/gems/rails-1.2.3/

And inside that directory was the file bin/rails ... so do the following:

sudo cp /usr/lib/ruby/gems/1.8/gems/rails-1.2.3/bin/rails /usr/bin/rails

sudo chmod 755 /usr/bin/rails

Your almost there - next modify the rails script file in /usr/bin to make certain it uses the proper ruby interpreter...

sudo nano /usr/bin/rails

Add the following line to the top of the file (if it doesnt already exist):

#!/usr/bin/ruby1.8

That should fix it... oh yeah, I also ran into the exact same problem when I did a mongrel setup. Same ordeal - copy the mongrel_rails script from the /bin directory of the right gem into your /usr/bin directory. Chmod it, then modify it to add the #!/usr/bin/ruby1.8

If you forget to add the #!/usr/bin/ruby1.8 into your mongrel_rails file, then you will most likely see an error that looks exactly like this:

/usr/bin/mongrel_rails: line 7: require: command not found
/usr/bin/mongrel_rails: line 8: require: command not found
/usr/bin/mongrel_rails: line 9: require: command not found
/usr/bin/mongrel_rails: line 10: require: command not found
/usr/bin/mongrel_rails: line 11: require: command not found
/usr/bin/mongrel_rails: line 12: require: command not found
/usr/bin/mongrel_rails: line 14: module: command not found
/usr/bin/mongrel_rails: line 15: GemPlugin::Plugin: No such file or directory
/usr/bin/mongrel_rails: line 16: include: command not found
/usr/bin/mongrel_rails: line 18: def: command not found
/usr/bin/mongrel_rails: line 19: options: command not found
/usr/bin/mongrel_rails: line 20: [-e,: command not found
/usr/bin/mongrel_rails: line 20: development],: command not found
/usr/bin/mongrel_rails: line 21: [-d,: command not found

etc....

Well, thats it for the quick update - I've been extremely busy as of late, but I haven't given up on RoR. Besides, I like being busy - especially when I'm learning something new \(^-^)/

:author => "Charles Abbott"
Ruby on Rails - Server Administration
 


Frameworks Good or Bad?   :date => "2007-10-06"
Where is ForTheCode.com Going?   :date => "2007-09-23"
Refactoring - Vital to Software Development   :date => "2007-09-23"
Mongrel Cluster a quick note - and extra notes   :date => "2007-05-20"
Linux Mongrel and Rails   :date => "2007-05-15"
form_remote_tag revisited   :date => "2007-01-07"
How To: Ubuntu 6.10 Edgy on Rails part 3   :date => "2006-12-30"
How To: Ubuntu 6.10 Edgy on Rails part 2   :date => "2006-12-24"
How To: Ubuntu 6.10 Edgy on Rails   :date => "2006-12-22"
verify ... 5.times do cycle   :date => "2006-09-25"
country_select, country_options_for_select, mail_to   :date => "2006-09-05"
Generate and Send Email in Rails   :date => "2006-08-26"
FDF Model, gsub, and send_data   :date => "2006-08-18"
Active Directory Authentication with acts_as_authenticated   :date => "2006-08-17"
Apache2 proxy with Lighttpd - FastCGI for Rails   :date => "2006-08-08"
reverse! && a simple file Upload Class   :date => "2006-07-29"
send_file - a link to download a file   :date => "2006-07-24"
Environments (production, development, test) and cache_pages   :date => "2006-07-04"
.class .methods .instance_variables   :date => "2006-06-14"
select_tag :multiple => true   :date => "2006-06-01"
FileUtils, action_controller rescues   :date => "2006-05-20"
file_field_tag, File.size, File.path, FileUtils.mv   :date => "2006-05-15"
javascript_include_tag, stylesheet_link_tag   :date => "2006-05-02"
submit_to_remote, form_remote_tag, script.aculo.us   :date => "2006-04-30"
periodically_call_remote, simple_format   :date => "2006-04-26"
observe_field - Ajax!   :date => "2006-04-21"
h method, TextHelper, sanitize(), strip_tags()   :date => "2006-04-15"
Rails API :My API [.count(), link_to, text_area :size]   :date => "2006-04-13"
Rails - HTML Select Tag   :date => "2006-04-05"
Pruning Old Sessions   :date => "2006-03-21"
If Elsif Else, and Searching Too!   :date => "2006-03-17"
SHA1 - A quick update   :date => "2006-03-15"
Initialized! good, Authorized? Great! part 2   :date => "2006-03-11"
Initialized! good, Authorized? Great!   :date => "2006-03-08"
Forms and Routing in RoR   :date => "2006-03-06"
My First RoR Post !   :date => "2006-03-05"