Mettermost 4.4 (今回は 4.4.2) を CentOS 7 (今回は 7.4.1708) へインストールする手順のメモです。DB には MySQL (今回は5.7) を利用します。
それぞれのコマンドややってる事の詳細は省きながら一気に手順を進めるので、気になったり詳しく知りたい時はググってください。またパスワードは適宜、自身の環境に合わせて変更してください。(hogehogeのままはヤバイ)
MySQL5.7 のインストール
yum を利用して MySQL をインストールします。
# yum install http://dev.mysql.com/get/mysql57-community-release-el7-9.noarch.rpm # yum info mysql-community-server # yum install mysql-community-server # cp /etc/my.cnf /etc/my.cnf.org # vi /etc/my.cnf
[mysqld] の下に文字コードを指定します。
[mysqld] character-set-server = utf8
MySQLの起動と自動起動の設定。
# systemctl start mysqld # systemctl status mysqld # systemctl enable mysqld # systemctl is-enabled mysqld
自動作成されたrootユーザーのパスワードを確認。(今回は「xxxxxxxxxx」とします)
# cat /var/log/mysqld.log | grep " A temporary password" 2017-11-30T07:07:12.770297Z 1 [Note] A temporary password is generated for root@localhost: xxxxxxxxxx
MySQLのセキュア初期設定を実行。
# mysql_secure_installation
とりあえず下記のような内容で指定。
New password: hogehoge100%
Change the password for root ? ((Press y|Y for Yes, any other key for No) : yEstimated strength of the password: 100
Change the password for root ? ((Press y|Y for Yes, any other key for No) :Remove anonymous users? (Press y|Y for Yes, any other key for No) : y
Disallow root login remotely? (Press y|Y for Yes, any other key for No) :
Remove test database and access to it? (Press y|Y for Yes, any other key for No) : y
Reload privilege tables now? (Press y|Y for Yes, any other key for No) : y
MySQLのrootユーザーでログインできるか確認して初期設定。
# mysql -u root -p ●パスワードのポリシーを弱くする mysql> SHOW VARIABLES LIKE 'validate_password%'; mysql> SET GLOBAL validate_password_length=4; mysql> SET GLOBAL validate_password_policy=LOW; mysql> SHOW VARIABLES LIKE 'validate_password%'; ●パスワードを再度設定 mysql> SET PASSWORD FOR root@localhost=PASSWORD('hogehoge'); ●Mattermostユーザーの作成 CREATE DATABASE mattermost; GRANT ALL PRIVILEGES ON mattermost.* TO 'mattermost'@'localhost' IDENTIFIED BY 'hogehoge' WITH GRANT OPTION;
Mattermost Serverのインストール
# cd /usr/local/src/ # wget https://releases.mattermost.com/4.4.2/mattermost-4.4.2-linux-amd64.tar.gz # tar -xzf mattermost-4.4.2-linux-amd64.tar.gz # mv mattermost /opt/ # mkdir -p /opt/mattermost/data # useradd -r mattermost -U # chown -R mattermost:mattermost /opt/mattermost # chmod -R g+w /opt/mattermost
設定ファイルを修正。
# cp -p /opt/mattermost/config/config.json /opt/mattermost/config/config.json.org # vim /opt/mattermost/config/config.json
DataSource の内容を下記に変更。
“DataSource”: “mattermost:hogehoge@tcp(localhost:3306)/mattermost?charset=utf8mb4,utf8”,
起動スクリプトの作成。
# touch /etc/systemd/system/mattermost.service # vi /etc/systemd/system/mattermost.service
下記を記載して保存。
[Unit] Description=Mattermost
After=syslog.target network.target mysqld.service[Service] Type=simple
WorkingDirectory=/opt/mattermost/bin
User=mattermost
ExecStart=/opt/mattermost/bin/platform
PIDFile=/var/spool/mattermost/pid/master.pid[Install] WantedBy=multi-user.target
Mattermostの起動と自動起動の設定。
# systemctl daemon-reload # systemctl start mattermost.service # systemctl status mattermost.service # systemctl enable mattermost.service
これでインストールが完了しました。
URLへアクセスしてみてログインできるか確認してみてください。
➡ http://[ホストのIPアドレス]:8065/