view · edit · sidebar · attach · print · history
$ cd /var
$ sudo mkdir www
$ cd www
$ sudo git clone git://scm.ywesee.com/oddb.org/.git

Install a single gem:

$ gem install activesupport

Installed the remaining gems by using a shell script, cereated file install-gems.sh

gem install akami archive-tarsimple bigdecimal builder dbd-pg dbi deprecated
facets fastthread flexmock gd gruff gyoku hpricot htmlgrid httpi i18n innate
io-console json mail mechanize mime-types minitest money multi_json needle
net-http-digest_auth net-http-persistent nokogiri nori odba oddbtdat
parseexcel paypal pg pre polyglot rack rake rake-compiler ramaze rclconf rdoc
rmagick rmail rockit rpdftxt ruby-ole rubyzip rwv savon sbsm spreadsheet
swissmedic_diff tmail treetop turing wasabi webrobots ydim yus

Executed the shell script

$ chmod 777 install-gems.sh
$ ./install-gems.sh

Received error messages for two gems: gd and net-http-digest_auth

Checked gem and ruby version

$ ruby -v
1.9.3p0
$ gem -v
1.8.5

Launching oddbd

$ cd /var/www/oddb.org
$ bin/oddbd

Errors about missing files, fixed by installing the following gems

$ gem install odba sbsm ydim rclconf yus spreadsheet util

Error about util/quanty. quanty needs to be installed with ruby 1.8

$ cd /var/www/oddb.org/data/quanty
$ sudo eselect ruby set 1.8
$ sudo ruby extconf.rb
$ sudo make
$ sudo make install

Launching oddbd

$ sudo eselect ruby set 1.9
$ cd /var/www/oddb.org
$ bin/oddbd

Error about file encoding of quanty/parse.rb that needs to be set to ASCII for ruby 1.8
The folder quanty only has a file parse.y, not parse.rb
Locate the file in question

$ locate parse.rb
/var/www/oddb.org/data/quanty/lib/quanty/parse.rb
/var/www/oddb.org/src/util/quanty/parse.rb
$ sudo vim /var/www/oddb.org/src/util/parse.rb

added first line

# encoding: UTF-8

More missing gems when running bin/oddbd

$ gem install zip savon swissmedic_diff flickraw oddbtdat

Error about permissions when running mkdir, fixed by creating the subfolder manually

$ cd /var/www/oddb.org/data
$ sudo mkdir downloads

Error about rmagic
/usr/lib64/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require': cannot load such file -- RMagick (LoadError)

$ gem install rmagic
$ gem install paypal

Error:
/home/alex/.gem/ruby/1.9.1/gems/paypal-2.0.0/lib/notification.rb:52:in `<class:Notification>': undefined method `cattr_accessor' for Paypal::Notification:Class (NoMethodError)

Edited
$ sudo vim /home/alex/.gem/ruby/1.9.1/gems/paypal-2.0.0/lib/notification.rb

Added line

require 'active_support/core_ext/class/attribute_accessors'

Error
/usr/lib64/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require': cannot load such file -- facet/string/singular (LoadError)

Check what remote gems are available

$ gem search facet -r
*** REMOTE GEMS ***
blacklight_facet_extras (0.0.2)
facet_for (0.1.5)
facets (2.9.3)
mack-facets (0.8.3.1)
mark_facets (0.2.0)
repertoire-faceting (0.5.4)

$ gem install facets --version 1.8.54

Error
/usr/lib64/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require': cannot load such file -- etc/db_connection (LoadError)

$ cd  /var/www/oddb.org/etc
$ sudo vim db_connection.rb

The file contains this code

require 'dbi'
require 'odba/connection_pool'                                                    
require 'pg'                                            

ODBA.storage.dbi = ODBA::ConnectionPool.new('DBI:Pg:oddb.org.ruby193','postgres', '')
#ODBA.storage.dbi = ODBA::ConnectionPool.new('DBI:Pg:oddb.org','postgres', '') 

Postgresql

verified that the file
/etc/make.conf contains
ACCEPT_KEYWORDS="~amd64"

$ sudo emerge "=postgresql-server-8.4.10-r1"
$ cd /var/www/oddb.org
$ bin/oddbd

Error
/usr/lib64/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require': cannot load such file -- pg (LoadError)

$ sudo emerge -av dev-db/postgresql-server
hit "Enter" key when asked about merging option
$ sudo emerge --config =dev-db/postgresql-server-9.1.3
Configuring pkg...

 * You can modify the paths and options passed to initdb by editing:
 *     /etc/conf.d/postgresql-9.1
 * 
 * Information on options that can be passed to initdb are found at:
 *     http://www.postgresql.org/docs/9.1/static/creating-cluster.html
 *     http://www.postgresql.org/docs/9.1/static/app-initdb.html
 * 
 * PG_INITDB_OPTS is currently set to:
 *     (none)
 * 
 * Configuration files will be installed to:
 *     /etc/postgresql-9.1/
 * 
 * The database cluster will be created in:
 *     /var/lib/postgresql/9.1/data
 * 
 * Are you ready to continue? (y/n)


