Installation on Win2008 with Microsoft SQL Server and IIS 7

From OtterHub - OTRS Community Wiki
Jump to: navigation, search

This document has been copied from [1] and is enhanced with some Windows 2008 Stuff and especially with the configuration of IIS 7

This tutorial will guide you through installing OTRS 3.0. on a Microsoft Windows 2008 SP2 (32bit) server with Microsoft IIS 7.0 as the web server and Microsoft SQL Server as the application database. This page does not discuss how to set up Microsoft IIS or Microsoft SQL server. Also, we'll assume you have SQL Server set to allow for 'mixed mode authentication'.

If you would find any omissions in this tutorial, or would like to enhance it, please do. If you're not sure if your additions are appropriate, please use the discussion page for his article.

Preparation of the database

Database server configuration

Make sure the database accepts connections over TCP/IP. To verify this, start SQL Server Configuration Manager, select SQL Server Network Configuration, Protocols for MSSQLSERVER and verify that TCP/IP is set to Enabled.

Database creation

Open SQL Server Management Studio. Connect to your database server. Right-click on Databases and select New Database...

Error creating thumbnail: Unable to save thumbnail to destination

Create a new database named OTRS - it might be good to specify a start size here that is reasonable; otherwise the database file will be spread out on the disk. Click OK.

Error creating thumbnail: Unable to save thumbnail to destination

Select File > Open and select the file otrs\scripts\database\otrs-schema.mssql.sql. Make sure you have selected the 'OTRS' database in the database dropdown. Click "Execute".

