{"id":2949,"date":"2020-08-29T18:28:41","date_gmt":"2020-08-29T22:28:41","guid":{"rendered":"https:\/\/easy-admin.ca\/?p=2949"},"modified":"2020-08-30T18:11:59","modified_gmt":"2020-08-30T22:11:59","slug":"install-mattermost-5-26-on-centos-7-using-postgresql","status":"publish","type":"post","link":"https:\/\/easy-admin.ca\/index.php\/2020\/08\/29\/install-mattermost-5-26-on-centos-7-using-postgresql\/","title":{"rendered":"Install Mattermost 5.26 on CentOS 7 using PostgreSQL"},"content":{"rendered":"<p>Assuming that you have a running centos 7 server using webmin + virtualmin with a qualified domain name.<\/p>\n<p><a title=\"Mattermost\" href=\"https:\/\/www.mattermost.org\/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Mattermost<\/a>\u00a0is an open-source online chat service. Mattermost is developed by\u00a0<strong>Mattermost Inc<\/strong>, and it is written in\u00a0<strong>Golang<\/strong>\u00a0and\u00a0<strong>Javascript<\/strong>. Mattermost is designed as an internal chat server for organizations and being marketed as an alternate to\u00a0<a title=\"Slack\" href=\"https:\/\/slack.com\/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Slack<\/a>.<\/p>\n<p><strong>Mattermost<\/strong>\u00a0has a simple web interface that can be used for administration as well as instant messaging. Besides that, there are various chat clients are available as Desktop and Mobile Apps for Mattermost chat server.<\/p>\n<p>In this article, we are\u00a0<strong>installing Mattermost 5 on CentOS 7 server<\/strong>. We are also installing\u00a0<strong>PostgreSQL 11<\/strong>, as a prerequisite of Mattermost server software.<\/p>\n<p><strong>Install PostgreSQL yum repository as follows:<\/strong><\/p>\n<p><strong>[root@easy-admin ~]#<\/strong> <span class=\"ahmcommand\">rpm -ivh https:\/\/download.postgresql.org\/pub\/repos\/yum\/reporpms\/EL-7-x86_64\/pgdg-redhat-repo-latest.noarch.rpm<\/span><\/p>\n<p>The same PostgreSQL package provides the yum repositories for various versions of PostgreSQL database.<\/p>\n<p>Therefore, we are disabling the\u00a0<strong>PostgreSQL yum repositories<\/strong>\u00a0other than version 11 as follows.<\/p>\n<p><strong>[root@easy-admin ~]#<\/strong> <span class=\"ahmcommand\">yum-config-manager &#8211;disable pgdg10 pgdg94 pgdg95 pgdg96<\/span><\/p>\n<p><strong>Build yum cache for PostgreSQL repository.<\/strong><\/p>\n<p><strong>[root@easy-admin ~]#<\/strong> <span class=\"ahmcommand\">yum makecache fast<\/span><\/p>\n<p><strong>Install PostgreSQL client and server packages using\u00a0yum\u00a0command.<\/strong><\/p>\n<p><strong>[root@easy-admin ~]#<\/strong> <span class=\"ahmcommand\">yum install -y postgresql11 postgresql11-server<\/span><\/p>\n<p><strong>Initialize PostgreSQL database instance as follows.<\/strong><\/p>\n<p><strong>[root@easy-admin ~]#<\/strong> <span class=\"ahmcommand\">\/usr\/pgsql-11\/bin\/postgresql-11-setup initdb<\/span><\/p>\n<p><strong>Edit\u00a0pg_hba.conf\u00a0file to allow\u00a0md5\u00a0based user authentication.<\/strong><\/p>\n<p><strong>[root@easy-admin ~]#<\/strong> <span class=\"ahmcommand\">nano \/var\/lib\/pgsql\/11\/data\/pg_hba.conf<\/span><\/p>\n<p><strong>Find following directive:<\/strong><\/p>\n<p>host\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0all\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0all\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 127.0.0.1\/32\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0ident<br \/>\n<strong>and update it as:<br \/>\n<\/strong>host\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0all\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0all\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 127.0.0.1\/32\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0<span style=\"color: #ff9900;\">md5<\/span><\/p>\n<p><strong>Enable and start PostgreSQL service.<\/strong><\/p>\n<p><strong>[root@easy-admin ~]#<\/strong> <span class=\"ahmcommand\">systemctl enable postgresql-11.service<\/span><\/p>\n<p><strong>Start PostgreSQL<\/strong><\/p>\n<p><strong>[root@easy-admin ~]#<\/strong> <span class=\"ahmcommand\">systemctl start postgresql-11.service<\/span><\/p>\n<p><strong>Connect as\u00a0postgres\u00a0user and set password for\u00a0admin\u00a0user.<\/strong><\/p>\n<p><strong>[root@easy-admin ~]#<\/strong> <span class=\"ahmcommand\">su &#8211; postgres<\/span><\/p>\n<p>-bash-4.2$ <span class=\"ahmcommand\">psql<\/span><\/p>\n<p>psql (11.4)<\/p>\n<p>Type &#8220;help&#8221; for help.<\/p>\n<p>postgres=# <span class=\"ahmsetting\">ALTER USER postgres WITH PASSWORD &#8216;123&#8217;;<\/span><br \/>\nALTER ROLE<\/p>\n<p><strong>Create the Mattermost database.<\/strong><\/p>\n<p>postgres=# <span class=\"ahmsetting\">CREATE DATABASE mattermost;<\/span><\/p>\n<p><strong>Create the Mattermost user.<\/strong><\/p>\n<p>postgres=# <span class=\"ahmsetting\">CREATE USER mmuser WITH PASSWORD &#8216;123&#8217;;<br \/>\nCREATE ROLE<\/span><\/p>\n<p><strong>Grant all privileges on\u00a0mattermost\u00a0database to\u00a0mmuser.<\/strong><\/p>\n<p>postgres=# <span class=\"ahmsetting\">GRANT ALL PRIVILEGES ON DATABASE mattermost to mmuser;<br \/>\nGRANT<\/span><\/p>\n<p><strong>Exit from\u00a0psql\u00a0and logout from\u00a0postgres\u00a0user.<\/strong><\/p>\n<p>postgres=# <span class=\"ahmsetting\">\\q<br \/>\n<\/span>-bash-4.2$ <span class=\"ahmcommand\">exit<br \/>\nlogout<br \/>\n<\/span><\/p>\n<p>PostgreSQL 11 has been installed on CentOS 7 server.<\/p>\n<p><strong>Installing Mattermost 5 on CentOS 7 server:<\/strong><\/p>\n<p>Download Mattermost software using\u00a0<strong>wget<\/strong>\u00a0command.<\/p>\n<p><strong>[root@easy-admin ~]#<\/strong> <span class=\"ahmcommand\">cd \/tmp<\/span><\/p>\n<p>[root@easy-admin ~]# <span class=\"ahmcommand\">wget https:\/\/releases.mattermost.com\/5.26.1\/mattermost-5.26.1-linux-amd64.tar.gz<\/span><\/p>\n<p><strong>Extract downloaded TAR file using following command.<\/strong><\/p>\n<p><strong>[root@easy-admin ~]#<\/strong> <span class=\"ahmcommand\">tar -C \/opt -xvf mattermost-5.26.1-linux-amd64.tar.gz<\/span><\/p>\n<p><strong>Create the\u00a0storage directory\u00a0for Mattermost files. This\u00a0storage directory\u00a0is used to store files and images posted by Mattermost users.<\/strong><\/p>\n<p><strong>[root@easy-admin ~]#<\/strong> <span class=\"ahmcommand\">cd<\/span><\/p>\n<p><strong>[root@easy-admin ~]#<\/strong> <span class=\"ahmcommand\">mkdir \/opt\/mattermost\/data<\/span><\/p>\n<p><strong>Create OS user and group for Mattermost software.<\/strong><\/p>\n<p><strong>[root@easy-admin ~]#<\/strong> <span class=\"ahmcommand\">useradd &#8211;system &#8211;user-group mattermost<\/span><\/p>\n<p><strong>Adjust file permissions and ownership of\u00a0\/opt\/mattermost\u00a0directory.<\/strong><\/p>\n<p><strong>[root@easy-admin ~]#<\/strong> <span class=\"ahmcommand\">chown -R mattermost:mattermost \/opt\/mattermost<\/span> <strong>[root@easy-admin ~]#<\/strong> <span class=\"ahmcommand\">chmod -R g+w \/opt\/mattermost<\/span><\/p>\n<p><strong>Edit\u00a0\/opt\/mattermost\/config\/config.json\u00a0file to set PostgreSQL database configurations.<\/strong><\/p>\n<p><strong>[root@easy-admin ~]#<\/strong> <span class=\"ahmcommand\">nano \/opt\/mattermost\/config\/config.json<\/span><\/p>\n<p><strong>Search for\u00a0&#8220;SqlSettings&#8221;\u00a0section and update following directives therein.<\/strong><\/p>\n<p>&#8220;DriverName&#8221;: &#8220;postgres&#8221;, &#8220;DataSource&#8221;: &#8220;postgres:\/\/mmuser:123@127.0.0.1:5432\/mattermost?sslmode=disable&amp;connect_timeout=10&#8221;,<\/p>\n<p>Testing Mattermost configurations by executing\u00a0<strong>mattermost<\/strong>\u00a0command.<\/p>\n<p><strong>[root@easy-admin ~]#<\/strong> <span class=\"ahmcommand\">cd \/opt\/mattermost\/<\/span><\/p>\n<p><strong>[root@easy-admin ~]#<\/strong> <span class=\"ahmcommand\">sudo -u mattermost .\/bin\/mattermost<br \/>\n* Go get yourself a cup<\/span><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-2963\" src=\"https:\/\/easy-admin.ca\/wp-content\/uploads\/2020\/08\/49219-200-150x150.png\" alt=\"\" width=\"30\" height=\"30\" srcset=\"https:\/\/easy-admin.ca\/wp-content\/uploads\/2020\/08\/49219-200-150x150.png 150w, https:\/\/easy-admin.ca\/wp-content\/uploads\/2020\/08\/49219-200.png 200w\" sizes=\"auto, (max-width: 30px) 100vw, 30px\" \/>of coffee and let it run a bit,<\/p>\n<p><em>The server should run now!<\/em><\/p>\n<p><em>Exit!<\/em><\/p>\n<p><strong>Create a\u00a0systemd\u00a0service unit for Mattermost.<\/strong><\/p>\n<p><strong>[root@easy-admin ~]#<\/strong> <span class=\"ahmcommand\">cd<\/span><\/p>\n<p><strong>[root@easy-admin ~]#<\/strong> <span class=\"ahmcommand\">nano \/usr\/lib\/systemd\/system\/mattermost<\/span><\/p>\n<p><strong>&#8230;and define the service unit directives as follows.<\/strong><\/p>\n<p>[Unit]<br \/>\nDescription=Mattermost<br \/>\nAfter=syslog.target network.target postgresql-11.service<\/p>\n<p>[Service]<br \/>\nType=notify<br \/>\nWorkingDirectory=\/opt\/mattermost<br \/>\nUser=mattermost<br \/>\nExecStart=\/opt\/mattermost\/bin\/mattermost PIDFile=\/var\/spool\/mattermost\/pid\/master.pid<br \/>\nTimeoutStartSec=3600 LimitNOFILE=49152<\/p>\n<p>[Install]<br \/>\nWantedBy=multi-user.target<\/p>\n<p>Save and close Nano.<\/p>\n<p><strong>Enable and start\u00a0mattermost.service.<\/strong><\/p>\n<p><strong>[root@easy-admin ~]#<\/strong> <span class=\"ahmcommand\">systemctl enable mattermost.service<\/span><\/p>\n<p><strong>[root@easy-admin ~]#<\/strong> <span class=\"ahmcommand\">systemctl start mattermost.service<\/span><\/p>\n<p><strong>Allow Mattermost service port in Linux firewall (I use CSF).<\/strong><\/p>\n<p><strong>[root@easy-admin ~]#<\/strong> <span class=\"ahmcommand\">firewall-cmd &#8211;permanent &#8211;add-port=8065\/tcp<\/span><\/p>\n<p><strong>[root@easy-admin ~]#<\/strong> <span class=\"ahmcommand\">firewall-cmd &#8211;reload<\/span><\/p>\n<p>Open your browser and go to http:\/\/yourdomain:8065<\/p>\n<p>Fill out the information requested!<\/p>\n<p><em><strong>Et Voil\u00e0<\/strong><\/em><\/p>\n<p>\ud83d\ude09<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-2955 size-full\" src=\"https:\/\/easy-admin.ca\/wp-content\/uploads\/2020\/08\/teamwork.png\" alt=\"Mattermost\" width=\"1002\" height=\"571\" srcset=\"https:\/\/easy-admin.ca\/wp-content\/uploads\/2020\/08\/teamwork.png 1002w, https:\/\/easy-admin.ca\/wp-content\/uploads\/2020\/08\/teamwork-300x171.png 300w, https:\/\/easy-admin.ca\/wp-content\/uploads\/2020\/08\/teamwork-768x438.png 768w\" sizes=\"auto, (max-width: 1002px) 100vw, 1002px\" \/><\/p>\n<p>This will work on the latest <strong>Mattermost 5.26.1<\/strong> release.<\/p>\n<p><em><strong>Hope you enjoy!<\/strong><\/em><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Assuming that you have a running centos 7 server using webmin + virtualmin with a qualified domain name. Mattermost\u00a0is an open-source online chat service. Mattermost is developed by\u00a0Mattermost Inc, and it is written in\u00a0Golang\u00a0and\u00a0Javascript. Mattermost is designed as an internal chat server for organizations and being marketed as an alternate to\u00a0Slack. Mattermost\u00a0has a simple web &hellip; <a href=\"https:\/\/easy-admin.ca\/index.php\/2020\/08\/29\/install-mattermost-5-26-on-centos-7-using-postgresql\/\" class=\"more-link\">Continue reading <span class=\"screen-reader-text\">Install Mattermost 5.26 on CentOS 7 using PostgreSQL<\/span><\/a><\/p>\n","protected":false},"author":2,"featured_media":2953,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"slim_seo":{"title":"Install Mattermost 5.26 on CentOS 7 using PostgreSQL - HP Server","description":"Assuming that you have a running centos 7 server using webmin + virtualmin with a qualified domain name. Mattermost \u00a0is an open-source online chat service. Matt"},"footnotes":""},"categories":[1],"tags":[],"class_list":["post-2949","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-general"],"_links":{"self":[{"href":"https:\/\/easy-admin.ca\/index.php\/wp-json\/wp\/v2\/posts\/2949","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/easy-admin.ca\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/easy-admin.ca\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/easy-admin.ca\/index.php\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/easy-admin.ca\/index.php\/wp-json\/wp\/v2\/comments?post=2949"}],"version-history":[{"count":0,"href":"https:\/\/easy-admin.ca\/index.php\/wp-json\/wp\/v2\/posts\/2949\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/easy-admin.ca\/index.php\/wp-json\/wp\/v2\/media\/2953"}],"wp:attachment":[{"href":"https:\/\/easy-admin.ca\/index.php\/wp-json\/wp\/v2\/media?parent=2949"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/easy-admin.ca\/index.php\/wp-json\/wp\/v2\/categories?post=2949"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/easy-admin.ca\/index.php\/wp-json\/wp\/v2\/tags?post=2949"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}