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.
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
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
Update Ubuntu repository.
sudo apt-get update
Use apt to install Apache2 and PostgreSQL:
sudo apt-get install -y apache2 libapache2-mod-perl2 postgresql
Make sure Apache and PostgreSQL are running by checking the server port.
netstat -plntu
You can see that port 80 is used by apache and port 5432 is used by the postgresql database.
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
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
Next, use the following command to check whether the module has been loaded:
apachectl -M | sort
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
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
There is already an otrs user in the /etc/passwd file.
grep -rin otrs /etc/passwd
A new user for OTRS has been created.
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
Create a new role otrs with the password myotrspw and an unprivileged user.
create user otrs password 'myotrspw' nosuperuser;
Then create a new otrs database using otrs user permissions:
create database otrs owner otrs; /q
Next edit the PostgreSQL configuration file for otrs role verification.
vim /etc/postgresql/9.5/main/pg_hba.conf
Paste the following configuration after line 84:
local otrs otrs password host otrs otrs 127.0.0.1/32 password
Save the file and exit vim
Use exit to return to root privileges and restart PostgreSQL:
exit systemctl restart postgresql
PostgreSQL is ready for OTRS installation.
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
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
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
Make sure all the results are correct, which means our server can install 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
Use vim to edit the Config.pm file:
vim Kernel/Config.pm
Change the database password for row 42:
$Self->{DatabasePw} = 'myotrspw';
Comment 45 lines of MySQL database support:
# $Self->{DatabaseDSN} = "DBI:mysql:database=$Self->{Database};host=$Self->{DatabaseHost};";
Uncomment line 49 for PostgreSQL database support:
$Self->{DatabaseDSN} = "DBI:Pg:dbname=$Self->{Database};";
Save the file and exit vim.
Then edit the apache startup file to enable PostgreSQL support.
vim scripts/apache2-perl-startup.pl
Uncomment lines 60 and 61:
# enable this if you use postgresql use DBD::Pg (); use Kernel::System::DB::postgresql;
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
You can see in the screenshot below that the result is "OK":
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/
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
Enter the database password myotrspw when needed.
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
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
Enable otrs virtual host and restart apache.
a2ensite otrs systemctl restart apache2
Make sure apache starts without errors.
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
Use the following command to copy all .dist scheduled task scripts:
for foo in *.dist; do cp $foo `basename $foo .dist`; done
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
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
Paste the following configuration:
*/2 * * * * $HOME/bin/otrs.PostMasterMailbox.pl >> /dev/null
Save and exit.
Now stop the otrs daemon and start it again.
bin/otrs.Daemon.pl stop bin/otrs.Daemon.pl start
OTRS installation and configuration are complete.
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.
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.
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.
The following is a customer page to create a new document.
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/
Stop the OTRS daemon:
bin/otrs.Daemon.pl stop
Use the --debug option to start the OTRS daemon.
bin/otrs.Daemon.pl start --debug
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!