Skip to content

Commit 5ca226f

Browse files
committed
Updated PostgreSQL instructions
1 parent 6e8f8ec commit 5ca226f

File tree

2 files changed

+126
-74
lines changed

2 files changed

+126
-74
lines changed

source/install/install-rhel-66-postgresql.rst

Lines changed: 63 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -3,64 +3,91 @@
33
Installing PostgreSQL Database
44
==============================
55

6-
1. For the purposes of this guide we will assume this server has an IP address of ``10.10.10.1``
6+
1. Log into the server that will host the database, and open a terminal window.
77

8-
- **Optional:** if installing on the same machine substitute ``10.10.10.1`` with ``127.0.0.1``
8+
2. Download the PostgreSQL 9.4 Yum repository.
99

10-
2. Install PostgreSQL 9.4+
10+
``wget https://download.postgresql.org/pub/repos/yum/9.4/redhat/rhel-6-x86_64/pgdg-redhat94-9.4-3.noarch.rpm``
1111

12-
- ``sudo yum install http://yum.postgresql.org/9.4/redhat/rhel-6-x86_64/pgdg-redhat94-9.4-1.noarch.rpm``
13-
- ``sudo yum install postgresql94-server postgresql94-contrib``
14-
- ``sudo service postgresql-9.4 initdb``
15-
- ``sudo chkconfig postgresql-9.4 on``
16-
- ``sudo service postgresql-9.4 start``
12+
3. Install the Yum repository from the file that you downloaded.
1713

18-
3. PostgreSQL created a user account called ``postgres``. You will need to log into that account with:
14+
``sudo yum localinstall pgdg-redhat94-9.4-1.noarch.rpm``
1915

20-
- ``sudo -i -u postgres``
16+
4. Install PostgreSQL.
2117

22-
4. You can get a PostgreSQL prompt by typing:
18+
``sudo yum install postgresql94-server postgresql94-contrib``
2319

24-
- ``psql``
20+
5. Initialize the database.
2521

26-
5. Create the Mattermost database by typing:
22+
``sudo service postgresql-9.4 initdb``
2723

28-
- ``postgres=# CREATE DATABASE mattermost;``
24+
6. Set PostgreSQL to start on boot.
2925

30-
6. Create the Mattermost user by typing:
26+
``sudo chkconfig postgresql-9.4 on``
3127

32-
- ``postgres=# CREATE USER mmuser WITH PASSWORD 'mmuser_password';``
28+
7. Start the PostgreSQL server.
3329

34-
7. Grant the user access to the Mattermost database by typing:
30+
``sudo service postgresql-9.4 start``
3531

36-
- ``postgres=# GRANT ALL PRIVILEGES ON DATABASE mattermost to mmuser;``
32+
8. Switch to the *postgres* Linux user account that was created during the installation.
3733

38-
8. You can exit out of PostgreSQL by typing:
34+
``sudo --login --user postgres``
3935

40-
- ``postgres=# \q``
36+
9. Start the PostgreSQL interactive terminal.
4137

42-
9. You can exit the Postgres account by typing:
38+
- ``psql``
4339

44-
- ``exit``
40+
10. Create the Mattermost database.
4541

46-
10. Allow Postgres to listen on all assigned IP Addresses:
42+
``postgres=# CREATE DATABASE mattermost;``
4743

48-
- ``sudo vi /var/lib/pgsql/9.4/data/postgresql.conf``
49-
- Uncomment ``listen_addresses`` and change ``localhost`` to ``\*``
44+
11. Create the Mattermost user 'mmuser'.
5045

51-
11. Alter ``pg_hba.conf`` to allow the Mattermost Server to talk to the
52-
Postgres database:
46+
``postgres=# CREATE USER mmuser WITH PASSWORD 'mmuser_password';``
47+
48+
.. note::
49+
Use a password that is more secure than 'mmuser-password'
5350

54-
- ``sudo vi /var/lib/pgsql/9.4/data/pg_hba.conf``
55-
- Add the following line to the ``IPv4 local connections``:
56-
- ``host all all 10.10.10.2/32 md5``
51+
12. Grant the user access to the Mattermost database.
5752

