Install OTRS Community Edition on Debian 11 with Easy Steps

Posted on

Install OTRS Community Edition on Debian 11 with Easy Steps

Install OTRS Community Edition on Debian 11 with Easy Steps

This guide is designed to walk you through the process of installing OTRS Community Edition on Debian 11. OTRS Community Edition is a robust and feature-rich Ticket Request System (also known as a trouble ticket system) that empowers you to efficiently manage customer telephone calls and e-mails. It’s a versatile tool built to enable your support, sales, pre-sales, billing, internal IT, helpdesk, and other departments to respond swiftly to inbound inquiries. With Install OTRS Community Edition on Debian 11, you can streamline your customer support and internal communication processes.

Now, follow the guide steps below to begin the OTRS Ticket System Setup on Debian 11.

To set up the OTRS Ticket System, log in to your server as a non-root user with sudo privileges and set up a basic firewall. To do this, you can follow our guide on Initial Server Setup with Debian 11.

1. Install Required Packages For OTRS Ticket System

First, update your local package index with the following command:

sudo apt update

Then, use the following command to install the required build tools on your Debian 11 server:

sudo apt install perl libapache2-mod-perl2 libdbd-mysql-perl libtimedate-perl 
libnet-dns-perl libnet-ldap-perl libio-socket-ssl-perl libpdf-api2-perl 
libdbd-mysql-perl libsoap-lite-perl libtext-csv-xs-perl libjson-xs-perl 
libapache-dbi-perl libxml-libxml-perl libxml-libxslt-perl libyaml-perl 
libarchive-zip-perl libcrypt-eksblowfish-perl libencode-hanextra-perl 
libmail-imapclient-perl libtemplate-perl libmoo-perl libauthen-ntlm-perl 
libjavascript-minifier-xs-perl libdbd-odbc-perl  libcss-minifier-xs-perl 
libdbd-pg-perl libdatetime-perl apache2 mariadb-server mariadb-client -y

At this point, you need to create an OTRS system user account by using the command below:

sudo useradd -r -m -d /opt/otrs -c "OTRS User" -s /usr/sbin/nologin otrs

Then, visit the OTRS Community Edition Downloads page and get the latest package by using the wget command and extract it in the /opt/otrs directory:

# sudo wget https://otrscommunityedition.com/download/otrs-community-edition-6.0.39.tar.gz
# sudo tar xvfz otrs-community-edition-6.0.39.tar.gz -C /opt/otrs --strip-components=1

Next, run the OTRS Perl script on Debian 11 to check if all required modules are in place:

sudo perl /opt/otrs/bin/otrs.CheckModules.pl
**Output**
o Apache::DBI......................ok (v1.12)
o Apache2::Reload..................ok (v0.13)
o Archive::Tar.....................ok (v2.36)
o Archive::Zip.....................ok (v1.68)
o Crypt::Eksblowfish::Bcrypt.......ok (v0.009)
o CSS::Minifier::XS................ok (v0.11)
o Date::Format.....................ok (v2.24)
o DateTime.........................ok (v1.54)
  o DateTime::TimeZone.............ok (v2.47)
o DBI..............................ok (v1.643)
o DBD::mysql.......................ok (v4.050)
o DBD::ODBC........................ok (v1.61)
o DBD::Oracle......................Not installed! (optional - Required to connect to a Oracle database.)
o DBD::Pg..........................ok (v3.14.2)
o Digest::SHA......................ok (v6.02)
o Encode::HanExtra.................ok (v0.23)
o IO::Socket::SSL..................ok (v2.069)
o JSON::XS.........................ok (v4.03)
o JavaScript::Minifier::XS.........ok (v0.13)
o List::Util::XS...................ok (v1.55)
o LWP::UserAgent...................ok (v6.64)
o Mail::IMAPClient.................ok (v3.42)
  o IO::Socket::SSL................ok (v2.069)
  o Authen::SASL...................ok (v2.16)
  o Authen::NTLM...................ok (v1.09)
o ModPerl::Util....................ok (v2.000011)
o Moo..............................ok (v2.004004)
o Net::DNS.........................ok (v1.29)
o Net::LDAP........................ok (v0.68)
o Net::SMTP........................ok (v3.11)
o Template.........................ok (v2.27)
o Template::Stash::XS..............ok (undef)
o Text::CSV_XS.....................ok (v1.45)
o Time::HiRes......................ok (v1.9764)
o Unicode::Collate.................ok (v1.27)
o XML::LibXML......................ok (v2.0134)
o XML::LibXSLT.....................ok (v1.99)
o XML::Parser......................ok (v2.46)
o YAML::XS.........................ok (v0.82)

Note: If any Perl module is missing, install them using the package manager.

3. Activate Default OTRS Configuration

At this point, you need to activate the default OTRS configuration, /opt/otrs/Kernel/Config.pm.dist, by renaming it to remove the .dist extension. To do this, run the following command:

sudo cp /opt/otrs/Kernel/Config.pm{.dist,}

When you are done, check other required modules are ok by using the following command:

