Database Server - OtagoPolytechnic/op-mattermost GitHub Wiki

Set up Database Server

Install PostgreSQL 9.3

sudo apt-get install postgresql postgresql-contrib

After install the PostgreSQL created a user account called postgres and logging with that account.

sudo --u postgres

To get into the PostgreSQL command prompt.

psql

Create the Mattermost database.

CREATE DATABASE mattermost;

Create the Mattermost user.

CREATE USER mmuser WITH PASSWORD 'mmuser_password';

Grant the user access to the Mattermost database.

GRANT ALL PRIVILEGES ON DATABASE mattermost to mmuser;

After finishing setting up the database, you need to allow the Postgres to listen on all of the assigned IP Addresses.

sudo vi /etc/postgresql/9.3/main/postgresql.conf

Uncomment the line that said listen_addresses and change the localhost to the *

Save and Exit out of that file.

Go to the file called pg_hba.conf to allow the Postgres to talk to Mattermost.

sudo vi /etc/postgresql/9.3/main/pg_hba.conf

Add the follow line to the IPv4 local connection.

host all all 127.0.0.1/8 md5
host all all 172.31.39.64/20 md5

Reload the Postgres database by using the following command.

sudo service postgresql restart

Test the Database connection by using the following command.

psql --host=172.31.39.64 --dbname=mattermost --username=mmuser --password
⚠️ **GitHub.com Fallback** ⚠️