2012-07-18

Install Passenger + Ruby 1.9.3 on Fedora 16

Assuming that you have installed ruby 1.9.3 from the sources, these are the steps to follow to get Passenger running your favourite Rails app on Fedora 16.

First, let's install Passenger apache module

sudo yum install -y httpd httpd-devel apr-devel apr-util-devel sudo /opt/ruby1.9.3/bin/gem install passenger
sudo /opt/ruby1.9.3/bin/passenger-install-apache2-module

Then let's configure apache to load passenger

sudo vim /etc/httpd/conf.d/passenger.conf
(Now add the lines mentioned in the output of the previous step, usually something along these lines:)
LoadModule passenger_module /opt/ruby1.9.3/lib/ruby/gems/1.9.1/gems/passenger-3.0.13/ext/apache2/mod_passenger.so
PassengerRoot /opt/ruby1.9.3/lib/ruby/gems/1.9.1/gems/passenger-3.0.13
PassengerRuby /opt/ruby1.9.3/bin/ruby

Then you should add something like this for your rails app. Customized of course:

<VirtualHost *:80>
    ServerName www.myrailsapp.net
    ServerAlias myrailsapp.net
    DocumentRoot /home/hkroger/myrailsapp/current/public
    <Directory /home/hkroger/myrailsapp/current/public>
 Options FollowSymLinks -MultiViews
        Allow from all
    </Directory>
</VirtualHost>

Restart the apache with sudo /etc/init.d/httpd restart and you are good to go!

2012-07-17

Install Ruby 1.9.3 from sources on Fedora 16

This is an easy way to install Ruby 1.9.3 from source on Fedora 16. Probably works on a bunch of other platforms too. Here we assume that you have no other ruby installed on the system.

Here it goes.

Install some needed libraries:

sudo yum install -y libyaml libyaml-devel gcc

Now let's download ruby and compile it:

wget http://ftp.ruby-lang.org/pub/ruby/1.9/ruby-1.9.3-p194.tar.gz
tar xzvf ruby-1.9.3-p194.tar.gz
cd ruby-1.9.3-p194
./configure --prefix /opt/ruby1.9.3/ --enable-shared && make
sudo make install

Then let's setup the profile to include ruby path and let's run it under sudo

sudo -s
cat <<EOF > /etc/profile.d/ruby.sh
export PATH=$PATH:/opt/ruby1.9.3/bin
EOF
chmod +x /etc/profile.d/ruby.sh
exit

That's it! Logout, login and now you can run ruby, irb or gem.