LP#1493824: Install PG 9.4 on Debian Wheezy and Ubuntu Trusty
authorBen Shum <ben@evergreener.net>
Mon, 27 Feb 2017 21:32:48 +0000 (16:32 -0500)
committerJason Stephenson <jason@sigio.com>
Thu, 2 Mar 2017 18:05:12 +0000 (13:05 -0500)
Debian Wheezy only ships with PG 9.1 by default.  Ubuntu Trusty has Pg
9.3.  Pg 9.4 is the recommended version for use with Evergreen going
forward and will be the required minimum version of PostgreSQL for use
with Evergreen 3.0.  Since we envision continuing to support Wheezy
and Trusty through the lifetime of Evergreen 3.0, we therefore help
the user out by adding the apt.postgresql.org repository for them and
install PostgreSQL version 9.4 on these operating systems.

This commit does the following:

1. Sets up the installer to use the PostgreSQL community's apt sources
in a new Makefile.debian target, debian_postgresql_repo.  This target
is run on Debian Wheezy and Ubuntu trusty during prerequisite
installation.

2. Installs PG 9.4 client on Wheezy and Ubuntu.

3. Installs PG 9.4 server in the server prerequisite targets for
Wheezy and Ubuntu.

4. Uses pg_config in installation of lidbdi-drivers from source.

5. Updates the server installation document to reflect the above
changes.

6. Updates the server upgrade documentation to reflect the new minimum
(9.3) and recommended (9.4) PostgreSQL versions.

Benjamin Shum is the primary author of these changes, though they are
based on Chris Sharp's idea for using the PostgreSQL community apt
source.

The libdbi-drivers installation was fixed by Jason Stephenson who also
added an if block to skip the apt.postgresql.org repository set up if
it is already configured on the target host.

Signed-off-by: Ben Shum <ben@evergreener.net>
Signed-off-by: Jason Stephenson <jason@sigio.com>

Open-ILS/src/extras/install/Makefile.common
Open-ILS/src/extras/install/Makefile.debian
Open-ILS/src/extras/install/Makefile.debian-wheezy
Open-ILS/src/extras/install/Makefile.ubuntu-trusty
docs/installation/server_installation.txt
docs/installation/server_upgrade.txt

index 3ad90cf..81dd53c 100644 (file)
@@ -24,8 +24,9 @@ install_libdbi:
        tar -zxf $(LIBDBI).tar.gz
        tar -zxf $(LIBDBI_DRIVERS).tar.gz
        cd $(LIBDBI) && ./configure --disable-docs && make all install
-       cd $(LIBDBI_DRIVERS) && ./configure  \
-               --disable-docs --with-pgsql --enable-libdbi && make all install  
+       cd $(LIBDBI_DRIVERS) && ./configure --disable-docs --enable-libdbi \
+               --with-pgsql --with-pgsql-incdir=$$(pg_config --includedir) \
+               --with-pgsql-libdir=$$(pg_config --libdir) && make all install  
 
 # NOTE: Deprecate me with wheezy
 install_nodejs_from_source:
index 495cdb2..6edb42b 100644 (file)
@@ -1,6 +1,7 @@
 # actions required by all debian-based OSs
 
 APT_TOOL=apt-get -yq
+RELEASE_CODENAME=$(shell lsb_release -cs)
 
 install_debs:
        $(APT_TOOL) install $(DEBS)
@@ -30,6 +31,15 @@ debian_sys_config:
        # refresh the dynamic library cache
        ldconfig
 
+# Adding this for installing versions from PostgreSQL community apt source
+debian_postgresql_repo:
+       if test -z "$$(grep -R apt.postgresql.org /etc/apt/)" ; then \
+               echo "deb http://apt.postgresql.org/pub/repos/apt/ $(RELEASE_CODENAME)-pgdg main" \
+                    > /etc/apt/sources.list.d/pgdg.list; \
+               wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | apt-key add - ; \
+               $(APT_TOOL) update ; \
+       fi
+
 clean:
        echo "cleaning"
 
index 52fb75e..37754a2 100644 (file)
@@ -62,7 +62,7 @@ export DEBS = \
        libuniversal-require-perl\
        libunix-syslog-perl\
        libyaz-dev\
