logo of Mattermost. Copyright © Mattermost.com

Mattermost 5.x with CentOS 7.x and PostgreSQL 11.x

Frank Baier

--

My Mattermost Test Server is running with CentOS 7.6.1810 at Kernel 4.19.6 with Mattermost 5.5.0 and PostgreSQL 10.6. After the following steps the server is running Mattermost 5.5.0 with PostgreSQL 11.1.

1.1 Add the PostgreSQL 11 YUM repository

rpm -Uvh https://yum.postgresql.org/11/redhat/rhel-7-x86_64/pgdg-centos11-11-2.noarch.rpm

1.2 Download the PostreSQL 11.x YUM repository for CentOS 7.x

cd /tmp

curl -O https://download.postgresql.org/pub/repos/yum/11/redhat/rhel-7.5-x86_64/pgdg-centos11-11-2.noarch.rpm

yum localinstall pgdg-centos11–11–2.noarch.rpm

2. Update the YUM repositories

yum update

3. Install the PostgreSQL 11.x server

yum install postgresql11-server

4. Initialize the PostgreSQL 11.x database and directory

/usr/pgsql-11/bin/postgresql-11-setup initdb

Old:
Bin: /usr/pgsql-10/bin/
Config: /var/lib/pgsql/10/data/

New:
Bin: /usr/pgsql-11/bin/
Config: /var/lib/pgsql/11/data/

5. Stop the PostgreSQL 10.x service

systemctl stop postgresql-10.service

6. Upgrade PostgreSQL 10.x to 11.x

su postgres
cd /tmp
/usr/pgsql-11/bin/pg_upgrade -b /usr/pgsql-10/bin/ -B /usr/pgsql-11/bin/ -d /var/lib/pgsql/10/data/ -D /var/lib/pgsql/11/data/

7. Copy the old config files from the old PostgreSQL 10.x data folder to the new PostgreSQL 11.x data folder

su root
cp /var/lib/pgsql/10/data/postgresql.conf /var/lib/pgsql/11/data/postgresql.conf
cp /var/lib/pgsql/10/data/pg_hba.conf /var/lib/pgsql/11/data/pg_hba.conf

8. Check the new HBA file

nano /var/lib/pgsql/11/data/pg_hba.conf

9. Check the authentication method

If Mattermost and the database are running on a local system only the local database user “mmuser” should have access at the local Mattermost database “mattermost”.

# psql: FATAL: Ident authentication failed for user “mmuser”

old:
host all 127.0.0.1/32 ident

new:
host mattermost mmuser 127.0.0.1/32 md5

10. After the successful check and upgrade of PostgreSQL 11.x start the PostgreSQL 11.x service to analyse the new cluster

systemctl start postgresql-11.service
systemctl enable postgresql-11.service
systemctl status postgresql-11.service -l

11. Analyse the new PostgreSQL 11.x cluster

su postgres
cd /tmp
./analyze_new_cluster.sh

11.1 If everything is running without any problem you can remove the old PostreSQL 10.x data via script

./delete_old_cluster.sh

12. Remove the old PostgreSQL 10.x installed version

yum remove postgresql10

13. Check the psql 11.x version

/usr/bin/psql — version

14. Remove the old PostgreSQL 10.x repository

rpm -qa | grep -i pgdg

rpm -e pgdg-centos10–10–2.noarch

rpm -e postgresql10-libs-10.6–1PGDG.rhel7.x86_64

--

--