osTicket是一个开源的,也是中小型企业使用最广泛的票务系统之一。osTicket 的主要功能之一是其基于 Web 的界面,允许用户创建、跟踪和响应客户支持票证。该界面直观且易于使用,它包括用于管理和组织工单的工具,例如将工单分配给特定用户或团队、设置优先级以及跟踪工单状态的能力。
在 Ubuntu 22.04 LTS Jammy Jellyfish 上安装 osTicket
第 1 步。首先,通过在终端中运行以下命令,确保所有系统软件包都是最新的。apt
<span class="pln">sudo apt update sudo apt upgrade</span>
第 2 步。在 Ubuntu 22.04 上安装 LEMP Stack。
在开始本教程之前,必须在服务器上安装 LEMP 服务器。如果您没有安装 LEMP 堆栈,您可以按照我们的指南进行操作 此处.
第 3 步。在 Ubuntu 22.04 上安装 osTicket。
默认情况下,osTicket 在 Ubuntu 22.04 基本存储库上不可用。现在运行以下命令,从 Ubuntu 系统的官方页面下载最新的稳定版 osTicket:
<span class="pln">wget https</span><span class="pun">:</span><span class="com">//github.com/osTicket/osTicket/releases/download/v1.17.2/osTicket-v1.17.2.zip</span>
接下来,创建一个 osTicket 目录并解压缩该目录中的下载文件:
<span class="pln">mkdir </span><span class="pun">/</span><span class="kwd">var</span><span class="pun">/</span><span class="pln">www</span><span class="pun">/</span><span class="pln">html</span><span class="pun">/</span><span class="pln">osticket unzip osTicket</span><span class="pun">-</span><span class="pln">v1</span><span class="pun">.</span><span class="lit">17.2</span><span class="pun">.</span><span class="pln">zip </span><span class="pun">-</span><span class="pln">d </span><span class="pun">/</span><span class="kwd">var</span><span class="pun">/</span><span class="pln">www</span><span class="pun">/</span><span class="pln">html</span><span class="pun">/</span><span class="pln">osticket</span>
我们需要更改一些文件夹权限:
<span class="pln">chown </span><span class="pun">-</span><span class="pln">R www</span><span class="pun">-</span><span class="pln">data</span><span class="pun">:</span><span class="pln">www</span><span class="pun">-</span><span class="pln">data </span><span class="pun">/</span><span class="kwd">var</span><span class="pun">/</span><span class="pln">www</span><span class="pun">/</span><span class="pln">html</span><span class="pun">/</span><span class="pln">osticket chmod </span><span class="pun">-</span><span class="pln">R </span><span class="lit">755</span> <span class="pun">/</span><span class="kwd">var</span><span class="pun">/</span><span class="pln">www</span><span class="pun">/</span><span class="pln">html</span><span class="pun">/</span><span class="pln">osticket</span>
现在我们重命名 osTicket 示例配置文件:
<span class="pln">mv </span><span class="pun">/</span><span class="kwd">var</span><span class="pun">/</span><span class="pln">www</span><span class="pun">/</span><span class="pln">html</span><span class="pun">/</span><span class="pln">osticket</span><span class="pun">/</span><span class="pln">upload</span><span class="pun">/</span><span class="pln">include</span><span class="pun">/</span><span class="pln">ost</span><span class="pun">-</span><span class="pln">sampleconfig</span><span class="pun">.</span><span class="pln">php </span><span class="pun">/</span><span class="kwd">var</span><span class="pun">/</span><span class="pln">www</span><span class="pun">/</span><span class="pln">html</span><span class="pun">/</span><span class="pln">osticket</span><span class="pun">/</span><span class="pln">upload</span><span class="pun">/</span><span class="pln">include</span><span class="pun">/</span><span class="pln">ost</span><span class="pun">-</span><span class="pln">config</span><span class="pun">.</span><span class="pln">php</span>
第 4 步。配置 MariaDB。
默认情况下,MariaDB 未强化。您可以使用脚本保护 MariaDB。您应该仔细阅读并在每个步骤下方仔细阅读,这将设置root密码,删除匿名用户,禁止远程root登录,并删除测试数据库和对安全MariaDB的访问权限:mysql_secure_installation
<span class="pln">mysql_secure_installation</span>
像这样配置它:
<span class="pun">-</span> <span class="typ">Set</span><span class="pln"> root password</span><span class="pun">?</span> <span class="pun">[</span><span class="pln">Y</span><span class="pun">/</span><span class="pln">n</span><span class="pun">]</span><span class="pln"> y </span><span class="pun">-</span> <span class="typ">Remove</span><span class="pln"> anonymous users</span><span class="pun">?</span> <span class="pun">[</span><span class="pln">Y</span><span class="pun">/</span><span class="pln">n</span><span class="pun">]</span><span class="pln"> y </span><span class="pun">-</span> <span class="typ">Disallow</span><span class="pln"> root login remotely</span><span class="pun">?</span> <span class="pun">[</span><span class="pln">Y</span><span class="pun">/</span><span class="pln">n</span><span class="pun">]</span><span class="pln"> y </span><span class="pun">-</span> <span class="typ">Remove</span><span class="pln"> test database </span><span class="kwd">and</span><span class="pln"> access to it</span><span class="pun">?</span> <span class="pun">[</span><span class="pln">Y</span><span class="pun">/</span><span class="pln">n</span><span class="pun">]</span><span class="pln"> y </span><span class="pun">-</span> <span class="typ">Reload</span><span class="pln"> privilege tables now</span><span class="pun">?</span> <span class="pun">[</span><span class="pln">Y</span><span class="pun">/</span><span class="pln">n</span><span class="pun">]</span><span class="pln"> y</span>
接下来,我们需要登录到 MariaDB 控制台并为 osTicket 创建一个数据库。运行以下命令:
<span class="pln">mysql </span><span class="pun">-</span><span class="pln">u root </span><span class="pun">-</span><span class="pln">p</span>
这将提示您输入密码,因此请输入您的MariaDB root密码并按Enter键。登录到数据库服务器后,您需要为osTicket安装创建一个数据库:
<span class="typ">MariaDB</span> <span class="pun">[(</span><span class="pln">none</span><span class="pun">)]></span><span class="pln"> CREATE DATABASE osticket</span><span class="pun">;</span> <span class="typ">MariaDB</span> <span class="pun">[(</span><span class="pln">none</span><span class="pun">)]></span><span class="pln"> CREATE USER </span><span class="str">'osticket'</span><span class="pun">@</span><span class="str">'localhost'</span><span class="pln"> IDENTIFIED BY </span><span class="str">'your-str0ng-passwd'</span><span class="pun">;</span> <span class="typ">MariaDB</span> <span class="pun">[(</span><span class="pln">none</span><span class="pun">)]></span><span class="pln"> GRANT ALL PRIVILEGES ON osticket</span><span class="pun">.*</span><span class="pln"> TO osticket@localhost IDENTIFIED BY </span><span class="str">"securepassword"</span><span class="pun">;</span> <span class="typ">MariaDB</span> <span class="pun">[(</span><span class="pln">none</span><span class="pun">)]></span><span class="pln"> FLUSH PRIVILEGES</span><span class="pun">;</span> <span class="typ">MariaDB</span> <span class="pun">[(</span><span class="pln">none</span><span class="pun">)]></span><span class="pln"> EXIT</span><span class="pun">;</span>
有关安装 MariaDB 的其他资源,请阅读以下帖子:
- 如何在 Ubuntu Linux √ 上安装 MariaDB
第5步。创建 nginx 虚拟主机。
现在我们为osTicket创建一个Nginx虚拟主机配置文件:
<span class="pln">nano </span><span class="pun">/</span><span class="pln">etc</span><span class="pun">/</span><span class="pln">nginx</span><span class="pun">/</span><span class="pln">conf</span><span class="pun">.</span><span class="pln">d</span><span class="pun">/</span><span class="pln">osticket</span><span class="pun">.</span><span class="pln">conf</span>
添加以下行:
<span class="pln">server </span><span class="pun">{</span><span class="pln"> listen </span><span class="lit">80</span><span class="pun">;</span><span class="pln"> server_name your</span><span class="pun">-</span><span class="pln">domain</span><span class="pun">.</span><span class="pln">com</span><span class="pun">;</span><span class="pln"> root </span><span class="pun">/</span><span class="kwd">var</span><span class="pun">/</span><span class="pln">www</span><span class="pun">/</span><span class="pln">html</span><span class="pun">/</span><span class="pln">osticket</span><span class="pun">/</span><span class="pln">upload</span><span class="pun">;</span><span class="pln"> index index</span><span class="pun">.</span><span class="pln">php</span><span class="pun">;</span><span class="pln"> charset utf</span><span class="pun">-</span><span class="lit">8</span><span class="pun">;</span><span class="pln"> gzip on</span><span class="pun">;</span><span class="pln"> gzip_types text</span><span class="pun">/</span><span class="pln">css application</span><span class="pun">/</span><span class="pln">javascript text</span><span class="pun">/</span><span class="pln">javascript application</span><span class="pun">/</span><span class="pln">x</span><span class="pun">-</span><span class="pln">javascript image</span><span class="pun">/</span><span class="pln">svg</span><span class="pun">+</span><span class="pln">xml text</span><span class="pun">/</span><span class="pln">plain text</span><span class="pun">/</span><span class="pln">xsd text</span><span class="pun">/</span><span class="pln">xsl text</span><span class="pun">/</span><span class="pln">xml image</span><span class="pun">/</span><span class="pln">x</span><span class="pun">-</span><span class="pln">icon</span><span class="pun">;</span><span class="pln"> location </span><span class="pun">/</span> <span class="pun">{</span><span class="pln"> try_files $uri $uri</span><span class="pun">/</span> <span class="pun">/</span><span class="pln">index</span><span class="pun">.</span><span class="pln">php</span><span class="pun">?</span><span class="pln">$query_string</span><span class="pun">;</span> <span class="pun">}</span><span class="pln"> location </span><span class="pun">/</span><span class="pln">api</span><span class="pun">/</span><span class="pln">v0 </span><span class="pun">{</span><span class="pln"> try_files $uri $uri</span><span class="pun">/</span> <span class="pun">/</span><span class="pln">api_v0</span><span class="pun">.</span><span class="pln">php</span><span class="pun">?</span><span class="pln">$query_string</span><span class="pun">;</span> <span class="pun">}</span><span class="pln"> location </span><span class="pun">~</span><span class="pln"> \.php </span><span class="pun">{</span><span class="pln"> include fastcgi</span><span class="pun">.</span><span class="pln">conf</span><span class="pun">;</span><span class="pln"> fastcgi_split_path_info </span><span class="pun">^(.+</span><span class="pln">\.php</span><span class="pun">)(/.+)</span><span class="pln">$</span><span class="pun">;</span><span class="pln"> fastcgi_pass unix</span><span class="pun">:</span><span class="str">/var/</span><span class="pln">run</span><span class="pun">/</span><span class="pln">php</span><span class="pun">/</span><span class="pln">php8</span><span class="pun">.</span><span class="lit">1</span><span class="pun">-</span><span class="pln">fpm</span><span class="pun">.</span><span class="pln">sock</span><span class="pun">;</span> <span class="pun">}</span><span class="pln"> location </span><span class="pun">~</span> <span class="pun">/</span><span class="pln">\.ht </span><span class="pun">{</span><span class="pln"> deny all</span><span class="pun">;</span> <span class="pun">}</span> <span class="pun">}</span>
保存并关闭文件,然后使用以下命令重新启动 Nginx 服务:
<span class="pln">nginx </span><span class="pun">-</span><span class="pln">t sudo systemctl restart nginx</span>
有关安装和管理 Nginx 的其他资源,请阅读下面的帖子:
- 如何在 Ubuntu Linux √ 上安装 Nginx
第 6 步。配置防火墙。
现在我们使用 osTicket 设置了一个简单防火墙 (UFW),以允许在默认 Web 端口 80 上进行公共访问:
<span class="pln">sudo ufw allow </span><span class="typ">OpenSSH</span><span class="pln"> sudo ufw allow </span><span class="str">'Nginx Full'</span><span class="pln"> sudo ufw enable</span>
步骤 7.访问 osTicket Web 界面。
成功安装后,打开您的 Web 浏览器并使用 URL 访问 osTicket Web UI。您将被重定向到以下页面:http://your-domain.com
感谢您使用本教程在 Ubuntu 22.04 LTS Jammy Jellyfish 系统上安装 osTicket with LEMP 堆栈。有关其他帮助或有用信息,我们建议您查看官方osTicket网站。
<code class=" prettyprinted"></code>