June 18, 2008

The following setup instructions apply to Ubuntu:

0. Install PostgreSQL including the development
   libraries. The development libraries are listed
   separately under a name like:
   postgresql-server-dev-8.3

1. Add your userid to the 'postgres' group.
   This user id must not be 'root'. This 
   step is required in order to set locks.
   On the main screen, go to System | Administration |
   Users and Groups. Click 'Manage Groups.' Locate
   the 'postgres' group and click it. Click 'Properties'
   then put a check mark next to your userid. This 
   makes you a member of the postgress group. Click
   'Ok' etc. Logout/in in order for this change to take
   effect.

2. Add the PostgreSQL bin directory to your 
   path: (for Ubuntu:

   PATH=$PATH:/usr/lib/postgresql/8.3/bin:
   export PATH

   for Cygwin:

   PATH=$PATH:/usr/sbin
   export PATH

   (You probably want to add this to your ~/.bashrc
    file so it will be done on login). If you do not
   do this step, the commands below will not work unless
   they are prefixed by the appropriate directory path.

3. Login as root and kill any existing postgres servers:

   killall postgres

4. Login back in as yourself and Create the data base files and 
   users: 

   initdb -D data -W -E LATIN1

   'data' is the name of the directory to be
   created where the data base files will be stored.
   You may include path information but you must
   have access rights to the directory in which
   you place the files.

5. Start the server on your data base (as your userid) 
   for Ubuntu

   postgres -D data & >logfile 2>&1 &

   or, for Cygwin:

   postmaster -D data &

   Where 'data' is the same path and directory as above.

   Add the -i switch and modify pg_hba.conf (in the data
   directory) if you want to enable TCP/IP connections.
   
6. Create users (your userid is already a user) that
   can use this data base (userid is Linux login name).

   createuser userid

7. Create a data base for mumps: 

   createdb mumps

8. Build mumps using the configure command (as root) for Ubuntu:

   configure prefix=/usr --with-pgdb=/usr/include/postgresql

   or, for Cygwin

   configure prefix=/usr --with-pgdb=/usr/include

   make
 
   make install

9. See PostgreSQL documentation for additonal details. Similr
   instructions apply to other systems but the address of the
   PostgreSQL binaries and include files given above may vary.
   In Cygwin, the following is required before starting any 
   of the commands above:

   CYGWIN=server 
   export CYGWIN 
   /usr/sbin/cygserver.exe & 

10. The first time you use the database, you must initialize it with the
    Mumps/II command:

      sql/f

    In Cygwin, you may see a message that the relation mumps does
    not exist. This can be ignored. A second running of the initialization
    command will not show the message. It is due to a SQL DROP statement
    on the mumps relation before a rebuild.


11. If you want to use the native btree data base but still have
    access to the PostgreSQL data base, use the following configure
    commands:

    for Ubuntu:

    configure prefix=/usr --with-pgsql=/usr/include/postgresql

    for Cygwin:

    configure prefix=/usr --with-pgsql=/usr/include

    Note the 'pgsql' rather than 'pgdb'. The 'pgsql' enables
    the SQL command in Mumps/II to accesss PostgreSQL but places
    global arrays in the native data base. The 'pgdb' option
    enables SQL command access and places the global arrays
    in the PostgreSQL data base in the database mumps and in
    a table in that data base named mumps.

12. The default PostgreSQL database name is 'mumps.' You can change it
    with the --with-dbname= configure parameter:

   configure prefix=/usr --with-pgdb=/usr/include --with-dbname=fluffy

    The dbname is where Mumps will store its global arrays. 

13. When running through the CGI-BIN interface, be sure the files and
    directories are not owned by root.

14. To accept TCP/IP connections, you must start postmaster with the -i
    option and the connecting client's IP numbers should be in the file
    ps_hba.conf in the PostgreSQL data directory.

    note: to enable a network, your IPV4 address should look like:

    host    all         all         134.161.0.0/16          trust

    where the high order 16 bits must match (134.161) but the remainng
    16 bits can be any value.

psql -h tuatha.cs.uni.edu -d medical
