Configuring Postgres database
=============================

These are instructions for setting up NNTPChan with Postgres as the data-storage system.

##Configuring Postgres

Setting up postgres (as root):

    # become postgres user
    su postgres
    # spawn postgres admin shell
    psql 

You'll get a prompt, enter the following:

    CREATE ROLE srnd WITH LOGIN PASSWORD 'srnd';
    CREATE DATABASE srnd WITH ENCODING 'UTF8' OWNER srnd;
    \q

For demo purposes we'll use these credentials.
These are default values, please change them later.

###Important

These credentials assume you are going to run using a user called `srnd`, if your username you plan to run the daemon as is different please change `srnd` to your username.

Configuring Postgres database
=============================

These are instructions for setting up NNTPChan with Postgres as the data-storage system.

##Configuring Postgres
A user with sufficient privileges to run su is required (hint: you can use root). This command switches to the Postgres user, creates a Postgres role called `srnd`, and prompts for a password. For illustrative purposes, we will use `srnd` as the password.

    # su - postgres -c "createuser --pwprompt --createdb --encrypted srnd"

###Important

It's easiest to connect to Postgres using role-based authentication. In this case, our Linux user `srnd` matches up with our Postgres role `srnd`, so role-based authentication can take place. If you're running SRNDv2 as a different user (e.g. `nntpchan`), you will need to create a role that matches that user using the command above.

Use more succinct postgres role creation command
Use more succinct postgres role creation command

It is far less error prone to use the tools that Postgres provides to create the role and the database. This amendment also ensures the created role password is encrypted.