Installation of the Postgres Database

Installation of the Postgres Database on Ubuntu Linux

OpenEMPI is tested and supported to run under the Postgres database although it has been successfully deployed on other database servers. In this section we describe the installation of the Postgres database. We describe this briefly mainly because the Postgres Database site has detailed instructions for installing the database server under different environments.

Under Ubuntu you can download the software using the apt utility. In the example below we assume that you will be using the 9.1 version of Postgres although, depending on which version of Ubuntu you are deploying OpenEMPI, the exact version of Postgres available may vary. We have been using various versions of Postgres over the years and we haven't had any issues with any of the versions we have tried. If you run into any issues or experience any problems, please let us know through the forums.

$ sudo apt-get update
$ sudo apt-get install postgresql postgresql-client pgadmin3

The next step is to create a role that will be used by the OpenEMPI software for connecting to the database. We use the account name openempi although any account name will work. We must first create an initial password for the postgres user that is created when the Postgres software is installed. Then we will use the postgres account to create the one for OpenEMPI. For the sake of simplicity we use the password postgres for the postgres user and openempi for the openempi user. You must change this for production deployment and use strong passwords instead of these trivial ones.

$ sudo -u postgres psql postgres
postgres=# \password postgres
Enter new password: ******
Enter it again: ******
postgres=# CREATE ROLE openempi LOGIN PASSWORD 'openempi'
   VALID UNTIL 'infinity';

postgres=# CREATE DATABASE openempi
postgres=# \q

After creating a database account for the OpenEMPI application and creating a database schema the next step is to actually create the database objects that comprise the OpenEMPI application. For every major release, there is a create script that creates the schema for that release. Then for each minor release there may be a update script that upgrades the database from the prior minor release to the next one. The database scripts reside under the configuration directory of the distribution.

$ cd $OPENEMPI_HOME/conf
$ psql --username=openempi --host=localhost openempi
postgres=# \i create_new_database_schema-3.0.0.sql
postgres=# \i create_person_entity_model_definition.sql
postgres=# \i create_person_reference_tables.sql
postgres=# \q

The first step creates the database schema that is used to support the OpenEMPI installation and the second step creates the definition of the person entity that is needed to get the system up and running. As you become more familiar with OpenEMPI, you can customize that entity definition or drop it altogether and create another entity.

If there are any update scripts that are available as part of the release to match the minor release number, then you can install those at this time as well. For example, if the version you are installing is 3.4.0, you must install any update scripts from 3.1.0 all the way to 3.4.0 in the order of increasing minor version number.

$ psql --username=openempi --host=localhost openempi
postgres=# \i update_database_schema-3.x.y.sql
postgres=# \q

There may be some warnings but you can ignore them. This completes the installation steps for the database server.