BDR Documentation | |||
---|---|---|---|
Prev | Up | Chapter 3. Installation | Next |
To install either BDR or UDR the prerequisites for compiling PostgreSQL must be installed. These are described in PostgreSQL's documentation on build requirements and build requirements for documentation.
On several systems the prerequisites for compiling PostgreSQL and BDR/UDR can be installed using simple commands.
Debian and Ubuntu: First add the apt.postgresql.org repository to your sources.list if you have not already done so. Then install the pre-requisites for building PostgreSQL with:
sudo apt-get update sudo apt-get build-dep postgresql-9.4
RHEL or CentOS 6.x or 7.x: install the appropriate repository RPM for your system from yum.postgresql.org. Then install the prerequisites for building PostgreSQL with:
sudo yum check-update sudo yum groupinstall "Development Tools" sudo yum install yum-utils openjade docbook-dtds docbook-style-dsssl docbook-style-xsl sudo yum-builddep postgresql94
There are two ways to get the BDR source code: with git, or by downloading tarballs of released versions.
Use git if you expect to update often, you want to keep track of development or if you want to contribute changes to BDR. There is no reason not to use git if you're familiar with it.
The source for BDR is maintained at git.postgresql.org in the 2ndquadrant_bdr repository. There are actually two independent source trees in this repository - one tree for the BDR plugin, and one for the modified version of PostgreSQL 9.4 that it requires to run. At the time of writing the main branches are:
bdr-plugin/stable: the current stable release of the BDR plugin
bdr-plugin/next: the in-progress development version of the BDR plugin
bdr-pg/REL9_4_STABLE: the current stable release of the modified PostgreSQL that BDR requires.
There are also tags for each BDR release, e.g. bdr-plugin/0.8.0.
To clone the source code using git you will need to run two clones, one for the BDR plugin sources and one for the patched PostgreSQL sources, e.g.:
git clone -b bdr-pg/REL9_4_STABLE git://git.postgresql.org/git/2ndquadrant_bdr.git postgresql-bdr git clone -b bdr-plugin/stable git://git.postgresql.org/git/2ndquadrant_bdr.git bdr-plugin
For more information on using git see git-scm.org.
Official BDR release source code is uploaded as tarballs to the BDR website along with a tarball checksum and a matching GnuPG signature. See http://2ndquadrant.com/bdr for the download information. See Verifying digital signatures for information on verifying digital signatures.
You will need to download both the patched PostgreSQL source (postgresql-bdr-[...].tar.gz) and the associated BDR release (bdr-[...].tar.gz).
You may optionally verify the package checksums from the .md5 files and/or verify the GnuPG signatures per Verifying digital signatures.
After you unpack the source code archives using tar xf the installation process is the same as if you were installing from a git clone.
Installing BDR from source consists out of two steps: First compile and install PostgreSQL with the BDR additions; secondly compile and install the BDR plugin.
The patched PostgreSQL required for BDR can be compiled using the normal documented procedures. That will usually be something like:
cd /path/to/bdr-pg-source/ ./configure --prefix=/path/to/install --enable-debug --enable-openssl make -j4 -s install-world
To then install BDR execute its configure script with the pg_config installed by the patched PostgreSQL in the PATH environment variable, e.g.:
cd /path/to/bdr-plugin-source/ PATH=/path/to/install:"$PATH" ./configure make -j4 -s all
Installing UDR is simpler than installing BDR. It compiles against a stock (unmodified) PostgreSQL 9.4 if the relevant headers are installed.
Most Linux distributions put the required header files in a "dev" or "devel" package. Exactly what to install depends on how you installed PostgreSQL in the first place.
If you installed from apt.postgresql.org packages on Debian/Ubuntu then run:
sudo apt-get install postgresql-server-dev-9.4
If you installed from yum.postgresql.org packages on RHEL or CentOS then run:
sudo yum install postgresql94-dev
To compile UDR execute its configure script with PostgreSQL's pg_config in the PATH.
cd /path/to/bdr-plugin-source/ PATH=/path/to/pg/install:"$PATH" ./configure make -j16 -s all
On Debian/Ubuntu systems pg_config is on the default PATH so you can just run
./configure
On RHEL/CentOS systems you will need to put /usr/pgsql-9.4/bin on the PATH, e.g.:
PATH=/usr/pgsql-9.4/bin:$PATH ./configure