# sudo perl -cw /opt/otrs/bin/cgi-bin/index.pl
# sudo perl -cw /opt/otrs/bin/cgi-bin/customer.pl
# sudo perl -cw /opt/otrs/bin/otrs.Console.pl
# sudo perl /opt/otrs/bin/otrs.SetPermissions.pl

4. Create OTRS Database User on Debian 11

At this point, you need to run the MySQL security script:

sudo mysql_secure_installation

Set a password for your MariaDB and answer the question by entering the y.

Enter current password for root (enter for none):
Set root password? [Y/n]: Y
Enter Password:
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

Then, log in to your MariaDB shell with the following command

sudo mysql -u root -p

Now use the following command to create the OTRS database on Debian 11:

**MariaDB [(none)]>** create database otrsdb character set utf8 collate utf8_general_ci;

Next, use the following command to create the database user and grant all the privileges to it:

**MariaDB [(none)]>** grant all on otrsdb.* to otrsuser@localhost identified by 'password';

Flush the privileges and exit from the MariaDB shell:

**MariaDB [(none)]>** flush privileges;
**MariaDB [(none)]>** exit;

At this point, edit the MariaDB configuration file and tweak some settings:

sudo vi /etc/mysql/mariadb.conf.d/50-server.cnf

Update the following lines inside the [mysqld] section as shown below:

max_allowed_packet   = 64M
query_cache_size     = 32M
innodb_log_file_size = 256M

When you are done, save and close the file.

To apply the changes, restart the MariaDB service:

sudo systemctl restart mariadb

5. Configure Apache For OTRS Ticket System

At this point, you need to link the OTRS Apache configuration file to the Apache web root directory to serve OTRS via Apache. To do this, run the command below:

sudo ln -s /opt/otrs/scripts/apache2-httpd.include.conf /etc/apache2/sites-enabled/

Disable the default Apache site by running the command below:

sudo a2dissite 000-default.conf

Next, enable the required Apache modules with the following command:

sudo a2enmod perl version deflate filter headers

Set the correct ownership for the /opt/otrs directory:

# sudo chown -R otrs: /opt/otrs/
# sudo usermod -aG www-data otrs

Update OTRS file permissions by using the command below on Debian 11:

sudo /opt/otrs/bin/otrs.SetPermissions.pl --web-group=www-data

Check Apache configuration for any error:

sudo apachectl -t
**Output**
Syntax OK

To apply the changes, restart the Apache service:

sudo systemctl restart apache2

If you have a firewall running on your server, you need to allow external access to Apache service:

sudo ufw allow 80/tcp

6. Access the OTRS Ticket System Dashboard

At this point, you can access your OTRS through the web interface by typing your server’s IP address in your web browser followed by /otrs/installer.pl:

http://server-ip-address/otrs/installer.pl

You will see the OTRS Welcome screen on Debian 11. Click Next to continue.

[OTRS Welcome screen image]

Next, Accept the license and Continue.

[OTRS License Agreement image]

Then, you will see the database selection. Choose MySQL, Use an existing database for OTRS, and click Next. At this point, you need to enter the OTRS Database credentials and click Next.

[OTRS Database Configuration Debian 11 image]

In the next screen, you should see the database setup is successful. Then, click Next.

[OTRS Database Setup image]

Now you should see the system settings screen. Define your required settings and click Next.

[System Settings for OTRS Community edition image]

Define your SMTP server or leave it blank and click on the Skip this step button.

[Mail Configuration for OTRS image]

Once the installation has been completed, you should see the server URL with the login username and password. Click on the provided URL.

[OTRS URL image]

You will be redirected to the OTRS Community Edition login screen on Debian 11. Enter the username and password and click Login.

[OTRS CE Login Screen image]

You should see the OTRS Community Edition dashboard on Debian 11.

[OTRS CE Dashboard image]

You can see the “OTRS Daemon not running error” on the above screen.

To resolve this error, run the following commands on your server:

# sudo -Hiu otrs /opt/otrs/bin/otrs.Daemon.pl start
# sudo cp /opt/otrs/var/cron/otrs_daemon{.dist,}
# sudo -Hiu otrs /opt/otrs/bin/Cron.sh start

Now, refresh the OTRS Community Edition screen. You should see that the error is now gone.

Conclusion

At this point, you have learned to Install OTRS Community Edition on Debian 11 and configure the OTRS Ticket System.

Hope you enjoy it.

Alternative Installation Methods for OTRS Community Edition on Debian 11

While the above guide provides a comprehensive, step-by-step approach to installing OTRS Community Edition on Debian 11, there are alternative methods you might consider, depending on your comfort level with different technologies and your specific requirements. Here are two such alternatives:

1. Using Docker Compose:

Docker offers a containerization solution, and Docker Compose allows you to define and manage multi-container Docker applications. This approach isolates OTRS and its dependencies, simplifying deployment and management. This also aids in scaling and consistency across different environments.

  • Explanation: Instead of manually installing each dependency on your Debian 11 system, you create a docker-compose.yml file that defines the OTRS container, the database container (e.g., MariaDB), and any other required services. Docker Compose then automatically pulls the necessary images, creates the containers, and links them together.

  • Steps:

    1. Install Docker and Docker Compose: Follow the official Docker documentation for installing Docker and Docker Compose on Debian 11.

    2. Create a docker-compose.yml file: This file will define the services (containers) needed for OTRS. Here’s an example:

      version: "3.8"
      services:
        db:
          image: mariadb:10.6
          restart: always
          environment:
            MYSQL_ROOT_PASSWORD: your_root_password
            MYSQL_DATABASE: otrsdb
            MYSQL_USER: otrsuser
            MYSQL_PASSWORD: your_otrs_password
          volumes:
            - db_data:/var/lib/mysql
        otrs:
          image: kduration/otrs-ce:latest # Or a more specific tag
          restart: always
          ports:
            - "8080:80" # Host port:Container port
            - "443:443"
          environment:
            OTRS_DATABASE_HOST: db
            OTRS_DATABASE_USER: otrsuser
            OTRS_DATABASE_PASSWORD: your_otrs_password
            OTRS_DATABASE_NAME: otrsdb
            OTRS_SYSTEM_FQDN: your.domain.com # Replace with your domain
          depends_on:
            - db
          volumes:
            - otrs_data:/opt/otrs
      volumes:
        db_data:
        otrs_data:
      • Explanation of docker-compose.yml:
        • version: Specifies the Docker Compose file version.
        • services: Defines the different containers that make up the application.
        • db: Defines the MariaDB database container.
          • image: Specifies the MariaDB image to use from Docker Hub.
          • restart: Specifies that the container should always restart if it fails.
          • environment: Sets environment variables for the database container, such as the root password, database name, user, and password. Replace the placeholder values with your desired credentials.
          • volumes: Mounts a volume to persist the database data.
        • otrs: Defines the OTRS container.
          • image: Specifies the OTRS image to use from Docker Hub. The provided image is just one option and other images may exist.
          • ports: Maps ports from the host machine to the container. This allows you to access the OTRS web interface from your browser.
          • environment: Sets environment variables for the OTRS container, such as the database host, user, password, database name, and the system’s fully qualified domain name (FQDN). Replace the placeholder values with your actual values.
          • depends_on: Specifies that the OTRS container depends on the database container, ensuring that the database is started before OTRS.
          • volumes: Mounts a volume to persist the OTRS data.
        • volumes: Defines the named volumes used by the containers.
    3. Start the containers: Navigate to the directory containing your docker-compose.yml file and run the following command:

      docker-compose up -d

      This command will download the necessary images, create the containers, and start them in detached mode (in the background).

    4. Access OTRS: Open your web browser and navigate to http://your.domain.com (or http://your_server_ip:8080 if you’re not using a domain name). The OTRS installer should appear.

  • Benefits:

    • Simplified installation: Docker handles dependency management.
    • Isolation: OTRS runs in a container, preventing conflicts with other applications.
    • Portability: Easily move OTRS to different environments.
    • Scalability: Docker makes it easier to scale OTRS if needed.

2. Using a Pre-built Virtual Machine Image:

Another option is to use a pre-built virtual machine (VM) image containing OTRS. This eliminates the need for manual installation and configuration.

  • Explanation: Several providers offer pre-configured VM images with OTRS already installed and ready to use. These images are typically available in formats compatible with virtualization platforms like VirtualBox or VMware. You download the image, import it into your virtualization software, and start the VM.

  • Steps:

    1. Choose a Virtualization Platform: Select a virtualization platform like VirtualBox (free and open-source) or VMware Workstation Player (free for personal use). Install it on your Debian 11 system.
    2. Find a suitable VM image: Search online for pre-built OTRS VM images. Ensure the image is compatible with your chosen virtualization platform and based on a Linux distribution you are comfortable with. Exercise caution when downloading VM images from unknown sources, as they may contain malware. Search reputable marketplaces and cloud providers (e.g., AWS, Azure, Google Cloud) for OTRS images.
    3. Download and Import the Image: Download the VM image and import it into your virtualization platform. The import process will vary slightly depending on the platform you are using.
    4. Configure the VM: Adjust the VM settings as needed, such as memory allocation, network configuration (bridged networking is often preferred), and storage space.
    5. Start the VM: Start the virtual machine.
    6. Access OTRS: Once the VM has booted, determine its IP address (usually via the ip addr command within the VM’s terminal). Then, open your web browser and navigate to http://vm_ip_address/otrs.
  • Benefits:

    • Fastest installation: OTRS is pre-installed and configured.
    • Minimal configuration: The VM image typically includes a basic OTRS configuration.
    • Suitable for testing: Ideal for quickly evaluating OTRS.
  • Drawbacks:

    • Larger download size: VM images are typically much larger than the OTRS installation package.
    • Resource intensive: Running a VM requires more system resources than a native installation or Docker container.
    • Security considerations: Ensure the VM image is from a trusted source and keep the underlying operating system and OTRS software updated.
    • Less customization: Modifying the pre-configured environment within the VM can be more complex than a native installation.

By exploring these alternative installation methods, you can choose the approach that best suits your technical skills, resource constraints, and deployment requirements. Remember to always prioritize security and ensure you are using trusted sources for software and VM images.