install postgresql and add database on debian 8

Here's a little followup to my last post. On Debian postgresql defaults to using linux user accounts for access management. Here's how to add a new postregsql user:

sudo apt-get install postgresql postgresql-client

# if no postgress process is running now, this command can fix it
#pg_createcluster 9.4 main --start
# if this command fails with locale errors install all locales it demands
#dpkg-reconfigure locales

sudo adduser dbuser

sudo su -c 'createuser dbuser' postgres
sudo su -c 'createdb -O dbuser owncloud' postgres


written by uniq on 2016-04-29