layout: post title: RVM, Passenger 3, REE, Rails3 in a Debian date: 2011-01-03 03:16:23.000000000 +00:00 categories:
- Rails tags:
This post explains how to install a global RVM (Ruby Version Manager) with Passenger 3 gem, Ruby Enterprise Edition in a Debian server machine for all users.
- Create /etc/rvmrc with the contents:
I have chosen /opt/rvm/ for the installation.
- To install RVM, use the cool script provided on rvm’s site:
- To enable RVM in the command-line, add this to /etc/profile at the very end:
Be sure to modify the path /opt/rvm if you have installed rvm elsewhere.
- Re-login to enable rvm command. Now we have RVM environment installed and we will take care of Ruby Enterprise Edition.
- Installing Ruby Enterprise Edition
- Installing Passenger 3.
- Now add/change the paths how Passenger is loaded in /etc/apache2/mods-available/ in the files passenger.load and passenger.conf:
Next enable the module with a2enmod passenger and restart apache. You can verify if Passenger started with grep:
- Next, we will make the REE the default environment and create a default gemset.
If you want normal users to be able to create gemsets and install additional gems, you have to change permissions of /opt/rvm/gems/. This is not very elegant and super-safe solution, but for development machines is ok.
Using RVM in CRON If you try to use RVM in cron the normal way, like:
You will end up with one of the following errors:
command rvm is not found command rake is not found gem XXX is not found
This is due to the fact, that cron commands are run in a very limited environment whereas RVM heavily relies on the environment variables. As a remedy for that situation, you have to invoke bash as if it was invoked by a login shell:
-l is invoking bash with full environment for RVM to work properly. Remember to put the appropriate RVM loading line in the .bashrc ! -c says read the command from the parameter next in the command, you cd to the project directory; this is needed to set up proper RVM environment from the .rvmrc file - so yes, I am assuming you have a file named .rvmrc in your project directory inside which you are selecting the proper gemset