Success. You can now start the database server using:

    /usr/lib64/postgresql-9.1/bin/postgres -D /var/lib/postgresql/9.1/data
or
    /usr/lib64/postgresql-9.1/bin/pg_ctl -D /var/lib/postgresql/9.1/data -l logfile start

 * The autovacuum function, which was in contrib, has been moved to the main
 * PostgreSQL functions starting with 8.1, and starting with 8.4 is now enabled
 * by default. You can disable it in the cluster's:
 *     /etc/postgresql-9.1/postgresql.conf
 * 
 * The PostgreSQL server, by default, will log events to:
 *     /var/lib/postgresql/9.1/data/postmaster.log
 * 
 * You should use the '/etc/init.d/postgresql-9.1' script to run PostgreSQL
 * instead of 'pg_ctl'.

The previous steps installed version 9.1 but we want 8.4

$ sudo emerge -av dev-db/postgresql-server:8.4
hit "Enter" key when asked about merging option

$ sudo emerge --config dev-db/postgresql-server:8.4
Configuring pkg...

 * You can modify the paths and options passed to initdb by editing:
 *     /etc/conf.d/postgresql-8.4
 * 
 * Information on options that can be passed to initdb are found at:
 *     http://www.postgresql.org/docs/8.4/static/creating-cluster.html
 *     http://www.postgresql.org/docs/8.4/static/app-initdb.html
 * 
 * PG_INITDB_OPTS is currently set to:
 *     (none)
 * 
 * Configuration files will be installed to:
 *     /etc/postgresql-8.4/
 * 
 * The database cluster will be created in:
 *     /var/lib/postgresql/8.4/data
 * 
 * Are you ready to continue? (y/n)

Success. You can now start the database server using:

    /usr/lib64/postgresql-8.4/bin/postgres -D /var/lib/postgresql/8.4/data
or
    /usr/lib64/postgresql-8.4/bin/pg_ctl -D /var/lib/postgresql/8.4/data -l logfile start

 * The autovacuum function, which was in contrib, has been moved to the main
 * PostgreSQL functions starting with 8.1, and starting with 8.4 is now enabled by
 * default. You can disable it in the cluster's:
 *     /etc/postgresql-8.4/postgresql.conf
 * 
 * The PostgreSQL server, by default, will log events to:
 *     /var/lib/postgresql/8.4/data/postmaster.log
 * 
 * You should use the '/etc/init.d/postgresql-8.4' script to run PostgreSQL
 * instead of 'pg_ctl'.

Start the db server

$ sudo /etc/init.d/postgresql-8.4 start

Verify that it is running

$ rc-status
Dynamic Runlevel: manual
 postgresql-8.4 

Select the correct postgresql version. This is probabaly required only if we don't want to specify the actual version number in the command to start/stop the server.

$ eselect postgresql list
Available PostgreSQL Slots
  8.4                        server-8.4.11 base-8.4.11
  9.1 *                      server-9.1.3 base-9.1.3
alex@alex /var/www/oddb.org $ sudo eselect postgresql set 8.4
Setting 8.4 as the default installation...
        Removing old links...done.
        Generating new links...done.
Setting 8.4 as default was successful!

Create the database

$ sudo -u postgres createdb -E UTF8 -T template0 oddb.org.ruby193

Create role

$ sudo -u postgres psql -c 'create role oddb;'
CREATE ROLE

Import data (it needs to be done as root)

$ su
Password:
# cd /var/www/oddb.org/data/sql
# zcat oddb.org.ruby193.20120423.sql.gz | psql -U postgres oddb.org.ruby193
# exit

Launching oddbd

$ cd /var/www/oddb.org
$ bin/oddbd

Error
/usr/lib64/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require': cannot load such file -- pg (LoadError)

$ gem install pg

Error
/home/alex/.gem/ruby/1.9.1/gems/dbi-0.4.5/lib/dbi.rb:300:in `block in load_driver': Unable to load driver 'Pg' (underlying error: uninitialized constant DBI::DBD::Pg) (DBI::InterfaceError)

$ cd ~
$ mkdir sw
$ cd sw
$ git clone git://github.com/zdavatz/ruby-dbi.git
$ cd ruby-dbi

$ rake dbi
zip -r dbi-0.4.5.zip dbi-0.4.5
rake aborted!
Command failed with status (127): [zip -r dbi-0.4.5.zip dbi-0.4.5...]

$ sudo emerge zip
$ rake dbi
$ gem install pkg/dbi-0.4.5.gem

Launching oddbd

$ cd /var/www/oddb.org
$ bin/oddbd

Error
/home/alex/.gem/ruby/1.9.1/gems/dbi-0.4.5/lib/dbi.rb:300:in `block in load_driver': Unable to load driver 'Pg' (underlying error: uninitialized constant DBI::DBD::Pg) (DBI::InterfaceError)

Maybe it's a versioning problem with pg

$ gem search pg
*** LOCAL GEMS ***
pg (0.13.2)

Whereas it's supposed to be
pg (0.12.2 ruby)