58-
12. Reload Postgres database:
53+
``postgres=# GRANT ALL PRIVILEGES ON DATABASE mattermost to mmuser;``
5954

60-
- ``sudo service postgresql-9.4 restart``
55+
13. Exit the PostgreSQL interactive terminal.
6156

62-
13. Attempt to connect with the new created user to verify everything
63-
looks good:
57+
``postgre=# \q``
6458

65-
- ``psql --host=10.10.10.1 --dbname=mattermost --username=mmuser --password``
66-
- ``mattermost=> \q``
59+
14. Log out of the *postgres* account.
60+
61+
``exit``
62+
63+
15. Allow Postgres to listen on all assigned IP Addresses. Open ``/etc/postgresql/9.4/main/postgresql.conf`` as root in a text editor.
64+
65+
a. Find the following line:
66+
67+
``#listen_addresses = 'localhost'``
68+
69+
b. Uncomment the line and change ``localhost`` to ``*``:
70+
71+
``listen_addresses = '*'``
72+
73+
16. If the Mattermost server is on a separate machine, modify the file ``pg_hbe.conf`` to allow the Mattermost server to communicate with the database.
74+
75+
If the Mattermost server and the database are on the same machine, then you can skip this step.
76+
77+
a. Open ``/etc/postgresql/9.4/main/pg_hba.conf`` in a text editor.
78+
79+
b. Add the following line to the end of the file, where *<mm-server-IP>* is the IP address of the machine that contains the Mattermost server.
80+
81+
``host all all <mm-server-IP>/32 md5``
82+
83+
17. Reload Postgres database
84+
85+
``sudo systemctl reload postgresql``
86+
87+
18. Verify that you can connect with the user *mmuser*.
88+
89+
``psql --host=localhost --dbname=mattermost --username=mmuser --password``
90+
91+
The PostgreSQL interactive terminal starts. To exit the PostgreSQL interactive terminal, type ``\q`` and press **Enter**.
92+
93+
With the database installed and the initial setup complete, you can now install the Mattermost server.

source/install/install-rhel-71-postgresql.rst

Lines changed: 63 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -3,66 +3,91 @@
33
Installing PostgreSQL Database
44
==============================
55

6-
1. For the purposes of this guide we will assume this server has an IP
7-
address of ``10.10.10.1``
6+
1. Log into the server that will host the database, and open a terminal window.
87

9-
- **Optional:** if installing on the same machine substitute ``10.10.10.1`` with ``127.0.0.1``
8+
2. Download the PostgreSQL 9.4 Yum repository.
109

11-
2. Install PostgreSQL 9.4+
10+
``wget https://download.postgresql.org/pub/repos/yum/9.4/redhat/rhel-7-x86_64/pgdg-redhat94-9.4-3.noarch.rpm``
1211

13-
- ``sudo yum install http://yum.postgresql.org/9.4/redhat/rhel-7-x86_64/pgdg-redhat94-9.4-1.noarch.rpm``
14-
- ``sudo yum install postgresql94-server postgresql94-contrib``
15-
- ``sudo /usr/pgsql-9.4/bin/postgresql94-setup initdb``
16-
- ``sudo systemctl enable postgresql-9.4``
17-
- ``sudo systemctl start postgresql-9.4``
12+
3. Install the Yum repository from the file that you downloaded.
1813

19-
3. PostgreSQL created a user account called ``postgres``. You will need
20-
to log into that account with:
14+
``sudo yum localinstall pgdg-redhat94-9.4-1.noarch.rpm``
2115

22-
- ``sudo -i -u postgres``
16+
4. Install PostgreSQL.
2317

24-
4. You can get a PostgreSQL prompt by typing:
18+
``sudo yum install postgresql94-server postgresql94-contrib``
2519

26-
- ``psql``
20+
5. Initialize the database.
2721

28-
5. Create the Mattermost database by typing:
22+
``sudo service postgresql initdb``
2923

