For an overview of PUBS, refer to Kazu's PUBS document.

The basic steps to setting up a pubs project are as follows.
  • Install or get access to a postgres database server with HSTORE extension.
  • Install or setup the postgres client tools (e.g. psql), including postgres python interface (psycopg2).
  • Install PUBS
  • Initialize pubs database.
  • Configure your pubs project and project script.

Getting access to a postgres database server

Pubs can be used with microboone's Fermilab SCD-maintained offline postgres server, or you can install your own postgres server on your personally managed computer or laptop.

Accessing microboone offline postgres database.

Fermilab maintains a postgres database in a configuration compatible with PUBS on server Microboone accesses the development database "microboone_dev" through port 5437 (the default postgres port is 5432). Line mode sql access to this database can be done using the following command.

psql -h -p 5437 -d microboone_dev -U <user>

This database already has all of the pubs-required tables and functions, etc.

Installing a postgres database server on your personally managed computer

The recommended way to install your personal postgres database server is to download the latest version from the postgres web site and compile from source. This method is preferred to, e.g., installing a precompiled version from a linux distribution. Detailed instructions on how to do this can be found in Kazu's PUBS document.

After postgres is installed, the postgres server program called "postgres" should appear on your execution path. Access to your database is enabled when you are running the server program. This opens a tcp port (default port 5432).

Once your personal postgres server is installed, you should initialize your database (install required tables and functions) following the procedure in Kazu's PUBS document

You can tunnel access to your postgres server to another computer (such as microboone login machines uboonegpvmXX) using ssh. There are two ways to do this, using either local or remote port forwarding.

Local port forwarding

From uboonegpvmXX, use the following command.

ssh -L 5678:localhost:5432 user@server

After running this command (as long as you remain logged in to your server, and as long as the server program is running on your computer), you can access your postgres database from uboonegpvmXX using a command similar to this:
psql -h localhost -p 5678 -d <database> -U <user>

The port number (5678 in this example) can be anything.

Remote port forwarding

Run the following command on your database server computer.

ssh -R 5678:localhost:5432

Now you can access your postgres database from uboonegpvmXX similar as above.

Getting access to postgres client tools

Getting access to PUBS