Wednesday, May 16, 2012

Installing OTRS on a 64-bit CentOS 6.2 using PostgreSQL as database

OTRS is the leading open-source Help Desk and IT Service Management (ITSM) solution used by thousands of organizations worldwide, enabling transparency and collaboration for service desk and customer support teams, including those implementing ITIL Best Practices. OTRS Group offers consulting, support, customization and hosting services.

OTRS is compatible with a number of RDBMS that includes MySQL, PostgreSQL, Oracle, Ingres, DB2, and MSSQL.

I'll be installing OTRS on a 64-bit CentOS 6.2 using PostgreSQL as database in my VirtualBox machine.

First, download the OTRS rpm, I'll be using version 3.1 beta which can be downloaded using wget.

# wget http://ftp.otrs.org/pub/otrs/RPMS/fedora/4/otrs-3.1.0.beta2-02.noarch.rpm

Next is to determine the dependencies required for OTRS to work.

# rpm -qpR otrs-3.1.0.beta2-02.noarch.rpm
perl
perl(DBI)
perl(URI)
mod_perl
httpd
procmail
perl(Date::Format)
perl(LWP::UserAgent)
perl(Net::DNS)
perl(IO::Socket::SSL)
perl(XML::Parser)
/bin/sh
/bin/sh
rpmlib(PayloadFilesHavePrefix) <= 4.0-1
rpmlib(CompressedFileNames) <= 3.0.4-1
rpmlib(PayloadIsBzip2) <= 3.0.5-1
Obviously, we need to install the aforementioned required packages for OTRS to work. Use yum to determine the exact Perl package name, e.g.

# yum provides "perl(Date::Format)"

Loaded plugins: fastestmirror, security
Loading mirror speeds from cached hostfile
 * base: centos.mirror.aussiehq.net.au
 * extras: mirror.aarnet.edu.au
 * updates: centos.mirror.aussiehq.net.au
1:perl-TimeDate-1.16-11.1.el6.noarch : A Perl module for time and date
                                     : manipulation
Repo        : base
Matched from:
Other       : perl(Date::Format)
Do above for the rest of the Perl packages, install them once done.

# yum install procmail perl-TimeDate perl-libwww-perl perl-Net-DNS perl-IO-Socket-SSL perl-XML-Parser

Install the OTRS package.

# rpm -ivh otrs-3.1.0.beta2-02.noarch.rpm
Preparing...                ########################################### [100%]
Check OTRS user ... otrs added.
   1:otrs                   ########################################### [100%]
hostname: Unknown host


Next steps:


[httpd services]
 Restart httpd 'service httpd restart'


[install the OTRS database]
 Make sure your database server is running.
 Use a web browser and open this link:
 http:///otrs/installer.pl


[OTRS services]
 Start OTRS 'service otrs start' (service otrs {start|stop|status|restart).


((enjoy))


 Your OTRS Team
The output message is a bit misleading, we still have to set up PostgreSQL before accessing OTRS.
Initialize PostgreSQL.
# service postgresql initdb
Initializing database:                                     [  OK  ]
Start PostgreSQL.
service postgresql start
Starting postgresql service:                               [  OK  ]
Login as postgres user, and create the otrs user.
postgres=# CREATE USER otrs PASSWORD 'otrs' LOGIN NOSUPERUSER;
CREATE ROLE
postgres=# CREATE DATABASE otrs owner otrs;
CREATE DATABASE
Create tables and insert initial data.
# cd /opt/otrs/scripts/database
Enter the 'otrs' user password when prompted.
# psql -U otrs -W -f otrs-schema.postgresql.sql otrs
# psql -U otrs -W -f otrs-initial_insert.postgresql.sql otrs
# psql -U otrs -W -f otrs-schema-post.postgresql.sql otrs
It's now time to configure OTRS connection parameters to PostgreSQL, comment the default MySQL parameter and uncomment PostgreSQL's, as well as insert the otrs user password used earlier.
# vim /opt/otrs/Kernel/Config.pm

    # DatabasePw
    # (The password of database user. You also can use bin/otrs.CryptPassword.pl
    # for crypted passwords.)
     $Self->{DatabasePw} = 'otrs';
    # DatabaseDSN
    # (The database DSN for MySQL ==> more: "man DBD::mysql")
    #    $Self->{DatabaseDSN} = "DBI:mysql:database=$Self->{Database};host=$Self->{DatabaseHost};";
    # (The database DSN for PostgreSQL ==> more: "man DBD::Pg")
    # if you want to use a local socket connection
    $Self->{DatabaseDSN} = "DBI:Pg:dbname=$Self->{Database};";
Save file and exit, then start Apache.
# service httpd start
Starting httpd: httpd: apr_sockaddr_info_get() failed for otrs.lan
httpd: Could not reliably determine the server's fully qualified domain name, using 127.0.0.1 for ServerName
                                                           [FAILED]
I had to edit /etc/httpd/conf/httpd.conf file and add the following line:
ServerName otrs.lan
You can use another server name, once done, restart Apache
# service httpd start
I checked httpd's error logs and found the following error:
[Mon Jan 09 13:14:56 2012] [error] Can't load Perl file: /opt/otrs/scripts/apache2-perl-startup.pl for server otrs.lan:0, exiting...
[Mon Jan 09 13:15:23 2012] [error] Can't locate DBD/Pg.pm in @INC (@INC contains: /opt/otrs/Custom /opt/otrs/Kernel/cpan-lib /opt/otrs/ /usr/local/lib64/perl5 /usr/local/share/perl5 /usr/lib64/perl5/vendor_perl /usr/share/perl5/vendor_perl /usr/lib64/perl5 /usr/share/perl5 . /etc/httpd) at /opt/otrs/scripts/apache2-perl-startup.pl line 58.\nBEGIN failed--compilation aborted at /opt/otrs/scripts/apache2-perl-startup.pl line 58.\nCompilation failed in require at (eval 2) line 1.\n
Based on the above logs, it says that perl file named DBD/Pg is missing, to resolve, install missing Perl package.
# yum install perl-DBD-Pg
Restarted Apache again, and tried to access OTRS. If I try to access OTRS without specifying the full URL i.e. http://ip.add.re.ss/otrs instead of http://ip.add.re.ss/otrs/index.pl, Apache spewed this error:
[Mon Jan 09 13:17:31 2012] [error] slurp_filename('/var/www/html/otrs') / opening: (2) No such file or directory at /usr/lib64/perl5/ModPerl/RegistryCooker.pm line 541
I tried to Google the above mentioned error but to no avail.
BTW, I can login using the username 'root@localhost' and password 'root', and as suggested by OTRS don't use the root user, instead create a new user to administer OTRS.
See login page and root dashboard screenshot below.
I would appreciate any suggestion on how to resolve the last error shown.
That's all there is to it.
Cheers!

No comments:

Post a Comment