Installing Request Tracker 4 on Debian (2/2)

Continued from Part 1/2

Previously we covered installing Debian and configuring some basics. This time we dig into installing Request Tracker 4 and making it work.

Install Required Packages

Edit your APT sources file:

sudo nano /etc/apt/sources.list

Add the lines below and save:

# wheezy-backports
deb http://ftp.debian.org/debian/ wheezy-backports main

Update your available packages, install Request Tracker 4, Apache 2, PostGreSQL and lynx:

sudo aptitude update
sudo aptitude -t wheezy-backports install request-tracker4 \
 rt4-apache2 rt4-clients rt4-db-postgresql apache2-doc lynx \
 postgresql apache2 libapache-dbi-perl fetchmail

You now need to configure some basic RT settings:

  • Name for this RT Instance ($rtname) – example.com (pick something unique to your organization like your domain name)
  • Handle RT_SiteConfig.pm Permissions – Yes
  • More stuff installs.. (time for more coffee)
  • Configure database for request-tracker4 with dbconfig-common – Yes
  • Set the PostgreSQL application password for request-tracker4
  • Initial root password for RT system
  • More stuff installs..

Email Configuration

You can choose any MTA you want but I have decided to keep the Debian default of Exim4.

Please note that your email setup may be different and require additional configuration. For example if you use Google Apps you will need to configure authentication and SSL. I have added a couple of links at the end of this page with further information.

To reconfigure Exim:

sudo dpkg-reconfigure exim4-config

Configure Exim4 to work in your environment:

  • Select: mail sent by smarthost; received by SMTP or fetchmail
  • System mail name: example.com
  • IP-addresses to listen on for incoming SMTP connections: leave at default
  • Other destinations for which mail is accepted: leave at default
  • Machines to relay mail for: leave blank
  • IP address or hostname of the outgoing smarthost: smtp.isp.com
  • Hide local mail name in outgoing mail?: Yes
  • Visible domain name for local users: example.com
  • Keep number of DNS-queries minimal (Dial-on-Demand): No
  • Delivery method for local mail: mbox format in /var/mail (default)
  • Split configuration into small files: No

Test outbound mail by emailing a file to yourself (edit to suit):

mailx -s "Exim4 email Test" you@example.com < /etc/fstab

Check your e-mail to see if this is working. If the email doesn’t come through in a few minutes you might want to check the Exim4 configuration.

Basic RT Configuration

Edit the RT config file

sudo nano /etc/request-tracker4/RT_SiteConfig.pm

Find and edit the following lines from:

Set($CorrespondAddress , 'rt@svr011.example.com');
Set($CommentAddress , 'rt-comment@svr011.example.com');

to

Set($CorrespondAddress , 'rt@example.com');
Set($CommentAddress , 'rt-comment@example.com');

Also paste the following lines to the end of the file, then save and exit:

Set($MaxAttachmentSize , 10000000);
Set($FriendlyFromLineFormat, "\"%s\" <%s>");

Apache2 Configuration

Edit the apache2 default available sites:

sudo nano /etc/apache2/sites-available/default

Find the end of the file “</VirtualHost>” and add the following line just above it:

Include /etc/request-tracker4/apache2-modperl2.conf
RedirectMatch ^/$ /rt

Save the file and exit.

To enable mod_rewrite run the command:

sudo a2enmod rewrite

And then restart apache2:

sudo service apache2 restart

RT Web Configuration

