4. Slony-I Installation

You should have obtained the Slony-I source from the previous step. Unpack it.

gunzip slony.tar.gz;
tar xf slony.tar

This will create a directory under the current directory with the Slony-I sources. Head into that that directory for the rest of the installation procedure.

4.1. Short Version

PGMAIN=/usr/local/pgsql746-freebsd-2005-04-01 \
./configure \
    --prefix=$PGMAIN \
    --bindir=$PGMAIN/bin \
    --datadir=$PGMAIN/share \
    --libdir=$PGMAIN/lib \
    --with-pgconfigdir=$PGMAIN/bin \
    --with-pgbindir=$PGMAIN/bin \
    --with-pgincludedir=$PGMAIN/include \
    --with-pglibdir=$PGMAIN/lib \
    --with-pgsharedir=$PGMAIN/share
gmake all; gmake install

4.2. Configuration

The first step of the installation procedure is to configure the source tree for your system. This is done by running the configure script. In early versions, configure needed to know where your PostgreSQL source tree is, which was done with the --with-pgsourcetree= option. As of version 1.1, this is no longer necessary, as Slony-I has included within its own code base certain parts needed for platform portability. It now only needs to make reference to parts of PostgreSQL that are actually part of the installation. Therefore, Slony-I is configured by pointing it to the various library, binary, and include directories. For a full list of these options, use the command ./configure --help

4.3. Example

PGMAIN=/opt/dbs/pgsql746-aix-2005-04-01 \
./configure \
    --prefix=$PGMAIN \
    --bindir=$PGMAIN/bin \
    --datadir=$PGMAIN/share \
    --libdir=$PGMAIN/lib \
    --with-pgconfigdir=$PGMAIN/bin \
    --with-pgbindir=$PGMAIN/bin \
    --with-pgincludedir=$PGMAIN/include \
    --with-pglibdir=$PGMAIN/lib \
    --with-pgsharedir=$PGMAIN/share

The configure script will run a number of tests to guess values for various dependent variables and try to detect some quirks of your system. Slony-I is known to need a modified version of libpq on specific platforms such as Solaris2.X on SPARC. The patch for libpq version 7.4.2 can be found at http://developer.postgresql.org/~wieck/slony1/download/threadsafe-libpq-742.diff.gz Similar patches may need to be constructed for other versions; see the FAQ entry on thread safety .

4.4. Build

To start the build process, type

gmake all

Be sure to use GNU make; on BSD systems, it is called gmake; on Linux, GNU make is typically the "native" make, so the name of the command you type in may be either make or gmake. On other platforms, you may need additional packages or even install GNU make from scratch. The build may take anywhere from a few seconds to 2 minutes depending on how fast your hardware is at compiling things. The last line displayed should be

All of Slony-I is successfully made. Ready to install.

4.5. Installing Slony-I

To install Slony-I, enter gmake install

This will install files into postgresql install directory as specified by the --prefix option used in the PostgreSQL installation. Make sure you have appropriate permissions to write into that area. Normally you need to do this either as root or as the postgres user.

4.6. Installing Slony-I from RPMs

Even though Slony-I can be compiled and run on most Linux distributions, it is also possible to install Slony-I using binary packages. Slony Global Development Team provides official RPMs and SRPMs for many versions or Red Hat ana Fedora Core.

The RPMs are available at http://developer.PostgreSQL.org/~devrim/slony . Please read CURRENT_MAINTAINER file for the details of the RPMs. Please note that the RPMs will look for RPM installation of PostgreSQL, so if you install PosgtgreSQL from source, you should manually ignore the RPM dependencies related to PostgreSQL.

Installing Slony-I using these RPMs is as easy as installing any RPM.

rpm -ivh postgresql-slony1-engine-....rpm

If you want to upgrade the previous version, just use rpm -Uvh to upgrade it. But please remember to follow the usual upgrade procedure, too.

The RPM installs the files into their usual places. The configuration files are installed under /etc, the binary files are installed to /usr/bin, libs are installed to /usr/lib/pgsql, and finally the docs are installed under /usr/share/doc/postgresql-slony1-engine.