LoginSignup
36
38

More than 5 years have passed since last update.

SlackクローンのMattermostをCentOS+MySQLで立ててみた

Last updated at Posted at 2016-02-29

大人の事情でSlackは使えないので、
SlackのクローンであるMattermostでサーバを立ててみました。

いくつか他にもプロダクトはあるようでしたが、今回は以下の理由からMattermostを選定しています。
1. DBがMySQL or Postgresが使える
2. hubotプラグインが用意されている
3. 開発がまだ続いている

基本は公式ドキュメントの通りなのですが、公式ドキュメントではPostgresを使っていたためMySQLを使って立てた時のメモとして残しておきます。

注意点

  1. 手順を簡易的にするためあえてrootでインストールしています。
  2. 1と同様の理由からパスワードの設定を省いてます。
  3. OSはCentOS6.7を使っています。

MySQL Setup

MySQL Install

# OracleのMySQLレポジトリを導入
## http://dev.mysql.com/downloads/repo/yum/
rpm -ivh mysql57-community-release-el6-7.noarch.rpm

# このままだとMySQL5.7なのでレポジトリの向き先を修正
vim /etc/yum.repos.d/mysql-community.repo
  [mysql56-community]
  enabled=1

  [mysql57-community]
  enabled=0

yum clean all
yum install mysql-community-client mysql-community-server
service mysqld start

MySQLにデータベースを作成

mysql -uroot
mysql > CREATE DATABASE mattermost;
mysql > GRANT ALL PRIVILEGES ON mattermost.* TO 'mmuser'@'localhost' IDENTIFIED BY 'mmuser_password' WITH GRANT OPTION;

MatterMost Setup

wget https://github.com/mattermost/platform/releases/download/v2.0.0/mattermost.tar.gz
tar zxvf mattermost.tar.gz
mv mattermost /opt
mkdir -p /opt/mattermost/data
adduser mattermost
chown -R mattermost:mattermost /opt/mattermost
chmod -R g+w /opt/mattermost
vim /opt/mattermost/config/config.json
 34         "DataSource": "mmuser:mmuser_password@tcp(localhost:3306)/mattermost?charset=utf8mb4,utf8",
cd /opt/mattermost/bin
su mattermost
./platform

Nginx Setup

vim /etc/yum.repos.d/nginx.repo
  [nginx]
  name=nginx repo
  baseurl=http://nginx.org/packages/rhel/6/$basearch/
  gpgcheck=0
  enabled=1

yum install nginx

vim /etc/nginx/conf.d/mattermost.conf
  server {
    server_name mattermost.example.com;

    location / {
       client_max_body_size 50M;
       proxy_set_header Upgrade $http_upgrade;
       proxy_set_header Connection "upgrade";
       proxy_set_header Host $http_host;
       proxy_set_header X-Real-IP $remote_addr;
       proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
       proxy_set_header X-Forwarded-Proto $scheme;
       proxy_set_header X-Frame-Options SAMEORIGIN;
       proxy_pass http://localhost:8065;
    }
  }

sudo mv /etc/nginx/conf.d/default.conf /etc/nginx/conf.d/default.conf.bak

service nginx restart

ログイン

http://サーバのIP
スクリーンショット 2016-02-29 23.39.32.png

hubot

mattermostのhubotもあるようですので、気になる方はご参考まで。

使い方

こちらの記事に凄いわかりやすくまとめられてました!
ありがたや!

36
38
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
36
38