$ gem install pg --version 0.12.2

$ gem search pg
*** LOCAL GEMS ***
pg (0.13.2, 0.12.2)

Uninstalled and reinstalled the pg gem, so it's compiled against the correct version of Postgres.

$ gem uninstall pg

Select gem to uninstall:
 1. pg-0.12.2
 2. pg-0.13.2
 3. All versions
> 3
Successfully uninstalled pg-0.12.2
Successfully uninstalled pg-0.13.2

$ gem install pg --version 0.12.2

The problem was a missing gem

$ gem install dbd-pg

Launching oddbd

$ cd /var/www/oddb.org
$ bin/oddbd

Error
/home/alex/.gem/ruby/1.9.1/gems/dbd-pg-0.3.9/lib/dbd/pg/database.rb:82:in `rescue in initialize': could not connect to server: Permission denied (DBI::OperationalError)

Run it as root

$ su
Password: 
# pwd
/var/www/oddb.org
# bin/oddbd 

Error
/usr/lib64/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require': cannot load such file -- odba (LoadError)

Check the file ownership

# ls -la

shows everything as root root

# cd ..

# chown -R  alex:users oddb.org/
alex www # ls -la
total 16
drwxr-xr-x  4 root root    16 May  3 12:25 .
drwxr-xr-x 14 root root  4096 May  3 09:39 ..
drwxr-xr-x  3 root root     8 May  3 12:25 localhost
drwxr-xr-x 12 alex users 4096 May  3 09:41 oddb.org

# cd /var/www/oddb.org
# bin/oddbd 

Error
/usr/lib64/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require': cannot load such file -- odba (LoadError)

# exit
exit
$ bin/oddbd

Error
/usr/local/lib64/ruby/gems/1.9.1/gems/dbd-pg-0.3.9/lib/dbd/pg/database.rb:82:in `rescue in initialize': could not connect to server: Permission denied (DBI::OperationalError)

Edited last line of
$ sudo vim /etc/group
from
postgres:x:70:
to
postgres:x:70:alex

Postgres needs to be restarted

$ sudo /etc/init.d/postgresql-8.4 restart

I can run psql as user postgres but not as user alex

alex$ sudo su - postgres
postgres$ psql
psql (8.4.11)
Type "help" for help.
postgres=# \q
postgres$exit 

$ sudo vim /etc/postgresql-8.4/postgresql.conf

Checked that the file
/etc/postgresql-8.4/pg_hba.conf
already contains the line local all all trust

Just rebooting the system seemed to solve the problem

Launching oddbd

$ cd /var/www/oddb.org
$ bin/oddbd

Errors
ERROR: relation "object" already exists

I need to apply some patches to
statement.rb
row.rb
columninfo.rb

right-click each link in http://dev.ywesee.com/Choddb/SetupOddborg
and save them to my home folder

$ patch -p 0 statement.rb.patch.20111125.txt
$ patch -p 0 row.rb.patch.20111125.txt
$ patch -p 0 columninfo.rb.patch.20111123.txt

There is more than one file by that name

$ locate columninfo.rb
/home/alex/.gem/ruby/1.9.1/gems/dbi-0.4.5/lib/dbi/columninfo.rb
/home/alex/.gem/ruby/1.9.1/gems/dbi-0.4.5/test/dbi/tc_columninfo.rb
/home/alex/sw/ruby-dbi/lib/dbi/columninfo.rb
/home/alex/sw/ruby-dbi/pkg/dbi-0.4.5/lib/dbi/columninfo.rb
/home/alex/sw/ruby-dbi/pkg/dbi-0.4.5/test/dbi/tc_columninfo.rb
/home/alex/sw/ruby-dbi/test/dbi/tc_columninfo.rb
/usr/local/lib64/ruby/gems/1.9.1/gems/dbi-0.4.5/lib/dbi/columninfo.rb
/usr/local/lib64/ruby/gems/1.9.1/gems/dbi-0.4.5/test/dbi/tc_columninfo.rb

Check the ruby loading path to see which one it is trying to get

$ ruby -e 'puts $:'
/usr/lib64/ruby/site_ruby/1.9.1
/usr/lib64/ruby/site_ruby/1.9.1/x86_64-linux
/usr/lib64/ruby/site_ruby
/usr/lib64/ruby/vendor_ruby/1.9.1
/usr/lib64/ruby/vendor_ruby/1.9.1/x86_64-linux
/usr/lib64/ruby/vendor_ruby
/usr/lib64/ruby/1.9.1
/usr/lib64/ruby/1.9.1/x86_64-linux

The problem was that for some reason the gems built by rake got installed into a different directory from the others. Instead of applying the previous patches, remove the duplicate files. Also, the dbi gem should be removed from the big list of gems.

$ cd /usr/local/lib64/ruby/gems/1.9.17gems
$ sudo rm -r dbi-0.4.5/

Launching oddbd

$ cd /var/www/oddb.org
$ bin/oddbd

The previous error has gone.

view · edit · sidebar · attach · print · history
Page last modified on May 04, 2012, at 08:24 AM