Creating the Evergreen database

Setting up the PostgreSQL server

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

  1. Installing PostgreSQL server packages

Each OS build target provides the postgres server installation packages required for each operating system. To install Postgres server packages, use the make target postgres-server-<OSTYPE>. Choose the most appropriate command below based on your operating system. This will install PostgreSQL 9.6, the minimum supported version.

make -f Open-ILS/src/extras/Makefile.install postgres-server-debian-buster
make -f Open-ILS/src/extras/Makefile.install postgres-server-debian-stretch
make -f Open-ILS/src/extras/Makefile.install postgres-server-debian-jessie
make -f Open-ILS/src/extras/Makefile.install postgres-server-ubuntu-xenial
make -f Open-ILS/src/extras/Makefile.install postgres-server-ubuntu-bionic

To install PostgreSQL version 10, use the following command for your operating system:

make -f Open-ILS/src/extras/Makefile.install postgres-server-debian-buster-10
make -f Open-ILS/src/extras/Makefile.install postgres-server-debian-stretch-10
make -f Open-ILS/src/extras/Makefile.install postgres-server-debian-jessie-10
make -f Open-ILS/src/extras/Makefile.install postgres-server-ubuntu-xenial-10
make -f Open-ILS/src/extras/Makefile.install postgres-server-ubuntu-bionic-10

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

(Debian and Ubuntu). No extra modules required for these distributions.

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

Enabling connections to the PostgreSQL database. Your PostgreSQL database may be configured by default to prevent connections, for example, it might reject attempts to connect via TCP/IP or from other servers. To enable TCP/IP connections from localhost, check your pg_hba.conf file, found in the /etc/postgresql/ directory on Debian and Ubuntu. A simple way to enable TCP/IP connections from localhost to all databases with password authentication, which would be suitable for a test install of Evergreen on a single server, is to ensure the file contains the following entries before any "host … ident" entries:

host    all             all             ::1/128                 md5
host    all             all             127.0.0.1/32            md5

When you change the pg_hba.conf file, you will need to reload PostgreSQL to make the changes take effect. For more information on configuring connectivity to PostgreSQL, see http://www.postgresql.org/docs/devel/static/auth-pg-hba-conf.html

Creating the Evergreen database and schema

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 --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.

You can get a complete set of options for eg_db_config by passing the --help parameter.

Loading sample data

If you add the --load-all-sample parameter to the eg_db_config command, a set of authority and bibliographic records, call numbers, copies, staff and regular users, and transactions will be loaded into your target database. This sample dataset is commonly referred to as the concerto sample data, and can be useful for testing out Evergreen functionality and for creating problem reports that developers can easily recreate with their own copy of the concerto sample data.

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.6 and later

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