sudo -u postgre createuser -D -P someusercan't connect to the database, which is misleading if the user happens to be a local Linux user (apparently these users can authenticate with the "peer" mechanism). But if you chose any other name then you indeed have to edit /etc/postgresql/9.1/main/pg_hba.conf file to change the "local all all peer" line to "local all all md5".
To create the database, after I created a user "hr", I did a:
psql -U hr createdb myhrNote: if you haven't or don't want to set the line "local all all peer" to "local all all md5", a less intrusive solution is to add the following line:
local all hr md5I.e. change the authentication method just for the "hr" user. Afterwards, one can create a new database (say "masterdet") by connecting as user "hr" without having to use the option suggested in the article (masquareding as user "postgres" by running the "createdb" command under a "sudo -u postgres". What I basically did to create a new database was:
createdb -U hr -O hr masterdetFinally, instead of the:
sudo apt-get install postgresql-9.1line, a simpler:
sudo apt-get install postgresqlwill do (gets the latest).