Tuesday 27 September 2016

OTRS Upgrade Notes



First things first, we need to download the latest and that’s usually from the public FTP site on OTRS’ site. Here is a good place to start: https://www.otrs.com/download-open-source-help-desk-software-otrs-free/ I always grab the source .tar.gz file and usually with this command:

# wget -c http://ftp.otrs.org/pub/otrs/otrs-5.0.13.tar.gz (for the latest one anyway – which at time of writing I 5.0.13)

The upgrade direction is here: http://otrs.github.io/doc/manual/admin/5.0/en/html/upgrading.html and I want this to be my summarized version of this for ease of use both for myself and for you, gentle reader.

I have a script that starts off the upgrade process with some of the basic stuff (note – run this as root):


#!/bin/bash
service cron stop
service apache2 stop
service postfix stop
NOW=`date +%F`
mkdir /root/backup/$NOW
BDIR=/root/backup/$NOW
cp -R /opt/otrs/Kernel/Config.pm $BDIR
cp -R /opt/otrs/Kernel/Config/GenericAgent.pm $BDIR
cp -R /opt/otrs/Kernel/Config/Files/ZZZAuto.pm $BDIR
cp -R /opt/otrs/var/ $BDIR
/opt/otrs/scripts/backup.pl -d $BDIR


Now what this does is to stop the services in Step 1 of the upgrade documentation.
Then we set the “date” variable and create a backup folder for it and instantiate a variable to make the script shorter – the “BDIR” variable.
Now I simply step through the guide and backup what I need to in Step 2 and then run a full backup into the backup directory with the backup.pl -d $BDIR command.
Now it’s time for the command line work to begin. I typically download the source file into an OTRS folder in my root home directory (yes I do this all as root) so I will run:

# tar -zxf otrs-5.0.13.tar.gz

Once the tarball is extracted I copy the resultant directory to the /opt/ folder:

# cp -R otrs-5.0.13 /opt/

In the directory are all the other OTRS installs I’ve done but haven’t cleaned up. An ls of the /opt/ directory usually looks like this:

root@otrs:/opt# ls
otrs        otrs-4.0.11  otrs-5.0.1   otrs-5.0.13
otrs-4.0.1  otrs-4.0.7   otrs-5.0.10  otrs-5.0.5
root@otrs:/opt#


The bolded otrs is a logical link. I delete that:

# rm otrs

And create a new one:

# ln -s /opt/otrs-5.0.13 otrs

We need to copy stuff back now and I have a bit of a script that will do it:

#!/bin/bash
BDIR=/root/backup/`date +%F`
cp -R $BDIR/Config.pm /opt/otrs/Kernel/
cp -R $BDIR/ZZZAuto.pm /opt/otrs/Kernel/Config/Files/


It copies back the files we need to and moves us through Step 4.
Now to set permissions on the new OTRS directory:

# /opt/otrs/bin/otrs.SetPermissions.pl –web-group=www-data (for Ubuntu)

And this sorts out the permissions. I also find it very useful to change the ownership of files at a more macro level too, so I will also run:

# chown -R otrs:www-data /opt/otrs*
# chmod -R g+w /opt/otrs*

This has solved some issues in the past and seems like a handy thing to do.
Step 4 is finished and Step 5 has us checking Perl modules out:

# /opt/otrs/bin/otrs.CheckModules.pl

We can skip to Step 7 now and we have to change to the OTRS user:

# su otrs

As OTRS, Step 7 gets us to refresh the config cache and then delete the other caches:

$ /opt/otrs/bin/otrs.Console.pl Maint::Config::Rebuild
$ /opt/otrs/bin/otrs.Console.pl Maint::Cache::Delete

Annoyingly we have to change back to root and restart services. I just CTRL-D out of otrs and then run:

# services apache2 start
# services cron start
# services postfix start

And then su back to OTRS

# su otrs
$

Step 12 – restart the OTRS Daemon (as otrs – don’t forget!)

$ /opt/otrs/bin/otrs.Daemon.pl start

And then Step 13 which updates cron for the OTRS user:

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

And that’s it for the command line stuff.

Log into the website and go to Admin and then Package Manager. I usually find that at least three packages need to be either re-installed or updated. While these are not right, the website will run terribly slowly. Fixing the problem here will give you back some performance and set it on the right track.

That’s pretty much it. Done!

Playing with Proxmox

 Up until recently I've used Hyper-V for most of my virtualisation needs. Hyper-V is a fully integrated Type 1 hypervisor and comes with...