Home > System Tutorial > LINUX > Tips for installing OTRS on Ubuntu 16.04

Tips for installing OTRS on Ubuntu 16.04

王林
Release: 2024-03-23 21:20:11
forward
887 people have browsed it

OTRS, or Open Source Ticket Request System, is open source ticketing software for customer service, help desk, and IT service management. The software is written in Perl and javascript. This is a trouble ticket solution for companies and organizations that need to manage tickets, complaints, support requests, or other types of reports. OTRS supports multiple database systems including MySQL, PostgreSQL, Oracle, and SQL Server, and it is a multi-platform software that can be installed on Windows and Linux.

在 Ubuntu 16.04 上安装 OTRS技巧

In this tutorial, I will explain how to install and configure OTRS on Ubuntu 16.04. I will be using PostgreSQL as the database for OTRS and Apache web server as the web server.

prerequisites

  • Ubuntu 16.04.
  • Minimum 2GB of memory.
  • root permissions
Step 1 - Install Apache and PostgreSQL

In the first step, we will install the Apache web server as well as PostgreSQL. We will use the latest version from the ubuntu repository.

Use SSH to log in to your Ubuntu server:

ssh root@192.168.33.14
Copy after login

Update Ubuntu repository.

sudo apt-get update
Copy after login

Use apt to install Apache2 and PostgreSQL:

sudo apt-get install -y apache2 libapache2-mod-perl2 postgresql
Copy after login

Make sure Apache and PostgreSQL are running by checking the server port.

netstat -plntu
Copy after login

在 Ubuntu 16.04 上安装 OTRS技巧

You can see that port 80 is used by apache and port 5432 is used by the postgresql database.

Step 2 - Install the Perl module

OTRS is based on Perl, so we need to install some Perl modules required by OTRS.

Use this apt command to install the perl module:

sudo apt-get install -y libapache2-mod-perl2 libdbd-pg-perl libnet-dns-perl libnet-ldap-perl libio-socket-ssl-perl libpdf-api2-perl libsoap-lite-perl libgd-text-perl libgd-graph-perl libapache-dbi-perl libarchive-zip-perl libcrypt-eksblowfish-perl libcrypt-ssleay-perl libencode-hanextra-perl libjson-xs-perl libmail-imapclient-perl libtemplate-perl libtemplate-perl libtext-csv-xs-perl libxml-libxml-perl libxml-libxslt-perl libpdf-api2-simple-perl libyaml-libyaml-perl
Copy after login

After the installation is complete, we need to activate the Perl module for apache, and then restart the apache service.

a2enmod perl
systemctl restart apache2
Copy after login

Next, use the following command to check whether the module has been loaded:

apachectl -M | sort
Copy after login

在 Ubuntu 16.04 上安装 OTRS技巧

Step 3 - Create a new user for OTRS

OTRS is a web-based program and runs under the apache web server. To be safe, we need to run it as a normal user, not root.

Use the useradd command to create a new otrs user:

useradd -r -d /opt/otrs -c 'OTRS User' otrs
Copy after login
  • -r: Use the user as a system user.
  • -d /opt/otrs: Place the new user’s home directory under /opt/otrs.
  • -c: Remarks.

Next, add the otrs user to the www-data user group, because apache runs under the www-data user and user group.

usermod -a -G www-data otrs
Copy after login

There is already an otrs user in the /etc/passwd file.

grep -rin otrs /etc/passwd
Copy after login

在 Ubuntu 16.04 上安装 OTRS技巧

A new user for OTRS has been created.

Step 4 - Create and configure the database

In this section, we will create a new PostgreSQL database for the OTRS system and make some minor changes to the configuration of the PostgreSQL database.

Log in to the postgres user and access the PostgreSQL shell.

su - postgres
psql
Copy after login

Create a new role otrs with the password myotrspw and an unprivileged user.

create user otrs password 'myotrspw' nosuperuser;
Copy after login

Then create a new otrs database using otrs user permissions:

create database otrs owner otrs;
/q
Copy after login

Next edit the PostgreSQL configuration file for otrs role verification.

vim /etc/postgresql/9.5/main/pg_hba.conf
Copy after login

Paste the following configuration after line 84:

local   otrs            otrs                                    password
host    otrs            otrs            127.0.0.1/32            password
Copy after login

Save the file and exit vim

在 Ubuntu 16.04 上安装 OTRS技巧

Use exit to return to root privileges and restart PostgreSQL:

exit
systemctl restart postgresql
Copy after login

PostgreSQL is ready for OTRS installation.

在 Ubuntu 16.04 上安装 OTRS技巧

Step 5 - Download and Configure OTRS

In this tutorial, we will use the latest version from the OTRS website.

Enter the /opt directory and use the wget command to download OTRS 5.0:

cd /opt/
wget http://ftp.otrs.org/pub/otrs/otrs-5.0.16.tar.gz
Copy after login

Expand the otrs file, rename the directory and change the ownership of all otrs files and directories to otrs.

tar -xzvf otrs-5.0.16.tar.gz
mv otrs-5.0.16 otrs
chown -R otrs:otrs otrs
Copy after login

Next, we need to check the system and ensure that OTRS can be installed.

Use the following otrs script command to check the system packages required for OTRS installation:

/opt/otrs/bin/otrs.CheckModules.pl
Copy after login

Make sure all the results are correct, which means our server can install OTRS.

