Skip to content

Instantly share code, notes, and snippets.

@philMarius
Forked from shanna/pg-install
Last active June 23, 2017 10:05
Show Gist options
  • Save philMarius/1c6600e972d8710e9847ac174f829bc4 to your computer and use it in GitHub Desktop.
Save philMarius/1c6600e972d8710e9847ac174f829bc4 to your computer and use it in GitHub Desktop.
Postgres install from source on Ubuntu when the distribution installation won't give you a specific version.
#!/usr/bin/env bash
set -e
# Homebrew homebrew/versions was broken when I went to install postgres.
# This shell script just documents my install from source.
release=9.4.6
prefix=/usr/local/opt
mkdir -p $prefix
cd $prefix
curl -# https://ftp.postgresql.org/pub/source/v${release}/postgresql-${release}.tar.gz | tar -zxvf -
cd postgresql-$release
# If this fails you may need to install openssl with homebrew.
./configure --prefix=$prefix/postgresql --with-openssl --with-libs=/usr/local/lib --with-includes=/usr/local/include
# postgres
make
make install
# postgres-contrib
cd contrib
make
make install
cd $prefix
rm -rf postgresql-$release
echo "Add ${prefix}/postgresql/bin to \$PATH environment variable."
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment