If you want to install OTRS from source, first download the source archive as .tar.gz, .tar.bz2, or .zip file from http://www.otrs.com/try/
Unpack the archive (for example, using tar) into the directory /opt
, and rename the directory from otrs-x.x.x to otrs (see Script below).
linux:/opt# tar xf /tmp/otrs-x.x.x.tar.gz linux:/opt# mv otrs-x.x.x otrs linux:/opt# ls otrs linux:/opt#
Script: First steps to install OTRS.
OTRS should NOT be run with root rights. Next you should add a new user for OTRS. The home directory of this
new user should be /opt/otrs
. If your web server is not running with the same user rights as the new 'otrs' user, which is the case on most systems, you will need to add the new 'otrs' user to the group of the web server user (see Script below).
linux:/opt# useradd -r -d /opt/otrs/ -c 'OTRS user' otrs linux:/opt# usermod -G nogroup otrs linux:/opt#
Script: Adding a new user 'otrs', and adding it to a group.
Next, you have to copy some sample configuration files. The system will later use the copied files. The files are located in /opt/otrs/Kernel
and /opt/otrs/Kernel/Config
and have the suffix .dist (see Script below).
linux:/opt# cd otrs/Kernel/ linux:/opt/otrs/Kernel# cp Config.pm.dist Config.pm linux:/opt/otrs/Kernel# cd Config linux:/opt/otrs/Kernel/Config# cp GenericAgent.pm.dist GenericAgent.pm
Script: Copying some sample files.
The last step to prepare the installation of OTRS is to set the proper access rights for the files. You can use the script
otrs.SetPermissions.pl, which is located in the bin
directory, in the home directory of the 'otrs' user. You can execute the script with the following parameters:
otrs.SetPermissions.pl
{
Home directory of the OTRS user
} {
--otrs-user=
OTRS user
} {
--web-user=
Web server user
} [
--otrs-group=
Group of the OTRS user
] [
--web-group=
Group of the web server user
]
If your web server is running with the same user rights as user 'otrs', the command to set the proper access rights is otrs.SetPermissions.pl /opt/otrs --otrs-user=otrs --web-user=otrs. On SUSE systems the web server is running with the user rights of 'wwwrun'. On Debian-based systems this is 'www-data'. You would use the command otrs.SetPermissions.pl /opt/otrs --otrs-user=otrs --web-user=wwwrun --otrs-group=nogroup --web-group=www to set the proper access rights.
OTRS requires some additional Perl modules, as described in Table 3-1. If you install OTRS from source, you will need to install these modules manually. This can be done either with the package manager of your Linux distribution (yast, apt-get) or, as described in this section, through the Perl shell and CPAN. If you're using ActiveState Perl, for instance on Windows, you could use PPM, the built-in Perl Package Manager. We recommend using your package manager if possible.
You can verify which modules you need to install with otrs.CheckModules.pl.
This script is located in the bin
directory, in the home directory of the 'otrs' user (see Script below).
Please note that some modules are optional.
linux:~# cd /opt/otrs/bin/ linux:/opt/otrs/bin# ./otrs.CheckModules.pl o CGI..............................ok (v3.60) o Crypt::PasswdMD5.................ok (v1.3) o Crypt::SSLeay....................Not installed! (Optional - Required for Generic Interface SOAP SSL connections.) o CSS::Minifier....................ok (v0.01) o Date::Format.....................ok (v2.22) o Date::Pcalc......................ok (v1.2) ...
Script: Checking needed modules.
You should strive to install the missing modules from your Linux distribution's package management system. By doing so, the packages will be automatically updated when new versions are available or when security issues are found. Please refer to your distribution's documentation on how to install additional packages. If the (correct version of) the module is not available from the package repositories, you can also install from CPAN, the Comprehensive Perl Archive Network.
To install one of the modules from above via CPAN, you have to execute the command perl -e shell -MCPAN. The Perl shell will be started in interactive mode and the CPAN module will be loaded. If CPAN is already configured, you can install the modules with the command install followed by the name of the module. CPAN takes care of the dependencies of a module to other Perl modules and will let you know if other modules are needed.
Execute also the commands
perl -cw bin/cgi-bin/index.pl
perl -cw bin/cgi-bin/customer.pl
and perl -cw bin/otrs.PostMaster.pl
after changing into the directory /opt/otrs
.
If the output of both commands is "syntax OK", your Perl is properly set up (see Script below).
linux:~# cd /opt/otrs linux:/opt/otrs# perl -cw bin/cgi-bin/index.pl cgi-bin/installer.pl syntax OK linux:/opt/otrs# perl -cw bin/cgi-bin/customer.pl cgi-bin/customer.pl syntax OK linux:/opt/otrs# perl -cw bin/otrs.PostMaster.pl bin/otrs.PostMaster.pl syntax OK linux:/opt/otrs#
Script: Syntax check.
First of all, you should install the Apache2 web server and mod_perl; you'd typically do this from your systems package manager. Below you'll find the commands needed to set up Apache on the most popular Linux distributions.
# rhel / centos: linux:# yum install httpd mod_perl # suse: linux:# zypper install apache2-mod_perl # debian/ubuntu: linux:# apt-get install apache2 libapache-mod-perl2
To access the web interface of OTRS via a short URL, Alias and ScriptAlias entries are needed. Most
Apache installations have a conf.d
directory included. On Linux systems you can usually find this directory under /etc/apache
or /etc/apache2
. Log in as root, change to the conf.d
directory and copy the appropriate template in /opt/otrs/scripts/apache2-httpd.include.conf
to a file called otrs.conf
in the Apache configuration directory.
Restart your web server to load the new configuration settings. On most systems you can start/restart your web server with the command /etc/init.d/apache2 restart (see Script below).
linux:/etc/apache2/conf.d# /etc/init.d/apache2 restart Forcing reload of web server: Apache2. linux:/etc/apache2/conf.d#
Script: Restarting the web server.
Now your web server should be configured for OTRS.
The recommended way to configure the database is to run the Web Installer. If you can't use this for some reason, you can also configure the database manually, as described in this chapter.
If you can't use the web installer to setup the OTRS database, you have to set it up manually. Scripts with the SQL statements to create and configure the database are located in scripts/database
, in the home directory of the 'otrs' user (see Script below).
linux:~# cd /opt/otrs/scripts/database/ linux:/opt/otrs/scripts/database# ls otrs-initial_insert.db2.sql otrs-schema.mysql.sql otrs-schema.oracle.sql otrs-initial_insert.mssql.sql otrs-schema-post.db2.sql otrs-initial_insert.mysql.sql otrs-schema.postgresql.sql otrs-initial_insert.oracle.sql otrs-initial_insert.postgresql.sql otrs-schema-post.mssql.sql otrs-initial_insert.xml otrs-schema-post.mysql.sql otrs-schema.db2.sql otrs-schema-post.oracle.sql otrs-schema-post.postgresql.sql otrs-schema.mssql.sql otrs-schema.xml linux:/opt/otrs/scripts/database#
Script: Files needed to create and configure the database.
To setup the database for the different database back-ends, the .sql files must be processed in a specific order.
Create the OTRS database manually step by step
Creating the DB: Create the database that you want to use for OTRS, with your database client or your database interface.
Creating the tables: With the otrs-schema.DatabaseType.sql files (e.g. otrs-schema.oracle.sql
,
otrs-schema.postgresql.sql
) you can create the tables in your OTRS database.
Inserting the initial system data: OTRS needs some initial system data to work properly (e.g. the different ticket states, ticket and notification types). Depending on the type of database that you are using, you will need to use one of the following files:
otrs-initial_insert.mysql.sql
,
otrs-initial_insert.oracle.sql
,
otrs-initial_insert.postgresql.sql
or
otrs-initial_insert.mssql.sql
.
Creating references between tables: The last step is to create the references between the different tables in the OTRS database. Use the otrs-schema-post.DatabaseType.sql file to create these (e.g. otrs-schema-oracle.post.sql
,
otrs-schema-post.postgresql.sql
).
After you have finished the database setup, you should check and set proper access rights for the OTRS database. It should be enough to grant access to one user. Depending on the database server you are using, setting up the access rights differs, but it should be possible either with your database client or your graphical database front-end.
If your database and the access rights are configured properly, you have to tell OTRS which database back-end you want to use and how the ticket system can connect to the database. Open the file Kernel/Config.pm
located in the home directory of the 'otrs' user, and change the parameters shown in the script below according to your needs.
# DatabaseHost # (The database host.) $Self->{'DatabaseHost'} = 'localhost'; # Database # (The database name.) $Self->{Database} = 'otrs'; # DatabaseUser # (The database user.) $Self->{DatabaseUser} = 'otrs'; # DatabasePw # (The password of database user.) $Self->{DatabasePw} = 'some-pass';
Script: Parameters to be customized.
OTRS needs some cron jobs to work properly. The cron jobs should be run with the same user rights that were specified for the OTRS modules. That means that the cron jobs must be inserted into the crontab file of the 'otrs' user.
All scripts with the cron jobs are located in var/cron
, in the home directory of the 'otrs' user (see Script below).
linux:~# cd /opt/otrs/var/cron linux:/opt/otrs/var/cron# ls aaa_base.dist generic_agent.dist rebuild_ticket_index.dist cache.dist pending_jobs.dist session.dist fetchmail.dist postmaster.dist unlock.dist generic_agent-database.dist postmaster_mailbox.dist linux:/opt/otrs/var/cron#
Script: Files needed to create the cron jobs.
These scripts have a suffix of '.dist'. You should copy them to files with the suffix removed. If you use bash, you might want to use the command listed in Script below.
linux:/opt/otrs/var/cron# for foo in *.dist; do cp $foo `basename $foo .dist`; done linux:/opt/otrs/var/cron# ls aaa_base generic_agent-database.dist rebuild_ticket_index aaa_base.dist generic_agent.dist rebuild_ticket_index.dist cache pending_jobs session cache.dist pending_jobs.dist session.dist fetchmail postmaster unlock fetchmail.dist postmaster.dist unlock.dist generic_agent postmaster_mailbox generic_agent-database postmaster_mailbox.dist linux:/opt/otrs/var/cron#
Script: Copying and renaming all the files needed to create the cron jobs.
Table 3-2 describes the different cron jobs.
Table 2.1. Description of several cron job scripts.
Script | Function |
---|---|
aaa_base | Sets the basics for the crontab of the 'otrs' user. |
cache | Removes expired cache entries from disk. Clears the loader cache for CSS and JavaScript files. |
fetchmail | Used only if new mails will be fetched with fetchmail into the ticket system. |
generic_agent | Executes the jobs of the GenericAgent that are not stored in the database but in own config files. |
generic_agent-database | Executes the jobs of the GenericAgent that are stored in the database. |
pending_jobs | Checks system for pending tickets, and closes them or sends reminders if needed. |
postmaster | Checks the message queue of the ticket system, and delivers messages that are still in the queues. |
postmaster_mailbox | Fetches the mails from the POP3 accounts that were specified in the admin area, in the section for "PostMaster Mail Accounts". |
rebuild_ticket_index | Rebuilds the ticket index, which improves the speed of the QueueView. |
session | Removes old and no longer needed session IDs. |
unlock | Unlocks tickets in the system. |
To setup all cron jobs, the script bin/Cron.sh
located in the home directory of the 'otrs' user can be used. When this script is executed, it needs a parameter to specify whether you want to install, remove, or reinstall the cron jobs. The following parameters can be used:
Cron.sh
{
start
} {
stop
} {
restart
} [
OTRS user
]
Because the cron jobs need to be installed in the crontab file of the 'otrs' user, you need to be logged in as 'otrs'. If you are logged in as root, you can switch to 'otrs' with the command su otrs. Execute the commands specified in Script below to install the cron jobs.
Please note that other crontab entries of the 'otrs' user will be overwritten or removed by the Cron.sh
script. Please change the Cron.sh
script to retain other crontab entries as needed.
linux:/opt/otrs/var/cron# cd /opt/otrs/bin/ linux:/opt/otrs/bin# su otrs linux:~/bin$ ./Cron.sh start /opt/otrs/bin Cron.sh - start/stop OTRS cronjobs Copyright (C) 2001-2009 OTRS AG, http://otrs.org/ (using /opt/otrs) done linux:~/bin$ exit exit linux:/opt/otrs/bin#
Script: Installing the cron jobs.
The command crontab -l -u otrs, which can be executed as root, shows you the crontab file of the 'otrs' user, and you can check if all entries are placed correctly (see Script below).
linux:/opt/otrs/bin# crontab -l -u otrs # -- # cron/aaa_base - base crontab package # Copyright (C) 2001-2014 OTRS AG, http://otrs.com/ # -- # This software comes with ABSOLUTELY NO WARRANTY. # -- # Who gets the cron emails? MAILTO="root@localhost" # -- # cron/cache - delete expired cache # Copyright (C) 2001-2014 OTRS AG, http://otrs.com/ # This software comes with ABSOLUTELY NO WARRANTY. # -- # delete expired cache weekly (Sunday mornings) 20 0 * * 0 $HOME/bin/otrs.CacheDelete.pl --expired >> /dev/null 30 0 * * 0 $HOME/bin/otrs.LoaderCache.pl -o delete >> /dev/null # -- # cron/fetchmail - fetchmail cron of the OTRS # Copyright (C) 2001-2014 OTRS AG, http://otrs.com/ # -- # This software comes with ABSOLUTELY NO WARRANTY. # -- # fetch every 5 minutes emails via fetchmail #*/5 * * * * /usr/bin/fetchmail -a >> /dev/null # -- # cron/generic_agent - otrs.GenericAgent.pl cron of the OTRS # Copyright (C) 2001-2014 OTRS AG, http://otrs.com/ # -- # -- # This software comes with ABSOLUTELY NO WARRANTY. # -- # start generic agent every 20 minutes */20 * * * * $HOME/bin/GenericAgent.pl >> /dev/null # example to execute GenericAgent.pl on 23:00 with # Kernel::Config::GenericAgentMove job file #0 23 * * * $HOME/bin/otrs.GenericAgent.pl -c "Kernel::Config::GenericAgentMove" >> /dev/null # -- # cron/generic_agent - GenericAgent.pl cron of the OTRS # Copyright (C) 2001-2014 OTRS AG, http://otrs.com/ # -- # This software comes with ABSOLUTELY NO WARRANTY. # -- # start generic agent every 10 minutes */10 * * * * $HOME/bin/otrs.GenericAgent.pl -c db >> /dev/null # -- # cron/pending_jobs - pending_jobs cron of the OTRS # Copyright (C) 2001-2014 OTRS AG, http://otrs.com/ # -- # This software comes with ABSOLUTELY NO WARRANTY. # -- # check every 120 min the pending jobs 45 */2 * * * $HOME/bin/otrs.PendingJobs.pl >> /dev/null # -- # cron/postmaster - postmaster cron of the OTRS # Copyright (C) 2001-2014 OTRS AG, http://otrs.com/ # -- # This software comes with ABSOLUTELY NO WARRANTY. # -- # check daily the spool directory of OTRS 10 0 * * * $HOME/bin/otrs.ReprocessMails.pl >> /dev/null # -- # cron/postmaster_mailbox - postmaster_mailbox cron of the OTRS # Copyright (C) 2001-2014 OTRS AG, http://otrs.com/ # -- # This software comes with ABSOLUTELY NO WARRANTY. # -- # fetch emails every 10 minutes */10 * * * * $HOME/bin/otrs.PostMasterMailbox.pl >> /dev/null # -- # cron/rebuild_ticket_index - rebuild ticket index for OTRS # Copyright (C) 2001-2014 OTRS AG, http://otrs.com/ # -- # This software comes with ABSOLUTELY NO WARRANTY. # -- # just every day 01 01 * * * $HOME/bin/otrs.RebuildTicketIndex.pl >> /dev/null # -- # cron/session - delete old session ids of the OTRS # Copyright (C) 2001-2014 OTRS AG, http://otrs.com/ # -- # This software comes with ABSOLUTELY NO WARRANTY. # -- # delete every 120 minutes old/idle session ids 55 */2 * * * $HOME/bin/otrs.DeleteSessionIDs.pl --expired >> /dev/null # -- # cron/unlock - unlock old locked ticket of the OTRS # Copyright (C) 2001-2014 OTRS AG, http://otrs.com/ # -- # This software comes with ABSOLUTELY NO WARRANTY. # -- # unlock every hour old locked tickets 35 * * * * $HOME/bin/otrs.UnlockTickets.pl --timeout >> /dev/null linux:/opt/otrs/bin#
Script: Crontab file.
OTRS comes with a scheduler service that is used to perform asynchronous tasks.
The OTRS RPMs will set up the Scheduler Service automatically.
If you install from source, you can install the service by copying the
scripts/otrs-scheduler-linux
file to /etc/init.d
and giving it the appropriate permissions.
This will make sure the scheduler service starts when the system starts up.