Ruby on Rails on Solaris 10 Howto
This has been obsoleted by newer instructions
Installing a Ruby on Rails development environment on Solaris 10 just got a lot easier now that that the latest version of Solaris 10 comes with a fully integrated PostgreSQL database including libraries and header files. No more needing to separately install a database system!
Here's the instructions I used to get Rails up and running on Solaris 10, including Ruby and RubyGems. First, some preliminaries:
/etc/release file and ensuring that you see "Solaris 10 6/06" (or later)/opt/local. Whatever you use, you'll want to add the bin directory to your $PATH, e. g. PATH=$PATH:/opt/local/bin before starting.
% wget ftp://ftp.cwru.edu/pub/bash/readline-5.2.tar.gz
% gzcat readline-5.2.tar.gz | tar xf -
% cd readline-5.2
% configure --prefix=/opt/local
% gmake
% su
# /usr/sfw/bin/gmake install
% wget ftp://ftp.ruby-lang.org/pub/ruby/ruby-1.8.5.tar.gz
% gzcat ruby-1.8.5.tar.gz | tar xf -
% cd ruby-1.8.5
% configure --prefix=/opt/local --enable-pthread \
--with-readline-dir=/opt/local
% gmake
% gmake test
% su
# /usr/sfw/bin/gmake install
# /usr/sfw/bin/gmake install-doc
% wget http://rubyforge.org/frs/download.php/11289/rubygems-0.9.0.tgz
% gzcat rubygems-0.9.0.tgz | tar xf -
% cd rubygems-0.9.0
% su
# /opt/local/bin/ruby setup.rb
% su
# PATH=$PATH:/opt/local/bin
# export PATH
# gem install rails --include-dependencies
% wget http://ruby.scripting.ca/postgres/archive/ruby-postgres-0.7.1.tar.gz
% gzcat ruby-postgres-0.7.1.tar.gz | tar xf -
% cd ruby-postgres-0.7.1
% ruby extconf.rb --with-pgsql-include-dir=/usr/include/pgsql
% gmake
% su
# PATH=$PATH:/usr/sbin
# export PATH
# gmake install
# groupadd postgres
# useradd -c "PostgreSQL User" -d /export/home/postgres \
-g postgres -m -s /bin/bash postgres
# chown postgres /var/lib/pgsql/data
# chmod 700 /var/lib/pgsql/data
# su postgres
# initdb -D /var/lib/pgsql/data
# su - postgres
# pg_ctl -D /var/lib/pgsql/data -l logfile start
# createuser your-login-name # This lets you perform DB operations
You're done! Now following the Agile Web Development With Rails book, try the "Hello World" example:
% mkdir work
% rails demo
{ in another window }
% cd demo
% ruby script/server # Start the built-in WEBrick web server
Now point your browser to: http://localhost:3000 and see if you get the "Welcome Aboard" page:

Of course, to do a real Rails app we need to use the database that we setup earlier. This example shows the setup of the Depot application, discussed in Chapter 6 of the book.
% cd work
% rails depot
% createdb depot_development
% createdb depot_test
% createdb depot_production
work/depot/db/create.sql that looks like this:
create table products (
id SERIAL,
title varchar(100) not null,
description text not null,
image_url varchar(200) not null,
price decimal(10,2) not null,
primary key(id)
);
auto_increment modifier, given in the book, to the PostgreSQL SERIAL type above.
One more change: Modify the work/depot/config/database.yml file to point to your PostgreSQL database. Ignoring the comments, it should look something like this, if lefty is your login name:
development:
adapter: postgresql
database: depot_development
username: lefty
password:
host: localhost# Warning: The database defined as 'test' will be erased and
# re-generated from your development database when you run 'rake'.
# Do not set this db to the same as development or production.
test:
adapter: postgresql
database: depot_test
username: lefty
password:
host: localhostproduction:
adapter: postgresql
database: depot_production
username: lefty
password:
host: localhost
products table definition:
% psql depot_development < db/create.sql
% ruby script/generate scaffold Product Admin
% ruby script/server
Posted at 10:33PM Aug 24, 2006 by Peter Schow in Sun | Comments[1]
Posted by VVS on August 25, 2006 at 12:59 PM MDT #