How to install and configure PostgreSQL on BT5 r1 for Metasploit

Note to self:

apt-get install postgresql libpq-dev
sudo su postgres -c psql
ALTER USER postgres WITH PASSWORD 'your password';
sudo passwd -d postgres
sudo su postgres -c passwd

update-alternatives --config ruby
choose 0 for "auto-mode"
gem install pg
db_driver postgresql
db_connect postgres:”postgreSQL_password”@ (“metasploit” being the name of the database)
workspace -a