You should now be able to see the RT Web Login Screen (http://rt.example.com/rt/) and be able to login with the username “root” and the password configured during installation (note. this is the root user for RT not your system).RT4 Login Screen

From the home screen browse to Tools -> Configuration -> Queues -> Select. RT4 Queues

Under name click on the General queue as shown below.RT4 List Queues

You can now edit the configuration for the queue. Change the Description as this will appear as the senders name in emails from the queue.

Important: If you change the Queue Name, you need to modify the fetchmailrc (see below).
RT4 Configure Queues

When you are happy with the queue settings click on Group Rights (top right-hand corner):

RT4 Group Rights

As below make sure Everyone is selected before ticking the boxes next to:

  • Comment on tickets
  • Create tickets
  • Reply to tickets

and then click Save Changes.

RT4 Modify Group Rights

fetchmail Configuration

Enable the fetchmail daemon to start:

sudo nano /etc/default/fetchmail

Modify the last line and save:

START_DAEMON=yes

Create a new fetchmailrc config file and edit it:

sudo nano /etc/fetchmailrc

Paste the following lines into fetchmailrc and edit to suit:

set daemon 60
set invisible
set no bouncemail
set syslog

poll pop3.example.com protocol pop3 
 username "rt@example.com" password "password"
 mda "/usr/bin/rt-mailgate --queue general --action correspond --url http://localhost/rt/"
 no keep
;

poll pop3.example.com protocol pop3
 username "rt-comment@example.com" password "password"
 mda "/usr/bin/rt-mailgate --queue general --action comment --url http://localhost/rt/"
 no keep
;

Important: If you changed the Queue Name during RT Web Configuration, you need to modify the queue name in fetchmailrc  or incoming email will not work.

Restart the RT host and while you are waiting send an email to RT (eg  rt@example.com) from your email account.

Once the server is back fetchmail should retrieve the email within 60 seconds & forward it to RT. You will then get an email reply and the newly created ticket should appear in the web interface.

crontab Configuration

There are a few jobs which you will want to run regularly. The easiest way is to add these to cron:

sudo crontab -e

Add the following lines then save and exit:

0 0 * * * /usr/sbin/rt-email-digest -m daily
0 0 * * 0 /usr/sbin/rt-email-digest -m weekly
0 * * * * /usr/sbin/rt-email-dashboards

What Now?

Request Tracker should now be running and tickets can be received. You should create a group for your IT team with increased permissions to the queue, and add your team members to it. I also strongly recommend establishing a regular backup schedule for at least the RT database.

Over the next few months I will try to add more RT howto’s including adding queues,  integrating with an AD domain, and enabling fast full-text searching.

Request Tracker Links

http://bestpractical.com/rt/
http://requesttracker.wikia.com/wiki/HomePage
http://blog.bestpractical.com/
http://bestpractical.com/rt/lists.html
http://www.bestpractical.com/rt/docs/4.0/backups.html

Additional links

http://requesttracker.wikia.com/wiki/WithEmailFacility
http://www.hollenback.net/index.php/RequestTrackerOnCentos5
http://wiki.debian.org/Manual-Howto
http://pkg-exim4.alioth.debian.org/README/README.Debian.html
http://wiki.debian.org/GmailAndExim4

17 thoughts on “Installing Request Tracker 4 on Debian (2/2)

  1. mike

    I did like this but i got stuck in email configuration …i tested the email it’s nt sending ..is there any issue with that ..??
    can u help me ????

    Reply
  2. admin Post author

    Hi Mike, I can try to help, or at least point you in the right direction. Did you get any error messages, either onscreen or in the logs (should be in /var/log/exim4/)? Are you connecting to an ISP SMTP server, or one inside your organization? Does it require authentication before sending? Are there restrictions on which machines can send email via SMTP?

    Reply
  3. Theresa

    These instruction are great, thanks. I am having just one problem which is with the final stage, I am sending an email to rt but although it is reaching the rt mailbox it is not actually creating a ticket. I think it might be the mail configurations but am unsure, the test email from exim works. Any help would be appreicated. Thanks

    Reply
    1. admin Post author

      Hi Theresa, the problem is probably in your fetchmail config. Fetchmail retrieves incoming email from your main mail server for RT. Find out more about your mail server (some require TLS/SSL, IMAP, or something else which may require extra config) and double check your .fetchmailrc file. Try using telnet to connect from your RT box to your mail server:
      telnet pop3.example.com 110
      user rt@example.com
      pass reallygoodpassword

      If you can’t connect at all you may have a firewall problem, or the mail server doesn’t support POP3 on port 110. Let me know how you get on, if you are still stuck we can discuss over email.

      Reply
      1. Theresa

        Hi, I am still having problems with the mail setup, I can now create tickets in RT which will send an email back to whoever created it, I cannot however email rt and get a ticket created. Also do you have any help on getting ldap to work? Thanks.

        Reply
  4. admin Post author

    Hi Theresa, how did you get on checking your .fetchmailrc file and testing connectivity using Telnet (as above)? Look through the fetchmail logs (tail /var/log/mail.log will show the most recent mail logs) and see if there are any errors. Also keep in mind Fetchmail only runs every 60 seconds so there may be a minor delay.

    Reply
    1. Theresa

      Hi, the telnet wasn’t working when I first tried it out, but after a a few alterations it all worked, I have checked the log file it has a warning about connection being insecure and says 1 message for rt, it just seems that the email isnt actually getting to create a ticket, could i be missing something else. thanks Theresa

      Reply
  5. admin Post author

    That sounds like you are almost there.

    Double check the Queue Name in RT, if you have changed it from ‘General’ to something else you will need to update the two lines in fetchmailrc with --queue general to suit (if you use spaces in the queue name use ‘ ‘ quotes around it).

    Also check that --url http://localhost/rt/ on the same line points to your RT URL (you will need the trailing / and don’t use HTTPS yet). Try using Lynx to connect to the URL on your server. For example: lynx http://localhost/rt/

    Let me know how you get on, and if you are still having problems we can sort it out over email.

    Reply
    1. Theresa

      Hi, thanks for your help, queue name is still General, the http address is correct, but when using lynx i am gettting unable to connect to remote host. I do have some warnings in the apache error log, about not matching the configured web domain and incomplete redirection. I could send these via email if easier. Thanks again Theresa

      Reply
  6. admin Post author

    Hi Theresa, a quick fix for the immediate problem is changing the url in fetchmailrc to refer to the localhost instead of the hosts DNS name. For example use --url http://localhost/rt/ instead of http://rt.example.com/rt/.

    This should allow you to get emails into Request Tracker. Once you have verified that emails are going into RT you can work through any other issues.

    Check that your DNS server(s) have entries for the RT host, and that the RT host is using the correct DNS server(s). After that test to make sure you can ping the DNS name (eg ping rt.example.com) both from your workstation and the RT host itself. If ping can’t resolve the address there are probably still problems with DNS.

    After that work through any problems that show up in the Apache logs. There is plenty of information on the web; the official Apache HTTP Server docs are a good place to start.

    Good luck, and let me know how you get on.

    Reply
  7. Mathew

    Hey am stuck in setting up the crontool……..pleas help. i need it such that ic can automatically escalate tickets to higher management if not solve within a given time

    Reply
    1. Ben Post author

      Hi Mathew, there are a number of ways to do this. Have a look through the Wiki for escalation, there are quite a few examples. The RT-Users mailing list is also a good resource.

      Reply
  8. james

    Where did these lines magically appear from?:
    0 0 * * * /usr/sbin/rt-email-digest -m daily
    0 0 * * 0 /usr/sbin/rt-email-digest -m weekly
    0 * * * * /usr/sbin/rt-email-dashboards

    whats inside those cron files?

    Reply
  9. Sorin

    Hi,
    I installed request tracker 4.2.8 with sqlite database. Now I want to use mysql.
    Please let me know if the following steps are correct:
    1) set the following in /etc/request-tracker4/RT_SiteConfig.pm
    Set($DatabaseType, ‘mysql’);
    Set($DatabaseHost, ‘localhost’);
    Set($DatabasePort, ‘3306’);
    Set($DatabaseUser , ‘rtuser’);
    Set($DatabasePassword , ‘reallysecurepassword1’);
    Set($DatabaseName, ‘rt4’);

    2) run:
    /usr/sbin/rt-setup-database –action init

    Reply
  10. vchrizz

    Hi,

    thanks for this howto.
    Using Debian 8 I’ve worked it out from part two on and noticed a missing command “a2enmod perl”, else apache2 does not start because of apache2-modperl2.conf in vhost conf.

    Cheers

    Reply

Leave a Reply

Your email address will not be published. Required fields are marked *