將 metabase.jar 移至 /usr/share/metabase/ 目錄
[user]$ sudo su [root]# groupadd -r metabase [root]# useradd -r -s /bin/false -g metabase metabase [root]# chown -R metabase:metabase /usr/share/metabase [root]# touch /var/log/metabase.log [root]# chown syslog:adm /var/log/metabase.log [root]# touch /etc/default/metabase [root]# chmod 640 /etc/default/metabase
建立 Metabase Service 服務檔
[root]# cd /etc/systemd/system/ [root]# vim metabase.service # 輸入下述內容 [Unit] Description=Metabase server After=syslog.target After=network.target [Service] WorkingDirectory=/usr/share/metabase/ ExecStart=/usr/bin/java -jar /usr/share/metabase/metabase.jar EnvironmentFile=/etc/default/metabase User=metabase Type=simple StandardOutput=syslog StandardError=syslog SyslogIdentifier=metabase SuccessExitStatus=143 TimeoutStopSec=120 Restart=always [Install] WantedBy=multi-user.target :x 存檔離開
建立 syslog conf
[root]# vim /etc/rsyslog.d/metabase.conf # 輸入下述內容 if $programname == 'metabase' then /var/log/metabase.log & stop :x 存檔離開 # 重啟 rsyslog.service 以使 metabase.conf 生效 [root]# systemctl restart rsyslog.service
編輯 Metabase 的環境變數
[root]# vim /etc/default/metabase MB_PASSWORD_COMPLEXITY=strong MB_PASSWORD_LENGTH=密碼字串長度 MB_JETTY_HOST=0.0.0.0 MB_JETTY_PORT=3000 MB_DB_TYPE=mysql MB_DB_DBNAME=metabase MB_DB_PORT=3306 MB_DB_USER=metabase MB_DB_PASS=MySQL的metabase帳戶密碼 MB_DB_HOST=localhost MB_EMOJI_IN_LOGS=true # log 要不要有顏文字...這還蠻有趣的...若不要就填 false # any other env vars you want available to Metabase
設定 metabase 為開機啟動
# 先手動啟動 metabase.service [root]# systemctl daemon-reload [root]# systemctl start metabase.service [root]# systemctl status metabase.service # 確定執行沒問題了, 就改為開機自動啟動 [root]# systemctl enable metabase.service
相關筆記 ----
沒有留言:
張貼留言