Installation on Ubuntu Lucid Lynx (10.4)

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

Introduction

This article describes the installation of OTRS 3.0.x on Ubuntu Lucid Lynx (version 10.04 LTS). For other versions of Ubuntu, installation would be probably similar. We'd recommend installing on an LTS (Long Term Support) version of Ubuntu, because it would give you a longer period of available security updates. The current available LTS version is 10.04, the next version will be 12.04, to be released around April 2012. For more information about Ubuntu releases, see here: Release information on Ubuntu Wiki.

For instructions for OTRS 2.4.x please check out Installation of OTRS 2.4.x instead. If you feel this article can be better, please edit it!

Installation

We'll install OTRS in the directory /opt; all applications we install manually, and NOT via the package manager, should go there.

tar xf otrs-3.0.x.tar.gz
mv otrs-3.0.* /opt/otrs

The next step is to install the necessary Perl modules, the web server and the database.

aptitude install libapache2-mod-perl2 libdbd-mysql-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 mysql-server

Of course you can also run the database on a remote host, or use for instance PostgreSQL as the database. While still pretty straight-forward, it's outside of the scope of this document.

Now you should create a user under which the OTRS cron jobs and such are running. The user should be added to the webserver group, and has /opt/otrs as the home directory.

useradd -r -d /opt/otrs/ -c 'OTRS user' otrs
usermod -g www-data otrs

Now you have to prepare the OTRS configuration file. Copy the file in /opt/otrs/Kernel/Config.pm.dist to Config.pm so you have your own brand new copy, do the same for the file /opt/otrs/Kernel/Config/GenericAgent.pm.dist:

cd /opt/otrs/Kernel
cp Config.pm.dist Config.pm
cp Config/GenericAgent.pm.dist Config/GenericAgent.pm

Now you need to set the permissions so both the web server user and the OTRS user have permissions on the directory. For this you can use the supplied script:

cd /opt/otrs
bin/otrs.SetPermissions.pl --otrs-user=otrs --otrs-group=otrs --web-user=www-data --web-group=www-data /opt/otrs

Web server configuration

OTRS has a bundled default configuration file for Apache. You should add this to the Apache configuration directory, and then restart the server in order to get going:

cp /opt/otrs/scripts/apache2-httpd.include.conf /etc/apache2/conf.d/otrs.conf 
service apache2 restart

Advanced: Running apache as the OTRS user

You'd only want to do this if apache is not serving other applications, i.e. if you have a 'dedicated' system for OTRS. It eases administration because you don't have to worry about two 'owners' for the files in OTRS.

Modify this file: /etc/apache2/envvars

Comment out these lines by adding a # in front of it.

export APACHE_RUN_USER=www-data
export APACHE_RUN_GROUP=www-data

and add these two lines:

export APACHE_RUN_USER=otrs
export APACHE_RUN_GROUP=otrs

now restart Apache.

Web installer

Go to http://127.0.0.1/otrs/installer.pl with your web browser. In case you don't have installed a web browser on your Ubuntu server (which would be quite common) you can also access the web installer from your local workstation. In that case simply replace 127.0.0.1 with the address of your Ubuntu server in the URL. In the web installer you can create the database to be used for OTRS (use the MySQL root password you set earlier), as well as do some other basic configuration. After this, you can log in to OTRS with the default account root@localhost and password root.

Now you have created the database, edit the file /opt/otrs/scripts/apache2-perl-startup.pl - we need that in order to configure Apache::DBI. Apache::DBI is not a module that is really needed for OTRS but it will pre-establish database connections, which will be better for performance. Therefore it' s recommended to set it up. Besides that, it's really easy to set up, so why not..?

Just simply remove the pound signs (#) before the lines for Apache::DBI and fill in the password you just created for the OTRS database using the web installer. If you forgot what it was, please just look up the value for $Self->{'DatabasePw'} in the file /opt/otrs/Kernel/Config.pm.

use Apache::DBI ();
Apache::DBI->connect_on_init('DBI:mysql:otrs', 'otrs', 'my-secret-pass');
use DBI ();

OTRS cron jobs

OTRS uses several cron jobs for time-based actions, such as escalating tickets, sending out reminders, fetching emails from POP and IMAP boxes, and so on. You'll have to prepare these cronjobs so they are run by the OTRS user.

cd /opt/otrs/var/cron
for foo in *.dist; do cp $foo `basename $foo .dist`; done

This command replace and create the crons of OTRS.

Now we have to add them to the otrs user's crontab:

cd /opt/otrs
bin/Cron.sh start otrs

Now the cron jobs are scheduled and will be executed on pre-defined intervals.

You can check with the command crontab -l -u otrs if the entries for the OTRS user are set up correctly.

After this, you can log in to OTRS via http://yourserver.example.com/otrs/index.pl with the default account root@localhost and password root. Now, you can log in to OTRS, create users, configure incoming and outgoing email, and the like. As they say... ((enjoy))!