-       postgresql-client-9.1\
+       postgresql-client-9.4\
        libsoap-lite-perl\
        libbz2-dev\
        libparse-recdescent-perl\
@@ -87,12 +87,16 @@ export CPAN_MODULES_FORCE = \
        Business::Stripe \
        Class::DBI::Frozen::301
 
-PGSQL_SERVER_DEBS_91 = \
-       $(DEB_PGSQL_COMMON_MODS) \
-       postgresql-9.1 \
-       postgresql-contrib-9.1 \
-       postgresql-plperl-9.1 \
-       postgresql-server-dev-9.1
+PGSQL_APT_REPO_DEBS = \
+    wget \
+    ca-certificates
+
+PGSQL_SERVER_DEBS_94 = \
+    $(DEB_PGSQL_COMMON_MODS) \
+    postgresql-9.4 \
+    postgresql-contrib-9.4 \
+    postgresql-plperl-9.4 \
+    postgresql-server-dev-9.4
 
 # note: some prereqs are repeated in the developer/packager 
 # sections to support building Evergreen packages on servers
@@ -123,6 +127,8 @@ TRANSLATOR_DEBS = \
        bzr
 
 all:
+       make -f $(DIR)/Makefile.debian DEBS="$(PGSQL_APT_REPO_DEBS)"
+       make -f $(DIR)/Makefile.debian debian_postgresql_repo
        make -f $(DIR)/Makefile.debian install_debs
        make -f $(DIR)/Makefile.debian test_for_libdbi_pkg
        make -f $(DIR)/Makefile.common install_cpan
@@ -131,7 +137,7 @@ all:
        make -f $(DIR)/Makefile.debian debian_sys_config
 
 install_postgres_server:
-       make -f $(DIR)/Makefile.debian DEBS="$(PGSQL_SERVER_DEBS_91)"
+       make -f $(DIR)/Makefile.debian DEBS="$(PGSQL_SERVER_DEBS_94)"
 
 install_developer:
        make -f $(DIR)/Makefile.debian DEBS="$(DEVELOPER_DEBS)"
index 9549872..6a9b708 100644 (file)
@@ -67,7 +67,7 @@ export DEBS = \
        libuniversal-require-perl\
        libunix-syslog-perl\
        libyaz-dev\
-       postgresql-client-9.3\
+       postgresql-client-9.4\
        libsoap-lite-perl\
        libtest-warn-perl\
        libparse-recdescent-perl\
@@ -95,12 +95,16 @@ export CPAN_MODULES_FORCE = \
        Business::Stripe \
        Class::DBI::Frozen::301
 
-PGSQL_SERVER_DEBS_93 = \
+PGSQL_APT_REPO_DEBS = \
+       wget \
+       ca-certificates
+
+PGSQL_SERVER_DEBS_94 = \
        $(DEB_PGSQL_COMMON_MODS) \
-       postgresql-9.3 \
-       postgresql-contrib-9.3 \
-       postgresql-plperl-9.3 \
-       postgresql-server-dev-9.3
+       postgresql-9.4 \
+       postgresql-contrib-9.4 \
+       postgresql-plperl-9.4 \
+       postgresql-server-dev-9.4
 
 # note: some prereqs are repeated in the developer/packager 
 # sections to support building Evergreen packages on servers
@@ -135,6 +139,8 @@ TRANSLATOR_DEBS = \
        bzr
 
 all:
+       make -f $(DIR)/Makefile.debian DEBS="$(PGSQL_APT_REPO_DEBS)"
+       make -f $(DIR)/Makefile.debian debian_postgresql_repo
        make -f $(DIR)/Makefile.debian install_debs
        make -f $(DIR)/Makefile.debian test_for_libdbi_pkg
        make -f $(DIR)/Makefile.common install_cpan
@@ -142,7 +148,7 @@ all:
        make -f $(DIR)/Makefile.debian debian_sys_config
 
 install_postgres_server:
-       make -f $(DIR)/Makefile.debian DEBS="$(PGSQL_SERVER_DEBS_93)"
+       make -f $(DIR)/Makefile.debian DEBS="$(PGSQL_SERVER_DEBS_94)"
 
 # note: if/when grunt-cli and bower are available as 
 # packages, use the packaged versions instead.
