Hi there, This post I want to write as a log of my success on configuring Postgresql database to production for my Rails application. 
Let’s get started. I’ve installed Postgresql 8.4 through apt-get.
The first step I do is to change the password of ‘postgres’ user.
Run the command on root shell.
passwd postgres
And I usually allow remote access into my Postgresql database. So, I have to edit the file ‘/etc/postgresql/8.4/main/pg_hba.conf’ by seeing this line.
local all all ident
and change it to…
local all all md5
Then restart the service.
/etc/init.d/postgresql-8.4 restart
The second step I usually do is to install the admin pack.
su - postgres psql template1 < /usr/share/postgresql/8.4/contrib/adminpack.sql psql -d template1 -c "ALTER USER postgres WITH PASSWORD 'newpassword';"
The next step is to create a new database and user to be used by your application. Assume the application is named ‘Social Dating’.
createdb socialdatingdb createuser socialdatinguser --pwprompt psql socialdatingdb GRANT ALL TO socialdatinguser
Then you can test CRUD on the database with…
psql -U socialdatinguser -W socialdatingdb
Enjoy Postgresql!
Please share this page to anyone who think it is helpful for them.