In today’s fast-paced business world, providing efficient customer support is crucial for the success of any company. UVDesk helpdesk system is an open-source SaaS-based solution that enables businesses to interact with their customers and offer round-the-clock support. With features like ticket management, knowledgebase support, canned replies, and automatic ticket generation based on emails, UVDesk streamlines customer support processes and enhances customer satisfaction. In this comprehensive guide, we will walk you through the step-by-step process of installing UVDesk on a Ubuntu 22.04 server using Nginx, MySQL, and PHP. So, let’s get started!

Prerequisites

Before we proceed with the installation, make sure you have the following prerequisites in place:

  • A server running Ubuntu 22.04.
  • A fully qualified domain name (FQDN) pointing to the server. For the purpose of this tutorial, we will use the domain uvdesk.example.com.
  • A non-root user with sudo privileges.

Ensure that your server is up to date by running the following commands:

sudo apt update && sudo apt upgrade

To install the basic utility packages, run the following command:

sudo apt install wget curl nano unzip -y

Step 1 – Configure Firewall

Before we begin installing any packages, it is important to configure the firewall to allow HTTP and HTTPS connections. Start by checking the status of the firewall:

sudo ufw status

You should see the following output:

Status: active

To                            Action                        From
--                            ------                        ----
OpenSSH                       ALLOW                       Anywhere
OpenSSH (v6)                  ALLOW                       Anywhere (v6)

To allow HTTP and HTTPS ports, run the following commands:

sudo ufw allow http
sudo ufw allow https

To confirm that the changes have been applied successfully, check the status again:

sudo ufw status

The output should now display the newly added rules:

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)

Step 2 – Install Nginx

Next, we will install Nginx, the web server that will serve UVDesk. Ubuntu 22.04 ships with an older version of Nginx, so we will download the latest version from the official Nginx repository. Follow these steps to install Nginx:

Import Nginx’s signing key:

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

Add the repository for Nginx’s stable version:

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

Update the system repositories:

sudo apt update

Install Nginx:

sudo apt install nginx

Verify the installation:

nginx -v

You should see the output showing the Nginx version:

nginx version: nginx/1.22.0

Start the Nginx server:

sudo systemctl start nginx

Step 3 – Install PHP and Extensions

UVDesk works well with PHP 8.0, which is not the default version in Ubuntu 22.04. To install PHP 8.0 and the required extensions, we will use Ondrej’s PHP repository. Follow these steps to install PHP and the necessary extensions:

Add Ondrej’s PHP repository:

sudo add-apt-repository ppa:ondrej/php

Update your system repository list:

sudo apt update

Install PHP and the required extensions:

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

Verify the version of PHP installed:

php --version

The output should show PHP 8.0.x:

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

Step 4 – Install MySQL

MySQL is the database management system that UVDesk uses to store data. Ubuntu 22.04 ships with the latest version of MySQL, so we can install it with a single command:

sudo apt install mysql-server

Check the version of MySQL:

mysql --version

You should see the version information:

mysql Ver 8.0.x-0ubuntu0.22.04.1 for Linux onx86_64 ((Ubuntu))

For MySQL versions 8.0.28 and above, we need to enter the MySQL Shell to set the password for the root user. Run the following command:

sudo mysql

Inside the MySQL Shell, set the password for the root user. Make sure to use a strong password that includes a mix of numbers, uppercase and lowercase letters, and special characters:

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

Exit the MySQL Shell:

mysql> exit

Run the MySQL secure install script to enhance the security of your MySQL installation:

sudo mysql_secure_installation

Follow the prompts to configure the security options. It is recommended to remove the anonymous users, disallow remote root logins, remove the test database, and reload the privilege tables.

Step 5 – Configure MySQL

Now, let’s configure MySQL to create a database and a user account for UVDesk. Follow these steps:

Log in to the MySQL shell with the root user and the password you set earlier:

sudo mysql -u root -p

Create a database for UVDesk:

mysql> CREATE DATABASE uvdeskdb;

Create an SQL user account for UVDesk:

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

Grant all privileges on the UVDesk database to the user:

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

Flush the privileges to apply the changes:

mysql> FLUSH PRIVILEGES;

Exit the MySQL shell:

mysql> exit

Step 6 – Install Composer

UVDesk uses Composer to manage its dependencies. Follow these steps to download and install Composer:

Download the Composer installer:

php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"

Verify the integrity of the downloaded installer:

php -r "if (hash_file('sha384', 'composer-setup.php') === '55ce33d7678c5a611085589f1f3ddf8b3c52d662cd01d4ba75c0ee0459970c2200a51f492d557530c71c15d8dba01eae') { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;"

Install Composer:

php composer-setup.php

Remove the installer:

php -r "unlink('composer-setup.php');"

Move the Composer executable to the bin directory:

sudo mv composer.phar /usr/local/bin/composer

Verify that Composer has been installed properly:

composer -V

You should see the Composer version:

Composer version 2.4.22022-09-1416:11:15

Step 7 – Download and Configure UVDesk

Now, let’s download and configure UVDesk. Follow these steps:

Create the /var/www directory:

sudo mkdir /var/www

Switch to the www directory:

cd /var/www

Give your current user permission to access the /var/www folder:

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

Use Composer to install the UVDesk dependencies:

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

Install the Access Control Lists (ACL) utility:

sudo apt install acl

Grant permissions on specific directories and files for both the Nginx user and your current user:

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

Step 8 – Install and Configure SSL

To secure your UVDesk installation with SSL, we will use Certbot to generate an SSL certificate. Follow these steps:

Verify that Snapd is up to date by running the following command:

sudo snap install core

Install Certbot:

sudo snap install --classic certbot

Create a symbolic link to make the Certbot command accessible:

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

Generate an SSL certificate by running the following command:

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

The SSL certificate will be downloaded to the /etc/letsencrypt/live/uvdesk.example.com directory on your server.

Generate a Diffie-Hellman group certificate:

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

Check the Certbot renewal scheduler service:

sudo systemctl list-timers

You should find snap.certbot.renew.service listed as one of the services scheduled to run.

To check if the SSL renewal process is working correctly, run a dry run of the process:

sudo certbot renew --dry-run

If there are no errors, your SSL certificate will renew automatically.

Step 9 – Configure Nginx and PHP

Now let’s configure Nginx and PHP to work with UVDesk. Follow these steps:

Configure PHP-FPM

Open the file /etc/php/8.0/fpm/pool.d/www.conf for editing:

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

Find the lines user = www-data and group = www-data and change them to user = nginx and group = nginx respectively.

Find the lines listen.owner = www-data and listen.group = www-data and change them to listen.owner = nginx and listen.group = nginx respectively.

Save the file by pressing Ctrl + X and entering Y when prompted.

Increase the execution time for PHP-FPM and PHP-CLI to 60 seconds:

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

Increase the memory limit for PHP-FPM from 128MB to 256MB:

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

Restart the PHP-FPM service:

sudo systemctl restart php8.0-fpm

Configure Nginx

Create and open the file /etc/nginx/conf.d/uvdesk.conf for editing:

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

Paste the following configuration into the file:

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.example.com/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;
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;
}

Save the file by pressing Ctrl + X and entering Y when prompted.

Open the file /etc/nginx/nginx.conf for editing:

sudo nano /etc/nginx/nginx.conf

Add the following line before the line include /etc/nginx/conf.d/*.conf;:

server_names_hash_bucket_size 64;

Save the file by pressing Ctrl + X and entering Y when prompted.

Verify the Nginx configuration file syntax:

sudo nginx -t

If the syntax is correct, you should see the following output:

nginx: configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful

Restart the Nginx service:

sudo systemctl restart nginx

Step 10 – Install UVDesk

Now it’s time to install UVDesk. Follow these steps:

Launch the URL https://uvdesk.example.com in your browser. You will see the UVDesk installation page.

Click the “Let’s Begin” button to start the installation process. The installer will check for PHP settings and file permissions on the next page.

Click “Proceed” to continue. On the next page, enter the database details you configured earlier.

Click “Proceed” to continue. You will be asked to create a super administrator account. Fill in the required details.

Click “Proceed” to continue. Next, you will be asked to configure the website by giving a name to the Member and Customer Panel prefixes. These prefixes will be used in the website URLs.

Click “Proceed” to continue. You will reach the final installation page.

Click “Install Now” to begin the installation.

Congratulations! You have successfully installed UVDesk on your Ubuntu 22.04 server. You can now access the admin panel and the frontend website using the provided links.

In case you encounter an SQL error stating “SQLSTATE[42S02]: Base table or view not found: 1146 Table ‘uvdesk.uvsupportrole’ doesn’t exist,” you can fix it by running the following commands:

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

Conclusion

In this comprehensive guide, we have walked you through the step-by-step process of installing UVDesk helpdesk system on a Ubuntu 22.04 server using Nginx, MySQL, and PHP. By following these instructions, you have successfully set up UVDesk and can now provide efficient customer support to enhance customer satisfaction. If you have any questions or need further assistance, feel free to reach out in the comments below.

Additional Information

At Shape.host, we offer Linux SSD VPS hosting solutions designed to meet the needs of businesses of all sizes. With our reliable and scalable cloud hosting services, you can ensure the seamless operation of UVDesk and provide exceptional customer support. Visit Shape.host to explore our hosting plans and experience the power of efficient cloud hosting.