index 90c7126..635d6a0 100644 (file)
@@ -54,7 +54,8 @@ autoreconf -i
 Installing prerequisites
 ------------------------
 
-  * **PostgreSQL**: The minimum supported version is 9.3.
+  * **PostgreSQL**: Version 9.4 is recommended. 
+    The minimum supported version is 9.3.
   * **Linux**: Evergreen 2.8 has been tested on Debian Jessie (8.0), 
     Debian Wheezy (7.0), Ubuntu Xenial Xerus (16.04), 
     and Ubuntu Trusty Tahr (14.04).
@@ -69,15 +70,17 @@ before you can successfully configure, compile, and install Evergreen.
 
 1. Begin by installing the most recent version of OpenSRF (2.5.0 or later).
    You can download OpenSRF releases from http://evergreen-ils.org/opensrf-downloads/
-2. On some distributions, it is necessary to install PostgreSQL 9.1+ from external
+2. On some distributions, it is necessary to install PostgreSQL 9.4+ from external
    repositories.
 +
-  * Debian (Wheezy and Jessie) and Ubuntu (Trusty and Xenial) comes with
-    PostgreSQL 9.1+, so no additional steps are required.
+  * Debian (Wheezy) and Ubuntu (Trusty) comes with older versions of 
+    PostgreSQL, so steps are taken to automatically utilize the 
+    PostgreSQL community's apt sources. 
+    (For complete details, see: https://wiki.postgresql.org/wiki/Apt)
+  * Debian (Jessie) and Ubuntu (Xenial) comes with PostgreSQL 9.4+,
+    so no additional steps are required.
 +
-3. On Debian and Ubuntu, run `aptitude update` as the *root* Linux account to
-   retrieve the new packages from the backports repository.
-4. Issue the following commands as the *root* Linux account to install
+3. Issue the following commands as the *root* Linux account to install
    prerequisites using the `Makefile.install` prerequisite installer,
    substituting `debian-jessie`, `debian-wheezy`,
    `ubuntu-xenial`, or `ubuntu-trusty` for <osname> below:
@@ -87,7 +90,7 @@ before you can successfully configure, compile, and install Evergreen.
 make -f Open-ILS/src/extras/Makefile.install <osname>
 ------------------------------------------------------------------------------
 +
-5. Add the libdbi-libdbd libraries to the system dynamic library path by
+4. Add the libdbi-libdbd libraries to the system dynamic library path by
    issuing the following commands as the *root* Linux account:
 +
 [NOTE]
@@ -101,7 +104,7 @@ echo "/usr/local/lib/dbd" > /etc/ld.so.conf.d/eg.conf
 ldconfig
 ------------------------------------------------------------------------------
 
-6. OPTIONAL: Developer additions
+5. OPTIONAL: Developer additions
 +
 To perform certain developer tasks from a Git source code checkout, 
 additional packages may be required.  As the *root* Linux account:
@@ -572,10 +575,10 @@ Creating the database on a remote server
 In a production instance of Evergreen, your PostgreSQL server should be
 installed on a dedicated server.
 
-PostgreSQL 9.1 and later
+PostgreSQL 9.4 and later
 ^^^^^^^^^^^^^^^^^^^^^^^^
 To create the database instance on a remote database server running PostgreSQL
-9.1 or later, simply use the `--create-database` flag on `eg_db_config`.
+9.4 or later, simply use the `--create-database` flag on `eg_db_config`.
 
 Starting Evergreen
 ------------------
index 15efede..0fb5da2 100644 (file)
@@ -6,7 +6,8 @@ All of the steps in this chapter are to be completed from the command line.
 Software Prerequisites
 ~~~~~~~~~~~~~~~~~~~~~~
 
- * **PostgreSQL**: The minimum supported version is 9.3.
+  * **PostgreSQL**: Version 9.4 is recommended.
+    The minimum supported version is 9.3.
   * **Linux**: Evergreen 2.12-beta has been tested on Debian Jessie (8.0),
     Debian Wheezy (7.0), Ubuntu Xenial Xerus (16.04), Ubuntu Trusty Tahr (14.04),
     and Fedora.