[HowTo] Installing Ruby Enterprise Edition and Passenger on Debian Etch

Install some stuff we will need

apt-get install build-essential apache2 ruby1.8 zlib1g-dev libssl-dev mysql-server mysql-common libmysqlclient15-dev libmysqlclient15off apache2-prefork-dev

Create a link for ruby else the installer won’t work

ln -s /usr/bin/ruby1.8 /usr/bin/ruby

get Ruby Enterprise edition (http://www.rubyenterpriseedition.com/download.html)

tar xzvf ruby-enterprise-X.X.X.tar.gz
./ruby-enterprise-X.X.X/installer

Delete the Ruby link and create new links

rm /usr/bin/ruby
ln -s /opt/ruby-enterprise-1.8.6-20081215/bin/rake /usr/bin/rake
ln -s /opt/ruby-enterprise-1.8.6-20081215/bin/gem /usr/bin/gem 
ln -s /opt/ruby-enterprise-1.8.6-20081215/bin/rails /usr/bin/rails
ln -s /opt/ruby-enterprise-1.8.6-20081215/bin/ruby /usr/bin/ruby

Install Passenger

/opt/ruby-enterprise-1.8.6-20081215/bin/passenger-install-apache2-module

if you have this error

cd /opt/ruby-enterprise-1.8.6-20081215/lib/ruby/gems/1.8/gems/passenger-2.0.6
/opt/ruby-enterprise-1.8.6-20081215/bin/ruby -S rake clean apache2
/opt/ruby-enterprise-1.8.6-20081215/bin/ruby: No such file or directory -- rake (LoadError)

then it looks like the Rake GEM was not installed, just install it now. and don’t forget to create the symlink in /usr/bin !

/opt/ruby-enterprise-1.8.6-20081215/bin/gem install rake

Add this to /etc/apache2/apache2.conf

LoadModule passenger_module /opt/ruby-enterprise-1.8.6-20081215/lib/ruby/gems/1.8/gems/passenger-2.0.6/ext/apache2/mod_passenger.so
PassengerRoot /opt/ruby-enterprise-1.8.6-20081215/lib/ruby/gems/1.8/gems/passenger-2.0.6
PassengerRuby /opt/ruby-enterprise-1.8.6-20081215/bin/ruby

That’s it ! Now you can configure your vhosts.

<VirtualHost 192.168.0.1:80>
  ServerName foo.com
  DocumentRoot /var/rails/
 
  RailsBaseURI /project1
  RailsBaseURI /project2
  RailsBaseURI /project3
 
  Alias /docs "/opt/ruby-enterprise-1.8.6-20081215/lib/ruby/gems/1.8/gems/passenger-2.0.6/doc/Users guide.html"
</VirtualHost>

An finaly, the capistrano config in deploy.rb

set :application, "project1"
set :repository,  "https://svn.foo.com/project1"
set :user, 'root'
set :use_sudo, false
# If you aren't deploying to /u/apps/#{application} on the target
# servers (which is the default), you can specify the actual location
# via the :deploy_to variable:
set :deploy_to, "/var/rails/#{application}"
 
after "deploy:update_code", "deploy:chown"
 
role :app, "foo.com"
role :web, "foo.com"
role :db,  "foo.com", :primary => true
 
namespace :deploy do
  desc "Change owner"
  task :chown, :roles => :app do
    run "chown www-data:www-data -R #{latest_release}"
  end
  desc "Restart Application"
  task :restart, :roles => :app do
    run "touch #{current_path}/tmp/restart.txt"
  end
end

in case you have this error:

script/console production
Loading production environment (Rails 2.1.0)
/opt/ruby-enterprise-1.8.6-20081215/lib/ruby/1.8/irb/completion.rb:10:in `require': no such file to load -- readline (LoadError)
        from /opt/ruby-enterprise-1.8.6-20081215/lib/ruby/1.8/irb/completion.rb:10
        from /opt/ruby-enterprise-1.8.6-20081215/lib/ruby/1.8/irb/init.rb:252:in `require'
        from /opt/ruby-enterprise-1.8.6-20081215/lib/ruby/1.8/irb/init.rb:252:in `load_modules'
        from /opt/ruby-enterprise-1.8.6-20081215/lib/ruby/1.8/irb/init.rb:250:in `each'
        from /opt/ruby-enterprise-1.8.6-20081215/lib/ruby/1.8/irb/init.rb:250:in `load_modules'
        from /opt/ruby-enterprise-1.8.6-20081215/lib/ruby/1.8/irb/init.rb:21:in `setup'
        from /opt/ruby-enterprise-1.8.6-20081215/lib/ruby/1.8/irb.rb:54:in `start'
        from /usr/bin/irb:13

Then some things where missing during install. Let’s install that and compile readling.

cd /root/ruby-enterprise-1.8.6-20081215/source/ext/readline
 
ruby extconf.rb
checking for tgetnum() in -lncurses... no
checking for tgetnum() in -ltermcap... no
checking for tgetnum() in -lcurses... no
checking for readline/readline.h... no
 
apt-get install libncurses5-dev libreadline5-dev

Check once again if everything is installed

ruby extconf.rb
.
.
creating Makefile

and now compile

make
make install

Comments

  1. Gravatar
    March 17th, 2010 | 16:07

    [...] Cristian Livadaru’s blog post about the topic. Install the available Ruby via Yum Enterprise Ruby download page March 17th, 2010 | Tags: CentOS, operation, Ruby | Category: Development, Ruby [...]

Leave a reply

CommentLuv Enabled

Powered by WP Hashcash