Regarding why your experience was difficult I'm not sure that can be answered without more knowledge of what exactly you did. Regarding your question of "is this pretty normal?" I'm not sure it can be answered definitively but I can relay my experience in hope that it's helpful!
I've been developing on Rails with Ubuntu for over two years and can say that I never had to deal with broken packages or touch/rebuild code in any of the required packages. I completely reinstall with every release and my experience has been that it's easier to setup my Rails environment with each release (likely due to growing experience). In general, after a clean install of Ubuntu, I would say that it takes me under an hour (at times much less) to get my environment to the stage where it was before the clean install.
A couple days ago I followed the linked tutorial to completely re-setup my Rails development environment on 11.10. I previously was using package manager Ruby packages, which worked fine until I needed to run multiple versions of Ruby. Note that relying on the package manager packages for Ruby development is generally considered not the best way to develop Ruby on Ubuntu (see the linked article for details) but it has always worked fine for me in the past (when you only need one version of Ruby, Rails and Gems).
I think one thing that differentiates Linux from some other OS's is the ability to go about doing something in many different ways, while in some other OS's it may only be possible in one particular way. This is true of setting up your development environment (there are multiple ways to do it) and it's easy to see this leading to confusion and the need to consult different guides. From my limited experience, using the RVM bash install script in the linked article has been the easiest (that is, considering the major benefits of RVM, if RVM is of no benefit to you then there may be easier ways such as the package manager).
If you are more familiar with developing in Windows and are setting up Ubuntu for development for the first time I think it's reasonable to expect it to take longer simply because many things take longer the first time we learn to do them. If it ends up being "traumatic" then I just hope you can find the experience and knowledge that you gained valuable :)
http://ryanbigg.com/2010/12/ubuntu-ruby-rvm-rails-and-you/
/usr/bin/env ruby
should be pointing to the RVM ruby.
But lets check your setup
Check the contents of your ~/.profile
, it should contain something like these 2 lines:
export PATH="$PATH:$HOME/.rvm/bin" # Add RVM to PATH for scripting
[[ -s "$HOME/.rvm/scripts/rvm" ]] && . "$HOME/.rvm/scripts/rvm" # This loads RVM
Second, check your installed ruby version:
rvm list
this should output something like the following:
rvm rubies
=* ruby-1.9.3-p286 [ x86_64 ]
# => - current
# =* - current && default
# * - default
if not, try running rvm use 1.9.3 --default
When trying to run your script as root, be sure to use rvmsudo ./yourscript.rb
instead of sudo ./yourscript.rb
, this makes sure it sets the correct $PATH
.
Let me know the outcome of the above three steps.
Best Answer
It sounds like the environment necessary for the system to find the installed ruby components is specified in a file that only gets read for login shells. The bash manual page has this to say about the difference between login shells and non-login shells:
and
whereas
Hence if the ruby environment variables are in
/home/rails/.profile
or/etc/profile
for example, they will be added to the shell environmentsu -l rails
orsu --login rails
or the shorthandsu - rails
rails
logs in via SSHbash --login
after loginIf you want the ruby environment to be set regardless of how you switch to user
rails
, you could move the relevant variable definitions to the user's~/.bashrc
instead.