How to install Ruby on Rails in FreeBSD

freebsd beastie1. Install ruby 1.8
# pkg_add -r -v ruby

2. Install Ruby Gems and Rails
# pkg_add -r -v rubygem-rails

3. Install apache
# pkg_add -r -v apache22

4. Install Passenger (aka mod_rails)
# pkg_add -r -v rubygem-passenger

5. Add lines to LoadModule passenger with apache
# nano /usr/local/etc/apache2/httpd.conf
add the following lines in the httd.conf file:
LoadModule passenger_module /usr/local/lib/ruby/gems/1.8/gems/passenger-3.0.2/ext/apache2/
PassengerRoot /usr/local/lib/ruby/gems/1.8/gems/passenger-3.0.2
PassengerRuby /usr/local/bin/ruby18

6. Restart apache after making changes to the configuration file for any reason, you will need to restart the server:
# /usr/local/sbin/apachectl restart
You can start the server by typing:
# /usr/local/sbin/apachectl start
You can stop the server at any time by typing:
# /usr/local/sbin/apachectl stop
To restart Apache without aborting current connections, run:
# /usr/local/sbin/apachectl graceful

7. Add a database.
# pkg_add -v -r rubygem-sqlite3

Tagged As: , , , ,