在 Ubuntu 16.04 上安装 OTRS技巧

OTRS has been downloaded and our server is ready to install OTRS.

Next, enter the otrs directory and copy the configuration file.

cd /opt/otrs/
cp Kernel/Config.pm.dist Kernel/Config.pm
Copy after login

Use vim to edit the Config.pm file:

vim Kernel/Config.pm
Copy after login

Change the database password for row 42:

$Self->{DatabasePw} = 'myotrspw';
Copy after login

Comment 45 lines of MySQL database support:

# $Self->{DatabaseDSN} = "DBI:mysql:database=$Self->{Database};host=$Self->{DatabaseHost};";
Copy after login

Uncomment line 49 for PostgreSQL database support:

$Self->{DatabaseDSN} = "DBI:Pg:dbname=$Self->{Database};";
Copy after login

Save the file and exit vim.

Then edit the apache startup file to enable PostgreSQL support.

vim scripts/apache2-perl-startup.pl
Copy after login

Uncomment lines 60 and 61:

# enable this if you use postgresql
use DBD::Pg ();
use Kernel::System::DB::postgresql;
Copy after login

Save the file and exit the editor.

Finally, check for missing dependencies and modules.

perl -cw /opt/otrs/bin/cgi-bin/index.pl
perl -cw /opt/otrs/bin/cgi-bin/customer.pl
perl -cw /opt/otrs/bin/otrs.Console.pl
Copy after login

You can see in the screenshot below that the result is "OK":

在 Ubuntu 16.04 上安装 OTRS技巧

Step 6 - Import the sample database

In this tutorial, we will use the sample database, which can be found in the scripts directory. So we just need to import all the sample database and table structure into the database created in step 4.

Log in to the postgres user and enter the otrs directory.

su - postgres
cd /opt/otrs/
Copy after login

As the otrs user, use the psql command to insert the database and table structure.

psql -U otrs -W -f scripts/database/otrs-schema.postgresql.sql otrs
psql -U otrs -W -f scripts/database/otrs-initial_insert.postgresql.sql otrs
psql -U otrs -W -f scripts/database/otrs-schema-post.postgresql.sql otrs
Copy after login

Enter the database password myotrspw when needed.

在 Ubuntu 16.04 上安装 OTRS技巧

Step 7 - Start the OTRS database and OTRS has been configured, now we can start OTRS.

Set the file and directory permissions of otrs to the www-data user and user group.

/opt/otrs/bin/otrs.SetPermissions.pl --otrs-user=www-data --web-group=www-data
Copy after login

Enable otrs apache configuration by creating a new link file into the apache virtual host directory.

ln -s /opt/otrs/scripts/apache2-httpd.include.conf /etc/apache2/sites-available/otrs.conf
Copy after login

Enable otrs virtual host and restart apache.

a2ensite otrs
systemctl restart apache2
Copy after login

Make sure apache starts without errors.

在 Ubuntu 16.04 上安装 OTRS技巧

Step 8 - Configure OTRS scheduled tasks

OTRS has been installed and running in the Apache web server, but we still need to configure the OTRS scheduled task.

Log in to the otrs user, and then enter the var/cron directory as the otrs user.

su - otrs
cd var/cron/
pwd
Copy after login

Use the following command to copy all .dist scheduled task scripts:

for foo in *.dist; do cp $foo `basename $foo .dist`; done
Copy after login

Use exit to return to root permissions, and use the otrs user to start the scheduled task script.

exit
/opt/otrs/bin/Cron.sh start otrs
Copy after login

在 Ubuntu 16.04 上安装 OTRS技巧

Next, create a new scheduled task for PostMaster to manually collect emails. I will configure it to receive emails every 2 minutes.

su - otrs
crontab -e
Copy after login

Paste the following configuration:

*/2 * * * *    $HOME/bin/otrs.PostMasterMailbox.pl >> /dev/null
Copy after login

Save and exit.

Now stop the otrs daemon and start it again.

bin/otrs.Daemon.pl stop
bin/otrs.Daemon.pl start
Copy after login

在 Ubuntu 16.04 上安装 OTRS技巧

OTRS installation and configuration are complete.

Step 9 - Test OTRS

Open your web browser and enter your server IP address: http://192.168.33.14/otrs/

Use the default user root@localhost and password root to log in.

在 Ubuntu 16.04 上安装 OTRS技巧

Using the default root account you will see a warning. Click on the warning message to create a new admin root user.

The following is the admin page that appears after logging in with another admin root user. There is no error message here.

在 Ubuntu 16.04 上安装 OTRS技巧

If you want to log in as a customer, you can use customer.pl: http://192.168.33.14/otrs/customer.pl

You will see the customer login interface, enter the customer's username and password.

在 Ubuntu 16.04 上安装 OTRS技巧

The following is a customer page to create a new document.

在 Ubuntu 16.04 上安装 OTRS技巧

Step 10 - Troubleshooting

If you still see the "OTRS Daemon is not running" error, you can debug the OTRS daemon process like this.

su - otrs
cd /opt/otrs/
Copy after login

Stop the OTRS daemon:

bin/otrs.Daemon.pl stop
Copy after login

Use the --debug option to start the OTRS daemon.

bin/otrs.Daemon.pl start --debug
Copy after login

The above is the detailed content of Tips for installing OTRS on Ubuntu 16.04. For more information, please follow other related articles on the PHP Chinese website!

source:linuxprobe.com
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template