30-
- ``postgres=# CREATE DATABASE mattermost;``
24+
6. Set PostgreSQL to start on boot.
3125

32-
6. Create the Mattermost user by typing:
26+
``sudo systemctl enable postgresql``
3327

34-
- ``postgres=# CREATE USER mmuser WITH PASSWORD 'mmuser_password';``
28+
7. Start the PostgreSQL server.
3529

36-
7. Grant the user access to the Mattermost database by typing:
30+
``sudo systemctl start postgresql``
3731

38-
- ``postgres=# GRANT ALL PRIVILEGES ON DATABASE mattermost to mmuser;``
32+
8. Switch to the *postgres* Linux user account that was created during the installation.
3933

40-
8. You can exit out of PostgreSQL by typing:
34+
``sudo --login --user postgres``
4135

42-
- ``postgres=# \q``
36+
9. Start the PostgreSQL interactive terminal.
4337

44-
9. You can exit the Postgres account by typing:
38+
- ``psql``
4539

46-
- ``exit``
40+
10. Create the Mattermost database.
4741

48-
10. Allow Postgres to listen on all assigned IP Addresses:
42+
``postgres=# CREATE DATABASE mattermost;``
4943

50-
- ``sudo vi /var/lib/pgsql/9.4/data/postgresql.conf``
51-
- Uncomment ``listen_addresses`` and change ``localhost`` to ``\*``
44+
11. Create the Mattermost user 'mmuser'.
5245

53-
11. Alter ``pg_hba.conf`` to allow the Mattermost Server to talk to the
54-
Postgres database:
46+
``postgres=# CREATE USER mmuser WITH PASSWORD 'mmuser_password';``
47+
48+
.. note::
49+
Use a password that is more secure than 'mmuser-password'
5550

56-
- ``sudo vi /var/lib/pgsql/9.4/data/pg_hba.conf``
57-
- Add the following line to the ``IPv4 local connections``:
58-
- ``host all all 10.10.10.2/32 md5``
51+
12. Grant the user access to the Mattermost database.
5952

60-
12. Reload Postgres database:
53+
``postgres=# GRANT ALL PRIVILEGES ON DATABASE mattermost to mmuser;``
6154

62-
- ``sudo systemctl reload postgresql-9.4``
55+
13. Exit the PostgreSQL interactive terminal.
6356

64-
13. Attempt to connect with the new created user to verify everything
65-
looks good:
57+
``postgre=# \q``
6658

67-
- ``psql --host=10.10.10.1 --dbname=mattermost --username=mmuser --password``
68-
- ``mattermost=> \q``
59+
14. Log out of the *postgres* account.
60+
61+
``exit``
62+
63+
15. Allow Postgres to listen on all assigned IP Addresses. Open ``/etc/postgresql/9.4/main/postgresql.conf`` as root in a text editor.
64+
65+
a. Find the following line:
66+
67+
``#listen_addresses = 'localhost'``
68+
69+
b. Uncomment the line and change ``localhost`` to ``*``:
70+
71+
``listen_addresses = '*'``
72+
73+
16. If the Mattermost server is on a separate machine, modify the file ``pg_hbe.conf`` to allow the Mattermost server to communicate with the database.
74+
75+
If the Mattermost server and the database are on the same machine, then you can skip this step.
76+
77+
a. Open ``/etc/postgresql/9.4/main/pg_hba.conf`` in a text editor.
78+
79+
b. Add the following line to the end of the file, where *<mm-server-IP>* is the IP address of the machine that contains the Mattermost server.
80+
81+
``host all all <mm-server-IP>/32 md5``
82+
83+
17. Reload Postgres database
84+
85+
``sudo systemctl reload postgresql``
86+
87+
18. Verify that you can connect with the user *mmuser*.
88+
89+
``psql --host=localhost --dbname=mattermost --username=mmuser --password``
90+
91+
The PostgreSQL interactive terminal starts. To exit the PostgreSQL interactive terminal, type ``\q`` and press **Enter**.
92+
93+
With the database installed and the initial setup complete, you can now install the Mattermost server.

0 commit comments

Comments
 (0)