Building Postgres from source for testing is relatively simple - at least on Ubuntu / Debian.
useradd --home-dir /home/postgres \
--create-home --shell /bin/bash \
--user-group postgres
apt-get install -y build-essential libkrb5-dev \
libxml2 libxml2-dev libxslt1-dev \
libossp-uuid-dev uuid python-dev \
libreadline6 libreadline-dev
./configure --disable-debug --enable-thread-safety \
--with-gssapi --with-openssl \
--with-libxml --with-libxslt \
--with-ossp-uuid --with-python \
--without-bonjour
make world && make install
sudo su - postgres -c "/usr/local/pgsql/bin/initdb -D /home/postgres/cluster -E UTF8"