{"id":149,"date":"2011-04-22T09:37:13","date_gmt":"2011-04-22T14:37:13","guid":{"rendered":"http:\/\/soljerome.com\/blog\/?p=149"},"modified":"2012-03-16T14:04:19","modified_gmt":"2012-03-16T19:04:19","slug":"installing-request-tracker-on-ubuntu-with-nginx","status":"publish","type":"post","link":"https:\/\/www.soljerome.com\/blog\/2011\/04\/22\/installing-request-tracker-on-ubuntu-with-nginx\/","title":{"rendered":"Installing Request Tracker on Ubuntu with nginx"},"content":{"rendered":"<p>I recently spent quite a bit of time installing and configuring request tracker to run on Ubuntu 10.04 using nginx as the web server. The documentation on doing this was scarce (or incorrect), so I thought this would be a good place to centralize all the information needed to replicate my setup.<\/p>\n<p>The first thing to do is install all the required packages. I assume you already know how to do this. For what it&#8217;s worth, I&#8217;m using a PPA repository for the nginx package since the one available in Ubuntu is extremely out of date. Here are the contents of <code>\/etc\/apt\/sources.list.d\/nginx.list<\/code>.<\/p>\n<pre>deb http:\/\/ppa.launchpad.net\/nginx\/stable\/ubuntu lucid main\r\ndeb-src http:\/\/ppa.launchpad.net\/nginx\/stable\/ubuntu lucid main<\/pre>\n<p>I have apt configured such that it doesn&#8217;t install Recommended or Suggested packages. Therefore, I had to manually install the <strong>libcgi-fast-perl<\/strong> package because this will be necessary in order for nginx to run the RT code.<\/p>\n<p>I then had to install the mysql-server package and create the database to be used.<\/p>\n<pre>root@rt:~# mysql -u root -p\r\nEnter password:\r\nWelcome to the MySQL monitor.  Commands end with ; or \\g.\r\nYour MySQL connection id is 584\r\nServer version: 5.1.41-3ubuntu12.10 (Ubuntu)\r\n\r\nType 'help;' or '\\h' for help. Type '\\c' to clear the current input statement.\r\n\r\nmysql&gt; create database rtdb;\r\nQuery OK, 1 row affected (0.00 sec)\r\n\r\nmysql&gt; grant all privileges on rtdb.* to 'rt'@'localhost' identified by 'SECRETPASSWORD';\r\nQuery OK, 0 rows affected (0.03 sec)\r\n\r\nmysql&gt; flush privileges;\r\nQuery OK, 0 rows affected (0.00 sec)<\/pre>\n<p>Next, I had to modify <code>\/etc\/request-tracker3.8\/RT_SiteConfig.d\/50-debconf<\/code> to suit our custom environment. I also had to reconfigure <code>\/etc\/request-tracker3.8\/RT_SiteConfig.d\/51-dbconfig-common<\/code> to use mysql with the appropriate values for the database that was created.<\/p>\n<pre># THE DATABASE:\r\n# generated by dbconfig-common\r\n\r\n# map from dbconfig-common database types to their names as known by RT\r\nmy %typemap = (\r\n    mysql   =&gt; 'mysql',\r\n    pgsql   =&gt; 'Pg',\r\n    sqlite3 =&gt; 'SQLite',\r\n);\r\n\r\nSet($DatabaseType, $typemap{mysql} || \"UNKNOWN\");\r\n\r\nSet($DatabaseHost, 'localhost');\r\nSet($DatabasePort, '3306');\r\n\r\nSet($DatabaseUser , 'rt');\r\nSet($DatabasePassword , 'SECRETPASSWORD');\r\n\r\n# SQLite needs a special case, since $DatabaseName must be a full pathname\r\n#my $dbc_dbname = 'rtdb'; if ( \"sqlite3\" eq \"sqlite3\" ) { Set ($DatabaseName, '\/var\/lib\/dbconfig-common\/sqlite3\/request-tracker3.8' . '\/' . $dbc_dbname); } else { Set ($DatabaseName, $dbc_dbname); }\r\nSet ($DatabaseName, 'rtdb');<\/pre>\n<p>By default, the RT install uses a simple sqlite database. We just switched it to use our mysql database that we created in the previous step. Once that is complete, you need to update the SiteConfig by running <code>update-rt-siteconfig<\/code>. Then you can move on to configuring nginx.<\/p>\n<p>Here is the nginx configuration that was necessary to get all aspects (as far as I&#8217;ve tested) working with RT:<\/p>\n<pre>server {\r\n        listen          [::]:80;\r\n        server_name     rt.siriad.com;\r\n        root            \/usr\/share\/request-tracker3.8\/html;\r\n\r\n        location \/ {\r\n                index           index.html;\r\n                fastcgi_pass    unix:\/var\/run\/rt\/rt.sock;\r\n                include         \/etc\/nginx\/fastcgi_params;\r\n                fastcgi_param   PATH_INFO       $fastcgi_script_name;\r\n        }\r\n\r\n        location ~* .+\\.(html|js|css)$  {\r\n                index           index.html;\r\n                fastcgi_pass    unix:\/var\/run\/rt\/rt.sock;\r\n                include         \/etc\/nginx\/fastcgi_params;\r\n                fastcgi_param   PATH_INFO       $fastcgi_script_name;\r\n        }\r\n\r\n        location \/NoAuth\/images\/ {\r\n                alias \/usr\/share\/request-tracker3.8\/html\/NoAuth\/images\/;\r\n        }\r\n}<\/pre>\n<p>Here is the upstart script located at <code>\/etc\/init\/rt-fcgi.conf<\/code>:<\/p>\n<pre># rt-fcgi - test\r\nstart on runlevel [12345]\r\nstop on runlevel [0]\r\nrespawn\r\n\r\nenv FCGI_SOCKET_PATH=\/var\/run\/rt\/rt.sock\r\n\r\nexec su www-data -c \"\/usr\/share\/request-tracker3.8\/libexec\/mason_handler.fcgi\"<\/pre>\n<p>Once all those are in place, the only thing you need to do is <code>service rt-fcgi start<\/code> and restart nginx. Then you should be able to login using the default RT username\/password.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I recently spent quite a bit of time installing and configuring request tracker to run on Ubuntu 10.04 using nginx as the web server. The documentation on doing this was scarce (or incorrect), so I thought this would be a good place to centralize all the information needed to replicate my setup. The first thing <a href='https:\/\/www.soljerome.com\/blog\/2011\/04\/22\/installing-request-tracker-on-ubuntu-with-nginx\/' class='excerpt-more'>[&#8230;]<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[3,14,15],"tags":[],"_links":{"self":[{"href":"https:\/\/www.soljerome.com\/blog\/wp-json\/wp\/v2\/posts\/149"}],"collection":[{"href":"https:\/\/www.soljerome.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.soljerome.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.soljerome.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.soljerome.com\/blog\/wp-json\/wp\/v2\/comments?post=149"}],"version-history":[{"count":12,"href":"https:\/\/www.soljerome.com\/blog\/wp-json\/wp\/v2\/posts\/149\/revisions"}],"predecessor-version":[{"id":278,"href":"https:\/\/www.soljerome.com\/blog\/wp-json\/wp\/v2\/posts\/149\/revisions\/278"}],"wp:attachment":[{"href":"https:\/\/www.soljerome.com\/blog\/wp-json\/wp\/v2\/media?parent=149"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.soljerome.com\/blog\/wp-json\/wp\/v2\/categories?post=149"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.soljerome.com\/blog\/wp-json\/wp\/v2\/tags?post=149"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}