Creating the Evergreen database

By default, the Makefile.install prerequisite installer does not install the PostgreSQL 9 database server required by every Evergreen system; for production use, most libraries install the PostgreSQL database server on a dedicated machine. You can install the packages required by Debian or Ubuntu Lucid on the machine of your choice using the following commands as the root Linux account:

(Debian and Ubuntu Lucid) Installing PostgreSQL 9.1 server packages. 

make -f Open-ILS/src/extras/Makefile.install install_pgsql_server_backport_debs_91

(Ubuntu Precise) Installing PostgreSQL 9.1 server packages. 

make -f Open-ILS/src/extras/Makefile.install install_pgsql_server_debs_91

You can install the packages required by Fedora on the machine of your choice using the following commands as the root Linux account:

(Fedora) Installing PostgreSQL server packages. 

make -f Open-ILS/src/extras/Makefile.install install_fedora_pgsql_server
postgresql-setup initdb

For a standalone PostgreSQL server, install the following Perl modules as the root Linux account:

(Debian / Ubuntu) Installing additional Perl modules on a standalone PostgreSQL 9 server. 

aptitude install gcc libxml-libxml-perl libxml-libxslt-perl
cpan Business::ISBN
cpan JSON::XS
cpan Library::CallNumber::LC
cpan MARC::Record
cpan MARC::File::XML
cpan UUID::Tiny

(Fedora) Installing additional Perl modules on a standalone PostgreSQL 9 server. 

yum install gcc perl-XML-LibXML perl-XML-LibXSLT perl-Business-ISBN
cpan Library::CallNumber::LC
cpan MARC::Record
cpan MARC::File::XML
cpan UUID::Tiny

You need to create a PostgreSQL superuser to create and access the database. Issue the following command as the postgres Linux account to create a new PostgreSQL superuser named evergreen. When prompted, enter the new user’s password:

createuser -s -P evergreen

Once you have created the evergreen PostgreSQL account, you also need to create the database and schema, and configure your configuration files to point at the database server. Issue the following command as the root Linux account from inside the Evergreen source directory, replacing <user>, <password>, <hostname>, <port>, and <dbname> with the appropriate values for your PostgreSQL database (where <user> and <password> are for the evergreen PostgreSQL account you just created), and replace <admin-user> and <admin-pass> with the values you want for the egadmin Evergreen administrator account:

perl Open-ILS/src/support-scripts/eg_db_config.pl --update-config \
       --service all --create-database --create-schema --create-offline \
       --user <user> --password <password> --hostname <hostname> --port <port> \
       --database <dbname> --admin-user <admin-user> --admin-pass <admin-pass>

This creates the database and schema and configures all of the services in your /openils/conf/opensrf.xml configuration file to point to that database. It also creates the configuration files required by the Evergreen cgi-bin administration scripts, and sets the user name and password for the egadmin Evergreen administrator account to your requested values.

Creating the database on a remote server

In a production instance of Evergreen, your PostgreSQL server should be installed on a dedicated server.

PostgreSQL 9.1 and later

To create the database instance on a remote database server running PostgreSQL 9.1 or later, simply use the --create-database flag on eg_db_config.pl.

For PostgreSQL 9.0

To create the database instance on a remote database server running PostgreSQL 9.0, you can either:

  • Install the PostgreSQL contrib modules on the machine on which you are installing the Evergreen code, and use the --create-database option from that machine, or
  • Copy the Open-ILS/src/sql/Pg/create_database.sql script to your PostgreSQL server and invoke it as the postgres Linux account:

    psql -vdb_name=<dbname> -vcontrib_dir=`pg_config --sharedir`/contrib -f create_database.sql

Then you can issue the eg_db_config.pl command as above without the --create-database argument to create your schema and configure your configuration files.