Mattermost 是一个开源的、自托管的聊天和协作平台,专为现代团队设计。它类似于Slack等其他聊天平台,但它的设计更加灵活和可定制,重点是安全性和隐私性。Mattermost的主要优点之一是其灵活性和自定义选项。它可以轻松地与其他工具和服务(如GitLab和JIRA)集成,并且可以自定义以满足团队的特定需求。它还具有高度可扩展性,支持大型组织和分布式团队。
在 Ubuntu 22.04 LTS Jammy Jellyfish 上安装 Mattermost
第 1 步。首先,通过在终端中运行以下命令,确保所有系统软件包都是最新的。apt
<span class="pln">sudo apt update sudo apt upgrade sudo apt install dirmngr gnupg apt</span><span class="pun">-</span><span class="pln">transport</span><span class="pun">-</span><span class="pln">https ca</span><span class="pun">-</span><span class="pln">certificates software</span><span class="pun">-</span><span class="pln">properties</span><span class="pun">-</span><span class="pln">common</span>
第 2 步。安装 PostgreSQL 数据库服务器。
默认情况下,PostgreSQL 在 Ubuntu 22.04 基础存储库上可用。现在运行以下命令将最新版本的PostgreSQL安装到您的系统中:
<span class="pln">sudo apt install postgresql postgresql</span><span class="pun">-</span><span class="pln">contrib</span>
成功安装后,启用 PostgreSQL(在系统启动时自动启动)、启动并使用以下命令验证状态:
<span class="pln">sudo systemctl enable postgresql sudo systemctl start postgresql sudo systemctl status postgresql</span>
接下来,运行以下命令登录到您刚刚在上面安装的 PostgreSQL:
<span class="pln">sudo </span><span class="pun">--</span><span class="pln">login </span><span class="pun">--</span><span class="pln">user postgres psql</span>
然后,我们创建 Mattermost 数据库:
<span class="pln">postgres</span><span class="pun">=#</span><span class="pln"> CREATE DATABASE mattermostdb</span><span class="pun">;</span><span class="pln"> postgres</span><span class="pun">=#</span><span class="pln"> CREATE USER mmuser WITH PASSWORD </span><span class="str">'mmuser-password'</span><span class="pun">;</span><span class="pln"> postgres</span><span class="pun">=#</span><span class="pln"> GRANT ALL PRIVILEGES ON DATABASE mattermost to mmuser</span><span class="pun">;</span><span class="pln"> postgres</span><span class="pun">=#</span><span class="pln"> \q</span>
有关安装 PostgreSQL 的其他资源,请阅读下面的帖子:
- 如何在 Ubuntu Linux 上安装 PostgreSQL √
第 3 步。在 Ubuntu 22.04 上安装 Mattermost。
默认情况下,Mattermost 在 Ubuntu 22.04 基本存储库中不可用。现在运行以下命令,将最新版本的 Mattermost 下载到您的 Ubuntu 系统:
<span class="pln">wget https</span><span class="pun">:</span><span class="com">//releases.mattermost.com/7.5.2/mattermost-7.5.2-linux-amd64.tar.gz</span>
接下来,提取存档:
<span class="pln">tar </span><span class="pun">-</span><span class="pln">xvzf mattermost</span><span class="pun">*.</span><span class="pln">gz</span>
将解压缩的文件移动到目录中。/opt
<span class="pln">sudo mv mattermost </span><span class="pun">/</span><span class="pln">opt</span>
为 Mattermost 服务器创建数据存储目录。
<span class="pln">sudo mkdir </span><span class="pun">/</span><span class="pln">opt</span><span class="pun">/</span><span class="pln">mattermost</span><span class="pun">/</span><span class="pln">data</span>
第 4 步。为 Mattermost 创建一个用户。
您需要创建一个 Mattermost 系统用户和组才能启动该服务:
<span class="pln">sudo useradd </span><span class="pun">--</span><span class="pln">system </span><span class="pun">--</span><span class="pln">user</span><span class="pun">-</span><span class="kwd">group</span><span class="pln"> mattermost</span>
使用以下命令验证它是否为系统用户:
<span class="pln">id mattermost</span>
接下来,您需要将 Mattermost 目录的所有权更改为您刚刚创建的 Mattermost 用户。为此,请输入以下命令:
<span class="pln">sudo chown </span><span class="pun">-</span><span class="pln">R mattermost</span><span class="pun">:</span><span class="pln">mattermost </span><span class="pun">/</span><span class="pln">opt</span><span class="pun">/</span><span class="pln">mattermost</span>
第5步。配置最重要的服务器。
现在打开配置文件:/opt/mattermost/config/config.json
<span class="pln">nano </span><span class="pun">/</span><span class="pln">opt</span><span class="pun">/</span><span class="pln">mattermost</span><span class="pun">/</span><span class="pln">config</span><span class="pun">/</span><span class="pln">config</span><span class="pun">.</span><span class="pln">json</span>
在 下找到变量并将其值更改为 。DriverName
SqlSettings
mysql
<span class="str">"DriverName"</span><span class="pun">:</span> <span class="str">"mysql"</span><span class="pun">,</span>
将变量设置为以下值。替换为在步骤 2 中配置的 SQL 用户名、SQL 密码和数据库名称。DataSource
mmuser
YourPassword23!
mattermostdb
<span class="str">"DataSource"</span><span class="pun">:</span> <span class="str">"mmuser:Your-strong-Passwd@tcp(localhost:3306)/mattermostdb?charset=utf8mb4,utf8&writeTimeout=30s"</span><span class="pun">,</span>
第 6 步。为最重要的创建一个系统服务。
现在我们创建一个服务文件来管理 Mattermost 服务:systemd
<span class="pln">nano </span><span class="pun">/</span><span class="pln">lib</span><span class="pun">/</span><span class="pln">systemd</span><span class="pun">/</span><span class="pln">system</span><span class="pun">/</span><span class="pln">mattermost</span><span class="pun">.</span><span class="pln">service</span>
添加以下文件:
<span class="pun">[</span><span class="typ">Unit</span><span class="pun">]</span> <span class="typ">Description</span><span class="pun">=</span><span class="typ">Mattermost</span> <span class="typ">After</span><span class="pun">=</span><span class="pln">network</span><span class="pun">.</span><span class="pln">target </span><span class="typ">After</span><span class="pun">=</span><span class="pln">postgresql</span><span class="pun">.</span><span class="pln">service </span><span class="typ">BindsTo</span><span class="pun">=</span><span class="pln">postgresql</span><span class="pun">.</span><span class="pln">service </span><span class="pun">[</span><span class="typ">Service</span><span class="pun">]</span> <span class="typ">Type</span><span class="pun">=</span><span class="pln">notify </span><span class="typ">ExecStart</span><span class="pun">=</span><span class="str">/opt/</span><span class="pln">mattermost</span><span class="pun">/</span><span class="pln">bin</span><span class="pun">/</span><span class="pln">mattermost </span><span class="typ">TimeoutStartSec</span><span class="pun">=</span><span class="lit">3600</span> <span class="typ">KillMode</span><span class="pun">=</span><span class="pln">mixed </span><span class="typ">Restart</span><span class="pun">=</span><span class="pln">always </span><span class="typ">RestartSec</span><span class="pun">=</span><span class="lit">10</span> <span class="typ">WorkingDirectory</span><span class="pun">=</span><span class="str">/opt/</span><span class="pln">mattermost </span><span class="typ">User</span><span class="pun">=</span><span class="pln">mattermost </span><span class="typ">Group</span><span class="pun">=</span><span class="pln">mattermost </span><span class="typ">LimitNOFILE</span><span class="pun">=</span><span class="lit">49152</span> <span class="pun">[</span><span class="typ">Install</span><span class="pun">]</span> <span class="typ">WantedBy</span><span class="pun">=</span><span class="pln">multi</span><span class="pun">-</span><span class="pln">user</span><span class="pun">.</span><span class="pln">target</span>
保存并关闭文件,然后使用以下命令重新加载守护程序:systemd
<span class="pln">sudo systemctl daemon</span><span class="pun">-</span><span class="pln">reload sudo systemctl start mattermost sudo systemctl enable mattermos</span>
步骤 7.配置防火墙。
现在我们使用 Apache 设置了一个简单防火墙 (UFW),以允许在 8065 的默认 Web 端口上进行公共访问:
<span class="pln">sudo ufw allow </span><span class="typ">OpenSSH</span><span class="pln"> sudo ufw allow </span><span class="lit">8065</span><span class="pln"> sudo ufw enable</span>
第8步。访问最重要的 Web 界面。
成功安装后,打开您的 Web 浏览器并使用 URL 访问 Mattermost 安装向导。您将被重定向到以下页面:http://your-IP-address:8065
感谢您使用本教程在 Ubuntu 22.04 LTS Jammy Jellyfish 系统上安装 Mattermost。如需其他帮助或有用信息,我们建议您查看 Mattermost 官方网站。