Book:OTRS 3.0 - Admin Manual/Chapter 3/2

Preparing the installation from source
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.org/downloads/.

Unpack the archive for example with tar into the directory /opt and rename the directory from otrs-3.0 to otrs (see Script 3.4 below).

OTRS should NOT be run with root rights. You should add a new user for OTRS as the next step. 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 have to add the new 'otrs' user to the group of the web server user (see Script 3.5 below).

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 3.6 below).

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:



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.

Installation of Perl modules
OTRS needs some additional Perl modules, as described in Table 3-1. If you install OTRS from source, you will have 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 3.7 below).

Please note that some modules are optional.

You should strive to install the missing modules from your Linux distribution's package management system. In that way, 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 two commands perl -cw bin/cgi-bin/index.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 3.8 below).

Configuring the Apache web server
This section describes the basic configuration of the Apache web server with mod_cgi for OTRS. The web server should be able to execute CGI scripts. OTRS won't work if the Perl scripts cannot be parsed. Check the configuration files of your web server, and search for the line that loads the CGI module. If you see something like the following, the CGI module should already be in use.

LoadModule cgi_module /usr/lib/apache2/modules/mod_cgi.so

To access the web interface of OTRS conveniently via a short address, Alias and ScriptAlias entries are needed. Most Apache installations have a conf.d directory included. On Linux systems you can find this directory very often under  or. Log in as root, change to the  directory and copy the appropriate template in   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 3.11 below).

Now your web server should be configured for OTRS.

If you choose to increase performance and you can install mod_perl, then you can leave mod_cgi off, and configure the Apache web server for use with mod_perl, in the following manner:

Please ensure that mod_perl is installed and loaded, in order to take advantage of this feature. Due to the nature of the start-up script, your server will not fail to start if mod_perl is not properly loaded or compiled in your apache web server, unless mod_cgi is also on. Technically speaking you can leave mod_cgi on as well, but you should not.

Search your /etc/apache* directory for mod_perl.so (see Script 3.12 below) to see if the module is already loaded.

When you use the appropriate start script listed above and the module is loaded, the script (when commented in) /opt/otrs/scripts/apache2-perl-startup.pl can be used to load the perl modules into memory one time, saving on load times and increasing performance.

The simple way - Using the web installer (works only with MySQL)
If you use MySQL as the database back-end, you can use the OTRS web installer:

http://localhost/otrs/installer.pl

When the web installer starts, please follow the next steps to setup your system:

  Check out the information about the OTRS offices and click on next to continue (see Figure 3.1 below).



 Read the GNU Affero General Public License (see Figure 3.2 below) and accept it, by clicking the corresponding button at the bottom of the page.



 Provide the username and password of the administrator, the DNS name of the computer which hosts OTRS and the type of database system to be used. After that, check the settings (see Figure 3.3 below).

If the checking was successful, you will get a notification. Press OK to continue (see Figure 3.4 below).



 Create a new database user, choose a name for the database and click on next (see Figure 3.5 below).

If the database and its user were successfully created, you will get a setup notification, as shown in the Figure 3.6. Click next to go to the next screen.



 Provide all the required system settings and click next (see Figure 3.7 below).

</li>

 If you want, you can provide the needed data to configure your inbound and outbound mail or skip this step by pressing the right button at the bottom of the screen (see Figure 3.8 below).

</li>

 Restart the OTRS service now, to use the new configuration settings shown in the Script 3.13.

</li>

 Congratulations! Now the installation of OTRS is finished and you should be able to work with the system (see Figure 3.9 below). To log into the web interface of OTRS, use the address http://localhost/otrs/index.pl in your web browser. Log in as OTRS administrator, using the username root@localhost and the password root. After that you can configure the system for your needs.

</li> </ol>

Installing the OTRS database manually
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 3.14 below).

To setup the database for the different database back-ends the .sql files must be processed in a special order.

 Create the OTRS database manually step by step 
 * 1) Creating the DB: Create the database, that you want to use for OTRS, with your database client or your database interface.
 * 2) 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.
 * 3) 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 your database Use one of the files otrs-initial_insert.mysql.sql, otrs-initial_insert.db2.sql, otrs-initial_insert.oracle.sql, otrs-initial_insert.postgresql.sql or otrs-initial_insert.mssql.sql.
 * 4) 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 3.15 to your needs.

Setting up the cron jobs for OTRS
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 3.16 below).

All scripts are ending in .dist. You should copy them to files with no ending. If you are using bash, you might want to use the command listed in Script 3.17 below.

Table 3-2 describes the different cron jobs and what they do.

To setup all cron jobs the script bin/Cron.sh can be used, which is located in the home directory of the OTRS user. When this script is executed, it needs a parameter to tell if you want to install, remove or reinstall the cron jobs. The following parameters can be used:

Because the cron jobs need to be installed in the crontab file of the OTRS user, you need to be logged in as OTRS user. If you are logged in as root, you can change to the OTRS user with the command su otrs. Execute the commands specified in the Script 3.18 below to install 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 right (see Script 3.19 below).