https://docs.zammad.org/en/latest/install/elasticsearch.html
https://docs.zammad.org/en/latest/install/package.html
第1步:更新系統
apt update -y && apt full-upgrade -y
第2步:安裝包依賴項
apt install wget apt-transport-https gnupg2 libimlib2 libimlib2-dev -y
第3步:必須使用正確的區域設置。
apt install locales
locale-gen en_US.UTF-8
echo "LANG=en_US.UTF-8" | tee /etc/default/locale
第4步:安裝 Elasticsearch (Way 1 Offical)
apt install apt-transport-https sudo wget curl gnupg
echo "deb [signed-by=/etc/apt/trusted.gpg.d/elasticsearch.gpg] https://artifacts.elastic.co/packages/7.x/apt stable main"| tee -a /etc/apt/sources.list.d/elastic-7.x.list > /dev/null
curl -fsSL https://artifacts.elastic.co/GPG-KEY-elasticsearch | gpg --dearmor | tee /etc/apt/trusted.gpg.d/elasticsearch.gpg> /dev/null
apt update
apt install elasticsearch -y
# 確保默認啟用elasticsearch並啟動它。
systemctl start elasticsearch
systemctl enable elasticsearch
systemctl status elasticsearch
# 安裝 Elasticsearch 及其附件插件
/usr/share/elasticsearch/bin/elasticsearch-plugin install ingest-attachment
systemctl restart elasticsearch
systemctl status elasticsearch
第5步:安裝 Apache 網絡服務器:
apt install apache2 -y
#啟用 Apache 標頭:
a2enmod headers
systemctl stop apache2
systemctl start apache2
systemctl enable apache2
systemctl status apache2
第6步:安裝 Zammad
# 包依賴項
apt install curl apt-transport-https gnupg -y
# 安裝存儲庫密鑰:
wget -qO- https://dl.packager.io/srv/zammad/zammad/key | apt-key add -
# 將存儲庫添加到Ubuntu:
# Ubuntu 18.04 :
echo "deb https://dl.packager.io/srv/deb/zammad/zammad/stable/ubuntu 18.04 main" | tee /etc/apt/sources.list.d/zammad.list
# 烏班圖20.04:
# echo "deb https://dl.packager.io/srv/deb/zammad/zammad/stable/ubuntu 20.04 main" | tee /etc/apt/sources.list.d/zammad.list
apt update
apt install zammad -y
# 啟動 Zammad 服務並使其在系統啟動時啟動:
systemctl start zammad
systemctl enable zammad
systemctl status zammad
第7步:Elasticsearch連接 Zammad :
zammad run rails r "Setting.set('es_url', 'http://localhost:9200')"
# 建立搜索索引:
zammad run rake zammad:searchindex:rebuild
可選設置
# HTTP Basic
zammad run rails r "Setting.set('es_user', '<username>')"
zammad run rails r "Setting.set('es_password', '<password>')"
第8步:防火牆打開 http 和 https 端口:
ufw allow 80
ufw allow 443
ufw reload
第9步:禁用 Apache 默認虛擬主機文件:
a2dissite 000-default.conf
#重新啟動 apache2 Web 服務器:
systemctl restart apache2
如果您遇到錯誤“ apachectl[2095]:無效命令'RequestHeader',可能拼寫錯誤或由服務器配置中未包含的模塊定義 ”,請啟用apache標頭:
a2enmod headers
systemctl stop apache2
systemctl start apache2
第10步::訪問 Zammad Web 界面
http://your_server_ip_or_hostname
Completed zammad Kevin 2023-07-13
++++ Other ++++
管理 Zammad 的服務
一般來說,Zammad 使用三種服務 - 這些服務可以(重新)啟動和停止 與家長 zammad。
$ # Zammad service to start all services at once
$ systemctl (status|start|stop|restart) zammad
$ # Zammads internal puma server (relevant for displaying the web app)
$ systemctl (status|start|stop|restart) zammad-web
$ # Zammads background worker - relevant for all delayed- and background jobs
$ systemctl (status|start|stop|restart) zammad-worker
$ # Zammads websocket server for session related information
$ systemctl (status|start|stop|restart) zammad-websocket
防火牆和 SELinux
這些步驟的某些部分可能不適用於您,請隨意跳過它們!
SELinux
$ # Allow nginx or apache to access public files of Zammad and communicate
$ chcon -Rv --type=httpd_sys_content_t /opt/zammad/public/
$ setsebool httpd_can_network_connect on -P
$ semanage fcontext -a -t httpd_sys_content_t /opt/zammad/public/
$ restorecon -Rv /opt/zammad/public/
$ chmod -R a+r /opt/zammad/public/