(please note that you'll see two warning messages; these are just warnings and not harmful. See bug 4126 for more details.)

Repeat this process with the files otrs\scripts\database\otrs-initial_insert.mssql.sql and otrs\scripts\database\otrs-schema-post.mssql.sql, in that order.

Error creating thumbnail: Unable to save thumbnail to destination

User creation

Still in SQL Server Management Studio, right-click Security and select New > Login. Create a new database account for OTRS to use. Provide a name, select SQL Server Authentication. Provide a password and note it down, you'll need it later. Remove the check box for Enforce password policy - you don't want the OTRS password to expire. Set the OTRS database as the default database for the user.

Error creating thumbnail: Unable to save thumbnail to destination

Select User Mapping on the left-hand side, select the OTRS database and the db_owner role. This makes the new account have owner permissions on the new database. Click OK, the user will be created.

Error creating thumbnail: Unable to save thumbnail to destination

Installation of Perl

Installation of ActivePerl

There are two major Perl distributions to choose from; Strawberry Perl and ActiveState Perl. The two distributions are both very good and comparable. Strawberry Perl is re-distributable, which is the reason why it is the Perl of choice in the OTRS Windows installer.

In this document we choose ActiveState perl 5.12.x; for the reason that it has a proprietary extension called PerlEx which provides CGI acceleration for Microsoft Internet Information Server, in much the same way as mod_perl does that for an Apache web server. Because this extension is proprietary, it's not in Strawberry Perl. Unfortunately the nice people at ActiveState Corp. have as of 2011 still no 64-bit variant of PerlEx; so if you would like to use PerlEx please make sure to install a 32-bit perl. You can also install a 32-bit perl on a 64-bit Windows, if you need to.

Please install at least the components Perl, ISAPI, PPM and PerlEx.

Error creating thumbnail: Unable to save thumbnail to destination

Add Perl to the PATH environment; the rest of the options are not needed, but you can use them if you want to. For the rest, you can accept the default options.

Error creating thumbnail: Unable to save thumbnail to destination

Install additional modules

You'll need to add some additional modules to make OTRS work. Some are optional, some are required.

Open a cmd window and cd to the OTRS directory. Run perl bin\otrs.CheckModules.pl to see which modules are missing.

You can install them typing the following command in a cmd.exe window:

ppm install My::Module

if you can't find the module you need on the ActiveState PPM repository you can install them from CPAN:

cpan My::Module

Note that you can't install all modules from CPAN without issues; for instance if you would require DBD::mysql when connecting to a remote database the cpan will require that you also have the libraries and header files for MySQL available on your system. In this case it's much easier to install the module using PPM.

If you would have chosen StrawberryPerl a little more modules would have been installed by default; here we could really not use StrawberryPerl because we want PerlEx.

Installation of OTRS

Download the zip file of OTRS from the OTRS.org download site. Extract the zip in c:\otrs.

Copy c:\otrs\Kernel\Config.pm.dist to c:\otrs\Kernel\Config.pm and open the file in a text editor, such as Wordpad.

Add the values for DatabaseHost, Database, DatabaseUser and DatabasePw. Just above fs root directory, add the following lines:

$Self->{'DatabaseDSN'} = "DBI:ODBC:driver={SQL Server};Server=$Self->{DatabaseHost},1433;database=$Self->{Database}";
$Self->{'Database::Type'} = 'mssql'; 

Set the fs root directory to c:/otrs

# ---------------------------------------------------- #
# fs root directory
# ---------------------------------------------------- #
$Self->{Home} = 'c:/otrs';

Set the logmodule to file, add these setting after insert your own config:

$Self->{'LogModule'} = 'Kernel::System::Log::File';
$Self->{'LogModule::LogFile'} = "$Self->{Home}/var/log/otrs.log";

If you have done this, you can run the checkmodules script and it should return "Ok":

c:\otrs>perl bin\otrs.CheckDB.pl
Trying to connect to database
DSN: DBI:ODBC:driver={SQL Server};Server=localhost,1433;database=otrs
DatabaseUser: otrs

It looks Ok!

Configuration of Microsoft IIS

First of all, add the Windows Role Web Server to the Role. Go the the Server Manager and choose Add Roles

Then add the following Role Services to the server:

Error creating thumbnail: Unable to save thumbnail to destination

The ASP.NET Role Service has been added to allow other Applications to be run on the server

Error creating thumbnail: Unable to save thumbnail to destination
Error creating thumbnail: Unable to save thumbnail to destination

For the next step, you need to activate Perl in IIS 7. Follow the instructions on this article: [2]. This step enables Perl in IIS 7 on the Server itself.

Now Create an Application Pool on IIS 7 for OTRS. If OTRS is the only Application on the Server, you can also proceed with IIS 7 defaults and skip the step below.

Open the IIS Manager (inetmgr) and create the Application Pool

Error creating thumbnail: Unable to save thumbnail to destination

The result should look like this:

Error creating thumbnail: Unable to save thumbnail to destination

After that, add the OTRS Website to IIS:

Error creating thumbnail: Unable to save thumbnail to destination

Then create the otrs Application (in defaults.pm, the root of the application is fqdn/otrs):

Error creating thumbnail: Unable to save thumbnail to destination

And create the htdocs page as virtual directory otrs-web (also configured in defaults.pm)

Error creating thumbnail: Unable to save thumbnail to destination

With these settings, you should now be able to run the website properly. As there is no redirection, enter the URL of the server followed by /otrs/index.pl and you should see the login box.

Configuration of cron jobs

OTRS uses several cron jobs to send out notifications, take care of reminders and do general housekeeping like deleting expired cache entries and such. There are several methods to do this; one would be to use Windows' Scheduled Tasks or similar; in this document we'll use CRONw, a Perl based Cron implementation on Windows.

Download the software from the CRONw website and expand it to a folder on your server; for instance c:\cronw.

You schedule jobs in CRON using a file that lists the entries that need to be scheduled; this is called a crontab. You can create a crontab for OTRS by configuring and running otrs/bin/otrs.Cron4Win32.pl. Open it with a text editor and fill in these variables:

my $PerlExe   = "c:/perl/bin/perl.exe";
my $Directory = "c:/otrs/var/cron";
my $CronTab   = "c:/cronw/crontab.txt";
my $OTRSHome  = "c:/otrs";

Now, from a command prompt, run

perl c:\otrs\bin\otrs.Cron4Win32.pl

this will create a file called c:/cronw/crontab.txt with the entries for OTRS. The entries are read from c:\otrs\var\cron. Please note that some extension modules, such as for instance the ITSM Change Management module, come with their own cron jobs. If you install the change management module you must make sure that you re-generate the crontab by running otrs.Cron4Win32.pl another time.

For CronW to properly function, you need several additional Perl modules, which you need to install with ppm or with cpan. Install the module Win32::Daemon, Win32::Service, Number::Compare, File::Find::Rule, Date::Manip, Log::Dispatch, Log::Log4perl and Log::Dispatch::FileRotate using your cpan client (i.e. type cpan Win32::Daemon on the command line).

You must now set up the cron service itself; go to the Cron directory and use this command:

c:\cronw> perl cronHelper.pl --install
INFO: using crontab: 'C:\cronw\crontab.txt'
INFO: CRON service was successfully installed.

Now you have a service called CRONw that you can start from the Windows Services menu.