Just Code‎ > ‎

Postgres 9.2 - Installation on Ubuntu, including PLV8 Language, from source, resources used

posted Oct 29, 2012, 8:36 AM by Peter Henell   [ updated Oct 29, 2012, 8:37 AM ]
Links used to install Postgres 9.2 on ubuntu server edition.

date: 2012-10-25

This is all a mess, maybe I will clean it up if I need to install it again anytime soon.












My notes for installing this

add repositories for apt:

wget http://ftp.postgresql.org/pub/source/v9.2rc1/postgresql-9.2rc1.tar.gz
tar xvzf postgresql-9.2rc1.tar.gz

sudo ln -s /usr/bin/make /usr/bin/gmake


sudo apt-get install libreadline6-dev
sudo apt-get install zlib1g-dev

sudo make
sudo make install

sudo mkdir /usr/local/pgsql/data
sudo adduser postgres
sudo chown postgres /usr/local/pgsql/data
su - postgres

Then initialize the database:
/usr/local/pgsql/bin/initdb -D /usr/local/pgsql/data/

Then create log directory and a sample database:
cd /usr/local/pgsql/data/
mkdir log
/usr/local/pgsql/bin/postgres -D /usr/local/pgsql/data >/usr/local/pgsql/data/log/logfile 2>&1 &

Create sample DB:
cd ..
bin/createdb mydb
bin/psql mydb

(optional) To start the server automatically at every boot, add: 
su -c '/usr/local/pgsql/bin/pg_ctl start -l /usr/local/pgsql/data/log/logfile -D /usr/local/pgsql/data' postgres 
to your /etc/rc.local file

Configure the postgres server to be reachable from the outside
emacs /usr/local/pgsql/data/postgresql.conf

Find this value and  and edit to allow all external IPs, Remove the # in front of the key
listen_addresses = '*'

Edit security thing:
emacs /usr/local/pgsql/data/pg_hba.conf
Add row:
host    all             all              trust

Download and pgAdmin install for remote admin goodness

To Start the postgres service manually
/usr/local/pgsql/bin/pg_ctl start -D /usr/local/pgsql/data/

-- ------------------------------------------------------------------------------------------
Install V8
mkdir v8
cd v8

svn checkout http://v8.googlecode.com/svn/trunk v8

sudo apt-get install gyp

cd ~/build
svn checkout http://v8.googlecode.com/svn/trunk/ v8
cd v8
export GYPFLAGS="-D OS=linux"
make dependencies
make native.check -j 4 library=shared strictaliasing=off console=readline