Overview
Assuming that PostgreSQL and GTK are installed properly, building PRepS should be straight forward. The sections in this document cover each of the following steps:
- Make sure PostgreSQL is set up in a reasonable way given your situation and security needs.
- Build and install PRepSTools (be sure to run ldconfig)
- Build and Install PRepS
- Create a PRepS database
If you have any problems getting PRepS built, please let me know.
PostgreSQL Configuration
Depending upon how your PostgreSQL installation is set up, you may or may not need to change anything. For example, one installation (it was a RedHat v8.0 installation, using the PostgreSQL RPMs that came with RedHat) had the sameuser restriction turned on. This particular restriction will not work with PRepSTools (unless the postgres user is going to own all of the PRepS databases).
The following is an example of my PostgreSQL pg_hba.conf file. I have my security pretty wide open on my home network. Depending upon how your machine is used, you may want to use a more secure set up. See the PostgreSQL documentation for details.
# This default configuration allows any local user to connect # with any PostgreSQL username, over either UNIX domain sockets # or IP. # # If you want to allow non-local connections, you will need to # add more "host" records. Also, remember IP connections are # only enabled if you start the postmaster with the -i option. # # CAUTION: if you are on a multiple-user machine, the default # configuration is probably too liberal for you. Change it to use # something other than "trust" authentication. # # TYPE DATABASE USER IP-ADDRESS IP-MASK METHOD local all all trust host all all 127.0.0.1 255.255.255.255 trust host all all 10.0.1.1 255.255.255.0 trust # RedHat had the above default commented out, and the following # line as the default. The 'sameuser' restriction is a problem # (unless, of course, you are going to name your database 'bob', # and then always log in to it as the user 'bob' (for example)). # local all ident sameuser
Depending upon your situation, you may also want to start PostgreSQL such that it will accept TCP/IP connections. To do this, you need to pass '-i' to the postmaster when PostgreSQL is started. The proper way to do this depends upon your system. On your average Linux system, examine the files in /etc, /etc/init.d, and perhaps /etc/conf.d for details.
As an example, here is the /etc/conf.d/postgresql file from my old computer (I was running Gentoo Linux) Including '-i' in the PGOPTS causes PostgreSQL to be started such that accepts IP connections. Most versions have similar files somewhere under the /etc directory.
# PostgreSQL's Database Directory DATA=/var/lib/postgresql/data # Logfile path: (NOTE: This must be uid/gid owned by the value of $PGUSER!) PGLOG=/var/lib/postgresql/data/postgresql.log # Run the PostgreSQL user as: PGUSER=postgres # Extra options to run postmaster with. # If you want to enable TCP/IP for PostgreSQL, add -i to the following: PGOPTS="-i -N 1024 -B 2048"
Making PRepSTools
NOTE: The PRepSTools package only needs to be installed on the PostgreSQL database server. If you are installing PRepS on a stand alone system, ignore all of this "client" and "server" talk, as your machine is both the "client" and the "server".
For the purposes of this document, the "server" machine is the machine that will contain the PRepS database. PostgreSQL must be installed on this machine. Do a normal ./configure, make, make install. Be sure to update /etc/ld.so.conf (if required) and run ldconfig.
$ tar -xzvf prepstools-2.0.0.tar.gz $ cd prepstools-2.0.0 $ ./configure $ make $ su # make install # vi /etc/ld.so.conf # make sure install dir in there... # ldconfig
If you have problems building PRepSTools, please make sure you have all PostgreSQL server and development packages installed (if you are using RPMs). If you build PostgreSQL yourself, make sure you do a make install-all-headers as well as a make install.
Special Mac OS X Instructions
If you are using Mac OS X, there are some special steps that you have to take. Mac OS X differentiates between dynamic libraries and loadable modules. The existing make files build libPRepS as a dynamic library (which is appropriate on most systems). On Mac OS X, however, you must manually create a loadable module and install it in place of the dynamic library that is installed by default. The following example assumes that you used --prefix=/sw/preps when ./configure'ing PRepSTools.
$ cd preps $ cc -bundle -flat_namespace \ -undefined suppress -o libpreps.so sendmsg.o $ sudo cp libpreps.so /sw/preps/lib
Making PRepS
Version 2.0.x (stable)
Assuming that the PostgreSQL client development libraries and PRepSTools are installed correctly, making PRepS should just require the normal ./configure, make, su -c 'make install'. One item to note is that in order for the "help" to work properly, you need to set the --localstatedir properly. The following instructions worked on my systems that were running RedHat v8.0 and Gentoo v1.4. It also works on my current Linux box, which is running SuSE v9.0.
$ ./configure --localstatedir=/var/lib $ make $ su -c 'make install'
Creating Databases
To create PRepS databases, log on to the database server and type prepsdb_tool The PRepS Database Tool will walk you through the steps that are required I will add more information here later. However, the database tools should be self explanatory.