如何在 Ubuntu 22.04 上安装 UVdesk Helpdesk 系统如何在 Ubuntu 22.04 上安装 UVdesk Helpdesk 系统如何在 Ubuntu 22.04 上安装 UVdesk Helpdesk 系统如何在 Ubuntu 22.04 上安装 UVdesk Helpdesk 系统
  • 文章
  • 正则表达式
    • 工具
  • 登录
找到的结果: {phrase} (显示: {results_count} 共: {results_count_total})
显示: {results_count} 共: {results_count_total}

加载更多搜索结果...

搜索范围
模糊匹配
搜索标题
搜索内容
发表 admin at 2025年2月28日
类别
  • 未分类
标签

如何在 Ubuntu 22.04 上安装 UVdesk Helpdesk 系统

在此页

  1. 先决条件
  2. 第 1 步 - 配置防火墙
  3. 第 2 步 - 安装 Nginx
  4. 第 3 步 - 安装 PHP 和扩展
  5. 第 4 步 - 安装 MySQL
  6. 第 5 步 - 配置 MySQL
  7. 第 6 步 - 安装 Composer
  8. 第 7 步 - 下载并配置 UVDesk
  9. 第 8 步 - 安装和配置 SSL
  10. 第 9 步 - 配置 Nginx 和 PHP
    1. 配置PHP-FPM
    2. 配置 Nginx

    UVdesk 是一个基于 SaaS 的开源帮助台系统,供公司与客户互动并提供全天候支持。其功能包括工单管理、知识库支持、预设回复和基于电子邮件的自动工单生成。可以使用外部模块扩展 Uvdesks 功能。您可以根据特定触发器自动执行某些操作,以改进您的工作流程。

    在本教程中,您将学习如何使用 Nginx、MySQL 和 PHP 在 Ubuntu 22.04 服务器上安装 Uvdesk。

    先决条件

    • A server running Ubuntu 22.04.

    • A Fully Qualified domain name (FQDN) pointing to the server. For our tutorial, we will use the uvdesk.example.com domain.

    • A non-root user with sudo privileges.

    • Make sure everything is updated.

      $ sudo apt update && sudo apt upgrade
      
    • Install basic utility packages. Some of them may already be installed.

      $ sudo apt install wget curl nano unzip -y
      

    第 1 步 - 配置防火墙

    在安装任何包之前,第一步是配置防火墙以允许 HTTP 和 HTTPS 连接。

    检查防火墙的状态。

    $ sudo ufw status
    

    您应该会看到如下内容。

    Status: active
    
    To                         Action      From
    --                         ------      ----
    OpenSSH                    ALLOW       Anywhere
    OpenSSH (v6)               ALLOW       Anywhere (v6)
    

    允许 HTTP 和 HTTPs 端口。

    $ sudo ufw allow http
    $ sudo ufw allow https
    

    再次检查状态以确认。

    $ sudo ufw status
    Status: active
    
    To                         Action      From
    --                         ------      ----
    OpenSSH                    ALLOW       Anywhere
    80/tcp                     ALLOW       Anywhere
    443                        ALLOW       Anywhere
    OpenSSH (v6)               ALLOW       Anywhere (v6)
    80/tcp (v6)                ALLOW       Anywhere (v6)
    443 (v6)                   ALLOW       Anywhere (v6)
    

    第 2 步 - 安装 Nginx

    Ubuntu 22.04 附带旧版本的 Nginx。要安装最新版本,您需要下载官方 Nginx 存储库。

    导入 Nginx 签名密钥。

    $ curl https://nginx.org/keys/nginx_signing.key | gpg --dearmor \
    | sudo tee /usr/share/keyrings/nginx-archive-keyring.gpg >/dev/null
    

    添加 Nginx 稳定版本的存储库。

    $ echo "deb [signed-by=/usr/share/keyrings/nginx-archive-keyring.gpg arch=amd64] \
    http://nginx.org/packages/ubuntu `lsb_release -cs` nginx" \
    | sudo tee /etc/apt/sources.list.d/nginx.list
    

    更新系统存储库。

    $ sudo apt update
    

    安装 Nginx。

    $ sudo apt install nginx
    

    验证安装。

    $ nginx -v
    nginx version: nginx/1.22.0
    

    启动 Nginx 服务器。

    $ sudo systemctl start nginx
    

    第 3 步 - 安装 PHP 和扩展

    默认情况下,Ubuntu 22.04 附带 PHP 8.1。不过,UVdesk 可以很好地与 PHP 8.0 配合使用。要安装 PHP 8.0,我们需要使用 Ondrejs PHP 存储库。

    添加 Ondrejs PHP 存储库。

    $ sudo add-apt-repository ppa:ondrej/php
    

    更新您的系统存储库列表。

    $ sudo apt update
    

    安装 PHP 和 UVdesk 所需的扩展。

    $ sudo apt install php8.0 php8.0-curl php8.0-intl php8.0-gd php8.0-xsl php8.0-mbstring php8.0-zip php8.0-xml php8.0-bz2 php8.0-mysql php8.0-soap php8.0-mysql php8.0-fpm php8.0-gmp php8.0-bcmath php8.0-apcu php8.0-redis php8.0-imagick php8.0-imap php8.0-xdebug php8.0-tidy php8.0-ldap php8.0-opcache php8.0-mailparse
    

    检查安装的 PHP 版本。

    $ php --version
    PHP 8.0.23 (cli) (built: Sep 18 2022 10:25:06) ( NTS )
    Copyright (c) The PHP Group
    Zend Engine v4.0.23, Copyright (c) Zend Technologies
        with Zend OPcache v8.0.23, Copyright (c), by Zend Technologies
        with Xdebug v3.1.5, Copyright (c) 2002-2022, by Derick Rethans
    

    第 4 步 - 安装 MySQL

    Ubuntu 22.04 附带最新版本的 MySQL。您可以使用单个命令安装它。

    $ sudo apt install mysql-server
    

    检查MySQL的版本。

    $ mysql --version
    mysql  Ver 8.0.30-0ubuntu0.22.04.1 for Linux on x86_64 ((Ubuntu))
    

    此步骤对于 MySQL 8.0.28 及以上版本是必需的。进入 MySQL 外壳。

    $ sudo mysql
    

    运行以下命令为您的 root 用户设置密码。确保它混合了数字、大写字母、小写字母和特殊字符。

    mysql> ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'YourPassword12!';
    

    退出外壳。

    mysql> exit
    

    运行 MySQL 安全安装脚本。

    $ sudo mysql_secure_installation
    

    首先,系统会要求您输入 root 密码。输入它。接下来,系统将要求您安装验证密码组件。它检查 MySQL 中使用的密码强度。按 Y 进行安装。接下来,系统将要求您设置密码验证策略的级别。选择 2,因为它是最强的。

    Securing the MySQL server deployment.
    
    Enter password for user root:
    
    VALIDATE PASSWORD COMPONENT can be used to test passwords
    and improve security. It checks the strength of password
    and allows the users to set only those passwords which are
    secure enough. Would you like to setup VALIDATE PASSWORD component?
    
    Press y|Y for Yes, any other key for No: Y
    
    There are three levels of password validation policy:
    
    LOW    Length >= 8
    MEDIUM Length >= 8, numeric, mixed case, and special characters
    STRONG Length >= 8, numeric, mixed case, special characters and dictionary                  file
    
    Please enter 0 = LOW, 1 = MEDIUM and 2 = STRONG: 2
    Using existing password for root.
    
    Estimated strength of the password: 100
    

    接下来,输入 N 拒绝更改您的 root 密码。此外,输入 Y 以删除匿名用户、禁止远程 root 登录、删除测试数据库并重新加载权限表。

    Change the password for root ? ((Press y|Y for Yes, any other key for No) : N
    
     ... skipping.
    By default, a MySQL installation has an anonymous user,
    allowing anyone to log into MySQL without having to have
    a user account created for them. This is intended only for
    testing, and to make the installation go a bit smoother.
    You should remove them before moving into a production
    environment.
    
    Remove anonymous users? (Press y|Y for Yes, any other key for No) : Y
    Success.
    
    
    Normally, root should only be allowed to connect from
    'localhost'. This ensures that someone cannot guess at
    the root password from the network.
    
    Disallow root login remotely? (Press y|Y for Yes, any other key for No) : Y
    Success.
    
    By default, MySQL comes with a database named 'test' that
    anyone can access. This is also intended only for testing,
    and should be removed before moving into a production
    environment.
    
    
    Remove test database and access to it? (Press y|Y for Yes, any other key for No) : Y
     - Dropping test database...
    Success.
    
     - Removing privileges on test database...
    Success.
    
    Reloading the privilege tables will ensure that all changes
    made so far will take effect immediately.
    
    Reload privilege tables now? (Press y|Y for Yes, any other key for No) : Y
    Success.
    
    All done!
    

    第 5 步 - 配置 MySQL

    登录到 MySQL 外壳。出现提示时输入您的根密码。

    $ sudo mysql -u root -p
    

    创建示例数据库。

    mysql> CREATE DATABASE uvdeskdb;
    

    创建 SQL 用户帐户。

    mysql> CREATE USER 'uvdesk'@'localhost' IDENTIFIED BY 'Your_password2';
    

    授予用户对数据库的所有权限。

    mysql> GRANT ALL PRIVILEGES ON uvdeskdb.* TO 'uvdesk'@'localhost';
    

    刷新用户权限。

    mysql> FLUSH PRIVILEGES;
    

    退出外壳。

    mysql> exit
    

    第 6 步 - 安装 Composer

    UVdesk 使用 Composer 来管理依赖关系。运行以下命令下载并安装 Composer。

    $ php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
    $ php -r "if (hash_file('sha384', 'composer-setup.php') === '55ce33d7678c5a611085589f1f3ddf8b3c52d662cd01d4ba75c0ee0459970c2200a51f492d557530c71c15d8dba01eae') { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;"
    $ php composer-setup.php
    $ php -r "unlink('composer-setup.php');"
    $ sudo mv composer.phar /usr/local/bin/composer
    

    验证 Composer 是否已正确安装。

    $ composer -V
    Composer version 2.4.2 2022-09-14 16:11:15
    

    第 7 步 - 下载并配置 UVDesk

    创建 /var/www 目录。

    $ sudo mkdir /var/www
    

    切换到 www 目录。

    $ cd /var/www
    

    授予当前登录的系统用户对 /var/www 文件夹的权限。

    $ sudo chown $USER:$USER /var/www/
    

    使用 Composer 为 UVdesk 安装依赖项。

    $ composer clear-cache
    $ composer create-project uvdesk/community-skeleton uvdesk.example.com
    

    安装访问控制列表 (acl) 实用程序。

    $ sudo apt install acl
    

    为当前登录的用户 $USER 和 Nginx 用户 nginx 授予对特定目录和文件的权限。

    $ sudo setfacl -dR -m u:nginx:rwX -m u:$USER:rwX /var/www/uvdesk.example.com/var
    $ sudo setfacl -R -m u:nginx:rwX -m u:$USER:rwX /var/www/uvdesk.example.com/var
    $ sudo setfacl -dR -m u:nginx:rwX -m u:$USER:rwX /var/www/uvdesk.example.com/public
    $ sudo setfacl -R -m u:nginx:rwX -m u:$USER:rwX /var/www/uvdesk.example.com/public
    $ sudo setfacl -dR -m u:nginx:rwX -m u:$USER:rwX /var/www/uvdesk.example.com/config
    $ sudo setfacl -R -m u:nginx:rwX -m u:$USER:rwX /var/www/uvdesk.example.com/config
    $ sudo setfacl -dR -m u:nginx:rwX -m u:$USER:rwX /var/www/uvdesk.example.com/migrations
    $ sudo setfacl -R -m u:nginx:rwX -m u:$USER:rwX /var/www/uvdesk.example.com/migrations
    $ sudo setfacl -m u:nginx:rwX -m u:$USER:rwX /var/www/uvdesk.example.com/.env
    

    第 8 步 - 安装和配置 SSL

    我们需要安装 Certbot 来生成 SSL 证书。您可以使用 Ubuntu 存储库安装 Certbot,也可以使用 Snapd 工具获取最新版本。我们将使用 Snapd 版本。

    Ubuntu 22.04 默认安装了 Snapd。运行以下命令以确保您的 Snapd 版本是最新的。

    $ sudo snap install core
    

    安装 Certbot。

    $ sudo snap install --classic certbot
    

    使用以下命令通过创建指向 /usr/bin 目录的符号链接来确保可以运行 Certbot 命令。

    $ sudo ln -s /snap/bin/certbot /usr/bin/certbot
    

    运行以下命令生成 SSL 证书。

    $ sudo certbot certonly --nginx --agree-tos --no-eff-email --staple-ocsp --preferred-challenges http -m  -d uvdesk.example.com
    

    上述命令会将证书下载到服务器上的 /etc/letsencrypt/live/uvdesk.example.com 目录。

    生成 Diffie-Hellman 组证书。

    $ sudo openssl dhparam -dsaparam -out /etc/ssl/certs/dhparam.pem 4096
    

    检查 Certbot 更新计划程序服务。

    $ sudo systemctl list-timers
    

    您会发现 snap.certbot.renew.service 作为计划运行的服务之一。

    NEXT                        LEFT          LAST                        PASSED      UNIT                      ACTIVATES
    Mon 2022-09-19 00:28:48 UTC 13min left    Sun 2022-09-18 23:31:55 UTC 43min ago   fstrim.timer              fstrim.service
    Mon 2022-09-19 00:39:00 UTC 23min left    Mon 2022-09-19 00:09:00 UTC 6min ago    phpsessionclean.timer     phpsessionclean.service
    Mon 2022-09-19 00:40:00 UTC 24min left    n/a                         n/a         snap.certbot.renew.timer  snap.certbot.renew.service
    .......
    

    要检查 SSL 续订是否正常工作,请试运行该过程。

    $ sudo certbot renew --dry-run
    

    如果您没有看到任何错误,则一切就绪。您的证书将自动更新。

    第 9 步 - 配置 Nginx 和 PHP

    配置 PHP-FPM

    打开文件 /etc/php/8.0/fpm/pool.d/www.conf。

    $ sudo nano /etc/php/8.0/fpm/pool.d/www.conf
    

    我们需要将 PHP 进程的 Unix 用户/组设置为 nginx。找到文件中的 user=www-data 和 group=www-data 行并将它们更改为 nginx。

    ...
    ; Unix user/group of processes
    ; Note: The user is mandatory. If the group is not set, the default user's group
    ;       will be used.
    ; RPM: apache user chosen to provide access to the same directories as httpd
    user = nginx
    ; RPM: Keep a group allowed to write in log dir.
    group = nginx
    ...
    

    找到文件中的 listen.owner=www-data 和 listen.group=www-data 行并将它们更改为 nginx。

    ; Set permissions for unix socket, if one is used. In Linux, read/write
    ; permissions must be set in order to allow connections from a web server. Many
    ; BSD-derived systems allow connections regardless of permissions. The owner
    ; and group can be specified either by name or by their numeric IDs.
    ; Default Values: user and group are set as the running user
    ;                 mode is set to 0660
    listen.owner = nginx
    listen.group = nginx
    

    通过按 Ctrl + X 并在出现提示时输入 Y 来保存文件。

    将 PHP-FPM 和 PHP-CLI 的执行时间增加到 60 秒。

    $ sudo sed -i 's/max_execution_time = 30/max_execution_time = 60/' /etc/php/8.0/fpm/php.ini
    $ sudo sed -i 's/max_execution_time = 30/max_execution_time = 60/' /etc/php/8.0/cli/php.ini
    

    将 PHP-FPM 的内存限制从 128MB 增加到 256MB。

    $ sudo sed -i 's/memory_limit = 128M/memory_limit = 256M/' /etc/php/8.0/fpm/php.ini
    

    重新启动 PHP-FPM 服务。

    $ sudo systemctl restart php8.0-fpm
    

    将 PHP 会话目录的组更改为 Nginx。

    $ sudo chgrp -R nginx /var/lib/php/session
    

    配置 Nginx

    创建并打开文件 /etc/nginx/conf.d/uvdesk.conf 进行编辑。

    $ sudo nano /etc/nginx/conf.d/uvdesk.conf
    

    将以下代码粘贴到其中。

    server {
        listen       443 ssl http2;
        listen       [::]:443 ssl http2;
        server_name  uvdesk.example.com;
    
        access_log  /var/log/nginx/uvdesk.access.log;
        error_log   /var/log/nginx/uvdesk.error.log;
        
    	# SSL
        ssl_certificate      /etc/letsencrypt/live/uvdesk.example.com/fullchain.pem;
        ssl_certificate_key  /etc/letsencrypt/live/uvdesk.example.com/privkey.pem;
        ssl_trusted_certificate /etc/letsencrypt/live/uvdesk.example.com/chain.pem;
        ssl_session_timeout  5m;
        ssl_session_cache shared:MozSSL:10m;
        ssl_session_tickets off;
        ssl_protocols TLSv1.2 TLSv1.3;
        ssl_prefer_server_ciphers on;
        ssl_ciphers ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:DHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384;
        ssl_ecdh_curve X25519:prime256v1:secp384r1:secp521r1;
        ssl_stapling on;
        ssl_stapling_verify on;
        ssl_dhparam /etc/ssl/certs/dhparam.pem;
        resolver 8.8.8.8;
    
        root /var/www/uvdesk/public;
        index index.php;
        
        location / {
            try_files $uri $uri/ /index.php?$args;
        }
    
        # Pass PHP Scripts To FastCGI Server
        location ~ \.php$ {
            fastcgi_split_path_info ^(.+\.php)(.*)$;
            fastcgi_pass unix:/run/php/php8.0-fpm.sock; # Depends On The PHP Version
            fastcgi_index index.php;
            fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
            fastcgi_param PATH_INFO $fastcgi_path_info;
            include fastcgi_params;
            try_files $uri =404;
        }    
    }
    
    # enforce HTTPS
    server {
        listen       80;
        listen       [::]:80;
        server_name  uvdesk.example.com;
        return 301   https://$host$request_uri;
    }
    

    注意 Nginx 配置中使用的根目录是 /var/www/uvdesk/public/ 而不是 /var/www/uvdesk/ .

    完成后按 Ctrl + X 并在出现提示时输入 Y 来保存文件。

    打开文件 /etc/nginx/nginx.conf 进行编辑。

    $ sudo nano /etc/nginx/nginx.conf
    

    在行 include /etc/nginx/conf.d/*.conf; 之前添加以下行。

    server_names_hash_bucket_size  64;
    

    通过按 Ctrl + X 并在出现提示时输入 Y 来保存文件。

    验证 Nginx 配置文件语法。

    $ sudo nginx -t
    nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
    nginx: configuration file /etc/nginx/nginx.conf test is successful
    

    重启 Nginx 服务。

    $ sudo systemctl restart nginx
    

    步骤 10 - 安装 UVDesk

    在浏览器中启动 URL https://uvdesk.example.com,您将看到以下屏幕。

    单击“让我们开始”按钮开始安装过程。安装程序将在下一页检查 PHP 设置和文件权限。

    单击继续以继续。系统将要求您在下一页填写数据库详细信息。输入在步骤 4 中配置的数据。

    单击继续以继续。接下来,系统会要求您创建一个超级管理员帐户。填写您的详细信息。

    单击继续以继续。接下来,系统将要求您通过为成员和客户面板前缀命名来配置网站。这些前缀用于网站 URL。

    单击继续以继续。您将到达最终安装页面。

    单击立即安装开始安装。完成后,您将看到以下屏幕。

    您可以通过给定的链接访问管理面板和前端网站。您的 UVDesk 安装已准备就绪,可以使用了。

    注意:如果安装因 SQL 错误\SQLSTATE[42S02]: Base table or view not found: 1146 Table uvdesk.uv_support_role doesnt exist,\ 而失败,请使用列出的命令下面来解决这个问题。

    $ cd /var/www/helpdesk.example.com/
    $ php bin/console doctrine:migrations:diff
    $ php bin/console doctrine:migrations:migrate
    $ php bin/console c:c
    $ sudo shutdown -r now
    

    结论

    您已经使用 Nginx、MySQL 和 PHP 在 Ubuntu 22.04 服务器上安装了 UVdesk Helpdesk 系统。如果您有任何问题,请在下面的评论中发表。

©2015-2025 艾丽卡 support@alaica.com