Created
April 20, 2017 05:48
-
-
Save derekchiang/fe9033a45b07f8f717daa070187374a6 to your computer and use it in GitHub Desktop.
install_pg_rewind.sh
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
apt-get -y install postgresql-9.4 postgresql-contrib-9.4 postgresql-server-dev-9.4 | |
########################################### | |
# Hack alert: | |
# For Postgresql 9.4, pg_rewind is not in the main source tree and | |
# no packages exist in the repos, so it must be compiled manually | |
# and installed on the image until we can move to 9.5 | |
# See README at | |
# https://github.com/vmware/pg_rewind/tree/REL9_4_STABLE | |
tmpdir=/tmp/build | |
mkdir -p $tmpdir | |
cd $tmpdir | |
git clone https://github.com/postgres/postgres.git --branch REL9_4_STABLE | |
cd postgres/contrib | |
git clone https://github.com/vmware/pg_rewind.git --branch REL9_4_STABLE | |
dev_pkgs="libreadline-dev libkrb5-dev libssl-dev libpam-dev libxml2-dev libxslt-dev libedit-dev libselinux1-dev bison flex" | |
apt-get install $dev_pkgs -y | |
# Unfortunately, on ubuntu, was not able to get pg_rewind to build | |
# outside of the pgsql source tree. Configure and compile postgres | |
# but only call make install against the contrib/pg_rewind directory | |
# so that support library is accessible to the server | |
cd $tmpdir/postgres | |
./configure | |
make | |
cd contrib/pg_rewind | |
make install | |
# Make the pg_rewind binary and the library used by the | |
# pg_rewind stored procedures accessible | |
ln -s /usr/local/pgsql/bin/pg_rewind /usr/bin/pg_rewind | |
ln -s /usr/local/pgsql/lib/pg_rewind_support.so /usr/lib/postgresql/9.4/lib/pg_rewind_support.so | |
cd | |
rm -rf $tmpdir | |
apt-get remove -y $dev_pkgs |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment