如何在 Ubuntu 22.04 上安装 osTicket
在此页
- 先决条件
- 安装 Apache、MariaDB 和 PHP
- 为 osTicket 创建一个数据库
- 下载osTicket
- 创建 Apache 虚拟主机
- 启动 osTicket 安装向导
- 使用 Lets Encrypt SSL 保护 osTicket
- 结论
osTicket 是一种开源票务系统,是中小型企业使用最广泛的票务系统之一。它是一个简单易用的基于 Web 的客户支持门户,可帮助您管理和跟踪所有工单。 osTicket 允许您定义工单路由规则以将工单发送给正确的人。您可以自定义徽标、图像和视频并将其添加到门票中。 osTicket 支持多种数据库类型,例如 MySQL 和 PostgreSQL,并且可以与 LDAP/Active 目录集成以进行集中身份验证。
这篇文章将解释如何在 Ubuntu 22.04 上使用 Apache 安装 osTicket。
先决条件
- 一台运行 Ubuntu 22.04 的服务器。
- 一个有效的域名指向您的服务器 IP。
- 在服务器上配置了根密码。
安装 Apache、MariaDB 和 PHP
首先,您需要在服务器上安装 Apache Web 服务器、MariaDB、PHP 和其他 PHP 扩展。您可以使用以下命令安装所有软件包。
apt install apache2 mariadb-server php libapache2-mod-php php-mysql php-cgi php-fpm php-cli php-curl php-gd php-imap php-mbstring php-pear php-intl php-apcu php-common php-bcmath -y
安装所有包后,使用以下命令启动并启用 Apache 和 MariaDB 服务。
systemctl start apache2
systemctl enable apache2
systemctl start mariadb
systemctl enable mariadb
为 osTicket 创建数据库
首先,使用以下命令保护 MariaDB 安装。
mysql_secure_installation
回答所有问题以设置 MariaDB root 密码并确保安装安全:
Enter current password for root (enter for none):
OK, successfully used password, moving on...
Set root password? [Y/n] Y
New password:
Re-enter new password:
Password updated successfully!
Remove anonymous users? [Y/n] Y
Disallow root login remotely? [Y/n] Y
Remove test database and access to it? [Y/n] Y
Reload privilege tables now? [Y/n] Y
接下来,使用以下命令登录到 MariaDB shell。
mysql -u root -p
登录后,使用以下命令为 osTicket 创建数据库和用户。
MariaDB [(none)]> CREATE DATABASE osticket;
MariaDB [(none)]> CREATE USER 'osticket'@'localhost' IDENTIFIED BY 'securepassword';
接下来,使用以下命令授予 osTicket 数据库的所有权限。
MariaDB [(none)]> GRANT ALL PRIVILEGES ON osticket.* TO IDENTIFIED BY "securepassword";
接下来,使用以下命令刷新权限并退出 MariaDB shell。
MariaDB [(none)]> FLUSH PRIVILEGES;
MariaDB [(none)]> EXIT;
完成后,您可以继续下一步。
下载osTicket
首先,使用以下命令下载最新版本的 osTicket。
wget https://github.com/osTicket/osTicket/releases/download/v1.17.2/osTicket-v1.17.2.zip
下载 osTicket 后,创建 osTicket 目录并将下载的文件解压缩到该目录中。
mkdir /var/www/html/osticket
unzip osTicket-v1.17.2.zip -d /var/www/html/osticket
接下来,使用以下命令更改 osTicket 目录的所有权和权限:
chown -R www-data:www-data /var/www/html/osticket
chmod -R 755 /var/www/html/osticket
现在,使用下面给出的命令重命名 osTicket 示例配置文件:
mv /var/www/html/osticket/upload/include/ost-sampleconfig.php /var/www/html/osticket/upload/include/ost-config.php
完成后,您可以继续下一步。
创建 Apache 虚拟主机
接下来,您需要为 osTicket 创建一个 Apache 虚拟主机配置文件。您可以使用以下命令创建它。
nano /etc/apache2/sites-available/osticket.conf
添加以下行:
<VirtualHost *:80>
ServerName osticket.example.com
ServerAdmin
DocumentRoot /var/www/html/osticket/upload
<Directory /var/www/html/osticket/upload>
Require all granted
Options FollowSymlinks
AllowOverride All
</Directory>
ErrorLog ${APACHE_LOG_DIR}/osticket.error.log
CustomLog ${APACHE_LOG_DIR}/osticket.access.log combined
</VirtualHost>
完成后保存并关闭文件。然后,激活 osTicket 虚拟主机并使用以下命令启用 Apache 重写模块:
a2ensite osticket.conf
a2enmod rewrite
接下来,重新启动 Apache 服务以应用配置更改:
systemctl restart apache2
您可以使用以下命令检查 Apache 状态。
systemctl status apache2
您应该得到以下输出。
? apache2.service - The Apache HTTP Server
Loaded: loaded (/lib/systemd/system/apache2.service; enabled; vendor preset: enabled)
Active: active (running) since Wed 2022-12-21 07:20:15 UTC; 3s ago
Docs: https://httpd.apache.org/docs/2.4/
Process: 62019 ExecStart=/usr/sbin/apachectl start (code=exited, status=0/SUCCESS)
Main PID: 62023 (apache2)
Tasks: 6 (limit: 2238)
Memory: 15.4M
CPU: 42ms
CGroup: /system.slice/apache2.service
??62023 /usr/sbin/apache2 -k start
??62024 /usr/sbin/apache2 -k start
??62025 /usr/sbin/apache2 -k start
??62026 /usr/sbin/apache2 -k start
??62027 /usr/sbin/apache2 -k start
??62028 /usr/sbin/apache2 -k start
Dec 21 07:20:15 ubuntu2204 systemd[1]: apache2.service: Deactivated successfully.
Dec 21 07:20:15 ubuntu2204 systemd[1]: Stopped The Apache HTTP Server.
Dec 21 07:20:15 ubuntu2204 systemd[1]: Starting The Apache HTTP Server...
启动 osTicket 安装向导
您现在可以使用 URL http://osticket.example.com 启动 osTicket 安装向导。您应该看到以下页面。

单击继续。您应该会看到基本安装页面。


定义您的帮助台 URL、姓名、电子邮件、数据库名称、用户名、密码,然后单击立即安装按钮开始安装。安装 osTicket 后,您应该会看到以下页面。

要访问 osTicket 控制面板,请在 Web 浏览器中键入 URL http://osticket.example.com/scp。您应该会看到 osTicket 登录页面。

提供您的管理员用户名和密码,然后单击“登录”按钮。您应该在以下屏幕上看到 osTicket 仪表板。

您还可以使用 URL http://osticket.example.com 访问 osTicket 默认页面。

使用 Lets Encrypt SSL 保护 osTicket
要使用 Lets Encrypt SSL 保护您的网站,您需要在服务器上安装 certbot 包。
首先,使用以下命令安装 Snap 包管理器:
apt install snapd
接下来,将 Snap 包更新到最新版本:
snap install core
snap refresh core
接下来,使用以下命令安装 certbot 包:
snap install --classic certbot
接下来,为 Certbot 二进制文件创建指向系统位置的符号链接:
ln -s /snap/bin/certbot /usr/bin/certbot
接下来,运行以下命令下载并安装 Lets Encrypt SSL 证书:
certbot --apache -d osticket.example.com
您将被要求提供您的电子邮件地址并接受服务条款:
Saving debug log to /var/log/letsencrypt/letsencrypt.log
Enter email address (used for urgent renewal and security notices)
(Enter 'c' to cancel):
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Please read the Terms of Service at
https://letsencrypt.org/documents/LE-SA-v1.3-September-21-2022.pdf. You must
agree in order to register with the ACME server. Do you agree?
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
(Y)es/(N)o: Y
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Would you be willing, once your first certificate is successfully issued, to
share your email address with the Electronic Frontier Foundation, a founding
partner of the Let's Encrypt project and the non-profit organization that
develops Certbot? We'd like to send you email about our work encrypting the web,
EFF news, campaigns, and ways to support digital freedom.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
(Y)es/(N)o: Y
键入 Y 并按 Enter 键为您的域下载并安装 SSL 证书:
Account registered.
Requesting a certificate for osticket.example.com
Successfully received certificate.
Certificate is saved at: /etc/letsencrypt/live/osticket.example.com/fullchain.pem
Key is saved at: /etc/letsencrypt/live/osticket.example.com/privkey.pem
This certificate expires on 2023-03-22.
These files will be updated when the certificate renews.
Certbot has set up a scheduled task to automatically renew this certificate in the background.
Deploying certificate
Successfully deployed certificate for osticket.example.com to /etc/apache2/sites-enable/osticket.conf
Congratulations! You have successfully enabled HTTPS on https://osticket.example.com
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
If you like Certbot, please consider supporting our work by:
* Donating to ISRG / Let's Encrypt: https://letsencrypt.org/donate
* Donating to EFF: https://eff.org/donate-le
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
结论
在本文中,我们向您展示了如何在 Ubuntu 22.04 服务器上使用 Apache 安装 osTicket。您现在可以在您的组织中部署 osTicket 以扩展和简化您的客户服务并显着改善您的客户体验。