Skip to content

Instantly share code, notes, and snippets.

@thomas-scrace
Last active August 29, 2015 14:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save thomas-scrace/d2519b8a6c2470e26496 to your computer and use it in GitHub Desktop.
Save thomas-scrace/d2519b8a6c2470e26496 to your computer and use it in GitHub Desktop.
# Build and install postgres from the git tree.
# This was tested on Ubuntu 14.04 on 19 July 2015
# when the development version of PGSQL was 9.6devel.
sudo apt-get update
sudo apt-get install build-essential libreadline-dev zlib1g-dev git flex bison libxml2-dev libxslt-dev libssl-dev
git clone git://git.postgresql.org/git/postgresql.git
cd postgresql
./configure
make
# "All of PostgreSQL successfully made. Ready to install."
# To run the tests:
# make check
# This must be run with permissions required to write to the target directory.
# Usually this means being root.
make install
# "PostgreSQL installation complete."
# Add the following to /etc/profile:
# PATH=/usr/local/pgsql/bin:$PATH
# export PATH
#
# MANPATH=/usr/local/pgsql/man:$MANPATH
# export MANPATH
# Then source the file with:
# . /etc/profile
# Check that the installation was successful with:
# psql
# You should see:
#
# psql: could not connect to server: No such file or directory
# Is the server running locally and accepting
# connections on Unix domain socket "/tmp/.s.PGSQL.5432"?
# Config and setup:
adduser postgres
# Make the cluster
mkdir /usr/local/pgsql/data
chown postgres /usr/local/pgsql/data
su - postgres
initdb -D /usr/local/pgsql/data
# start the database server:
postgres -D /usr/local/pgsql/data >logfile 2>&1 &
# create a database
createdb test
# and connect to it:
psql test
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment