First, you need root access. If you don't have it, just stop. You need to make system modifications and unless you have root you won't be able. I used a subdomain off my primary account - you aren't supposed to change the DocumentRoot of your hosted account with cpanel but you can alter the subdomain DocumentRoot.
I had kind of hoped to remove the /otrs/ on the URL once I got things working for a cleaner URL, however I got stuck at one point. Some of these steps are borrowed from this post which details how to remove the /otrs/. I played with them when I got stuck to see if I could get rid of some errors and wanting to document exactly what I did so maybe someone else can follow, I have left these modifications in.
Here are the steps:
- Grab the latest copy (source) and unpack as the README describes, renaming the unpacked directory so it is located at /opt/otrs. OTRS hardcodes a lot of paths to /opt/otrs. Now that I have it working I might play with moving it out of /opt/otrs. However, start with /opt/otrs (I learned this the hard way).
- Do not create user account. You will run this with your host account permissions (not root). I could create the account fine in WHM/cpanel, but I couldn't get it to exec even with proper permissions. I had errors in my suexec logs when I tried and the cpanel config files referenced my useraccount in too many places.
- Setup a subdomain
- Create the Config.pm and GenericAgent.pm files as the documentation describes.
- Run the otrs.SetPermissions.pl script as described, but swap out the OTRS user account name and group with your cpanel account name and group (my cpanel username is in a group with the same name). You will need to find your webserver user and group (mine was nobody:nobody).
- We must change the subdomain's DocumentRoot. Edit the file in /var/cpanel/userdata/(username)/subdomain.domain.com that corresponds to your username and the subdomain you are setting up. Change documentroot: to match /opt/otrs/bin/cgi-bin/
- It may be possible to change the user and group information to use an OTRS user in the last step, but I didn't want to break my primary domain somehow so I didn't.
- We need to setup the aliases necessary for apache. Edit /var/local/apache/conf/httpd.conf and look for the section for your subdomain. The last lines details the include files cpanel looks for in its default setup. In my case it's /usr/local/apache/conf/userdata/std/2/(username)/subdomain.domain.com/*.conf
- Back to the terminal, mkdir -p /usr/local/apache/userdata/std/2/(username)/subdomain.domain.com (this is not created by default, you must create it according to the cpanel docs).
- Copy the /opt/otrs/scripts/apache2-httpd.include.conf file to /usr/local/apache/userdata/std/2/(username)/subdomain.domain.com
- Borrowing from the other howto, I tried to edit the copied apache2-httpd.include.conf file to match the given example. However, I couldn't get /scripts/verify_vhost_includes to give an "ok" on the modified config file. I commented out lines one by one and found the perl lines caused issues in my setup. My final apache2-httpd.include.conf file is posted at the end in code. The /scripts/verify_vhost_includes MUST pass, if it fails this will not work.
- Edit /opt/otrs/var/httpd/htdocs/index.html and modify the second meta line so that the URL references /index.pl (since we are now using the subdomain itself and not /otrs)
- Run /scripts/rebuildhttpdconf to rebuild your httpd.conf file with the new subdomain DocumentRoot.
- Run service httpd restart to bounce your web server to pick up the new httpd.conf file.
- You should be up... if you are lucky
Code: Select all
Alias /otrs-web/ "/opt/otrs/var/httpd/htdocs/"
Alias / "/opt/otrs/bin/cgi-bin/"
<IfModule mod_perl.c>
Perlrequire /opt/otrs/scripts/apache2-perl-startup.pl
PerlModule Apache2::Reload
PerlInitHandler Apache2::Reload
PerlModule Apache2::RequestRec
</IfModule>
<Directory "/opt/otrs/bin/cgi-bin/">
AllowOverride None
Options +ExecCGI -Includes
Order allow,deny
Allow from all
ErrorDocument 403 /index.pl
DirectoryIndex index.pl
</Directory>
<Directory "/opt/otrs/var/httpd/htdocs/">
AllowOverride None
Order allow,deny
Allow from all
</Directory>
<IfModule mod_headers.c>
<Directory "/opt/otrs/var/httpd/htdocs/skins/*/*/css-cache">
<FilesMatch "\.(css|CSS)$">
Header set Cache-Control "max-age=2592000 must-revalidate"
</FilesMatch>
</Directory>
<Directory "/opt/otrs/var/httpd/htdocs/js/js-cache">
<FilesMatch "\.(js|JS)$">
Header set Cache-Control "max-age=2592000 must-revalidate"
</FilesMatch>
</Directory>
</IfModule>
As I said, it may be possible to run under an OTRS user by changing the username for the subdomain.
It may be possible to move out of /opt/otrs and back into your user folder (I would ideally like mine in /home/username - out of public_html but associated with the user). Doing this requires modifying all references to /opt/otrs and setting them accordingly. Particularly settings in /opt/otrs/Kernel/Config.pm, /opt/otrs/Kernel/Config/Defaults.pm but I'm sure there may be more.
Update: I posted the above prior to setting up the database I attempted to use the installer.pl script to get up and running. To setup the database I used my cpanel user account as the "root" user for mysql and created a mysql user for ORS (username_otrs) in cpanel. While this would create a user, OTRS could not grant access to my user (and it didn't detect if it already had access before the script ran). What I found, however, was by getting this far it populated all the database information for me. I completed the install by modifying the Default.pm and Config.pm files by hand at this point and then logging in with root@localhost/root.
And finally, I was able to move out of /opt/otrs. To do this, I had to do a search and replace across the entire /opt/otrs directory to modify /opt/otrs to /home/username/otrs. If you cd to your OTRS directory, this command can do the replace:
Code: Select all
find ./ -type f | xargs sed -i 's/\/opt\/otrs/\/home\/username\/otrs/'