How to install ruby / rubygems / passenger on Debian Squeeze / Lenny?

Here are a few steps to get you started:

aptitude update
aptitude install ruby ruby1.8-dev irb rdoc build-essential mysql-client libmysql-ruby libmysqlclient15-dev

 
The enviroment is setup, now we need to install rubygems:

cd /usr/src/
wget http://rubyforge.org/frs/download.php/74619/rubygems-1.7.2.tgz
tar -zxf rubygems-1.7.2.tgz
cd rubygems-1.7.2
ruby setup.rb 

 Setup complete!

gem -v 

 To verfiy the installation has worked so far. If not, you might want to try this:

ln -s /usr/bin/gem1.8 /usr/local/bin/gem 

 Next step is to integrate gem with ruby and install the module for your webserver:

gem install rails -v 2.1
gem install passenger passenger-install-apache2-module

 as alternative for lighttpd:

passenger-install-nginx-module

  For apache we now need to update the module configuration:

vi /etc/apache2/mods-available/passenger.load

add the following line and exit the editor:

LoadModule passenger_module /usr/lib/ruby/gems/1.8/gems/passenger-3.0.7/ext/apache2/mod_passenger.so

same here:

vi /etc/apache/mods-available/passenger.conf
PassengerRoot /usr/lib/ruby/gems/1.8/gems/passenger-3.0.1
PassengerRuby /usr/bin/ruby1.8

Depending on the current version, the path might of course be different, but you get the picture, right?
a2enmod passenger

 Now Apache is all set up, you might want to setup a virtualhost with ruby and have fun...

 

You cannot comment on this entry