웹사이트 검색

Ubuntu 22.04에 UVdesk Helpdesk 시스템을 설치하는 방법


이 페이지에서

  1. 전제 조건
  2. 1단계 - 방화벽 구성\n
  3. 2단계 - Nginx 설치
  4. 3단계 - PHP 및 확장 프로그램 설치\n
  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는 기업이 고객과 상호 작용하고 24시간 지원을 제공할 수 있는 오픈 소스 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 및 HTTP 포트를 허용합니다.

    $ 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 저장소를 다운로드해야 합니다.

    Nginxs 서명 키를 가져옵니다.

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

    Nginxs 안정 버전용 리포지토리를 추가합니다.

    $ 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
    

    다음 명령을 실행하여 루트 사용자의 비밀번호를 설정하십시오. 숫자, 대문자, 소문자 및 특수 문자가 혼합되어 있는지 확인하십시오.

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

    쉘을 종료합니다.

    mysql> exit
    

    MySQL 보안 설치 스크립트를 실행합니다.

    $ sudo mysql_secure_installation
    

    먼저 루트 암호를 묻는 메시지가 표시됩니다. 그것을 입력하십시오. 다음으로 Validate Password Component를 설치하라는 메시지가 표시됩니다. MySQL에서 사용되는 암호의 강도를 확인합니다. Y를 눌러 설치합니다. 다음으로 암호 유효성 검사 정책 수준을 설정하라는 메시지가 표시됩니다. 2개가 가장 강력하므로 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을 입력하십시오. 또한 익명 사용자를 제거하고 원격 루트 로그인을 허용하지 않으며 테스트 데이터베이스를 제거하고 권한 테이블을 다시 로드하려면 Y를 입력합니다.

    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 설치 및 구성

    SSL 인증서를 생성하려면 Certbot을 설치해야 합니다. Ubuntus 저장소를 사용하여 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-datagroup=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-datalisten.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을 실행하면 다음 화면이 나타납니다.

    Lets Begin 버튼을 클릭하여 설치 프로세스를 시작합니다. 설치 프로그램은 다음 페이지에서 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 시스템을 설치했습니다. 질문이 있으시면 아래 의견에 게시하십시오.