Skip to content

Instantly share code, notes, and snippets.

@instaBOT
Created January 11, 2017 14:27
Show Gist options
  • Save instaBOT/4a3bef8ca122e5f8954bfd06827b8ee7 to your computer and use it in GitHub Desktop.
Save instaBOT/4a3bef8ca122e5f8954bfd06827b8ee7 to your computer and use it in GitHub Desktop.
Set up Python 3 + PostgreSQL 9.6 client dev environment in Ubuntu 14.04. Includes packages 'python3', 'python3-dev', 'postgresql-client-9.6', 'libpq-dev' and latest 'pip' with 'ipython' and 'psycopg2'.
#!/usr/bin/env bash
########################################################################
# Setup PostgreSQL+Python 3 client development environment
########################################################################
cd
set -e
echo "Setting up PostgreSQL APT repository..."
wget -q -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add -
echo "deb http://apt.postgresql.org/pub/repos/apt/ $(lsb_release -cs)-pgdg main" | sudo tee /etc/apt/sources.list.d/pgdg.list
echo "Refreshing and upgrading packages..."
sudo apt-get update
sudo apt-get upgrade -y
sudo apt-get dist-upgrade -y
echo "Installing packages..."
sudo apt-get install -y \
build-essential \
libpq-dev \
postgresql-client-9.6 \
python3 \
python3-dev \
echo "Installing pip..."
wget -q -O - https://bootstrap.pypa.io/get-pip.py | sudo python3
echo "Installing Python requirements..."
sudo pip3 install \
ipython \
psycopg2 \
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment