OTRS migration to another server; what to look out for

Written by - 5 comments

Published on - Listed in OTRS Linux Unix Shell


I recently had to migrate an OTRS installation to another server. It's basically not that difficult as the files don't change and all data is stored in the database. However some migration steps should not be forgotten. This guide should serve as a reminder, in case I'll have to do another migration in the future.

The previous server will be called OLDSERVER, the destination server NEWSERVER in the following guide.
OTRS has its database on a MySQL server running on localhost.

1. Stopping OTRS on OLDSERVER
To not risk that during the transfer new tickets arrive or that an agent works on a ticket, OTRS should be stopped on OLDSERVER.
You can do this by stopping the cron service and Apache (or by simply disable the virtual host used for OTRS):

/etc/init.d/cron stop; /etc/init.d/apache2 stop

2. Create backup + transfer data on OLDSERVER
You should now have a consistent state of your OTRS installation on OLDSERVER so you can do a proper backup.
First the OTRS database needs to be dumped, then transferred to NEWSERVER:

mysqldump otrs > /tmp/otrs.sql; scp /tmp/otrs.sql root@NEWSERVER:/tmp/

Note that some OTRS databases can be huge, so it might make sense to zip/gzip/bzip the dump before the transfer.

Then the complete folder /opt/otrs (or wherever you have your OTRS installation installed) can be transferred to the new server.
I chose to pack the whole /opt/otrs into a tar.gz file to keep the file permissions and ownerships and then copy this file with scp:

tar -czf /tmp/otrs.tar.gz  /opt/otrs; scp /tmp/otrs.tar.gz root@NEWSERVER:/tmp/

3. Prepare stuff on NEWSERVER
OTRS needs to run under its own system user, so this one needs to be created on NEWSERVER:

useradd -r -d /opt/otrs -c 'OTRS user' -u 1001 otrs

Make sure you use the same UID as used on OLDSERVER, if possible.

The new database (and database user) also needs to be created on NEWSERVER:

mysql> create database otrs;
mysql> grant all on otrs.* to 'otrs'@'localhost' identified by 'somePass';

In case you don't remember the password, you can look it up on OLDSERVER in /opt/otrs/Kernel/Config.pm.

Furthermore I'd stop the cron service on NEWSERVER as well:

/etc/init.d/cron stop

4. Import data on NEWSERVER
Let's start with the files. We can now unpack the tar.gz file into /opt:

tar -xzf /tmp/otrs.tar.gz -C /opt/

Verify the file ownerships. If they don't seem OK (e.g. a "ls -l /opt/otrs" doesn't show the user otrs), you should run /opt/otrs/bin/otrs.SetPermissions.pl. 

Then import the database:

mysql otrs < /tmp/otrs.sql

5. Don't forget the cronjobs!
This is most likely the step which could be forgotten the easiest. There are of course still the cron jobs on OLDSERVER, which need to run on NEWSERVER.
On OLDSERVER show the crontab of user otrs:

crontab -l -u otrs

Copy the whole output and on NEWSERVER insert it into the crontab:

crontab -e -u otrs

6. Complete the migration
Change DNS records to point to the new IP address, or inform your colleagues about the new domain/URL for OTRS.
It is recommended to do a quick testing on a secondary domain if OTRS works as it should. Only if the tests were successful, the "real" domain should then be changed or pointed to the migrated OTRS installation.

Once the tests were completed, you can start the cron service on NEWSERVER. This will start fetching the mails and create tickets again:

/etc/init.d/cron start


Add a comment

Show form to leave a comment

Comments (newest first)

Florian from Switzerland wrote on Jan 4th, 2016:

Thanks for the tutorial
Do not forget to copy the apache 'script' to enable the new OTRS to be reachable. In my case I copied:
/etc/apache2/sites-available/otrs.conf
and I add to add the corresponding symbolic link into
/etc/apache2/sites-enabled :
sudo ln -s ../sites-available/otrs.conf otrs.conf
apache restart:
sudo apache2ctl -k restart
Regards,


Umbymagik from italy wrote on Apr 23rd, 2015:

great guide!!
tnk


ck from Switzerland wrote on Mar 2nd, 2015:

Hi Rohanil, Maybe you forgot to make the server alias to /otrs in the Apache config? Or you could use a real VirtualHost entry without having to use the /otrs alias path.


Rohanil Raje from Japan wrote on Mar 2nd, 2015:

I could not able to access the otrs on new server.
It says 404 error: "The requested URL /otrs/index.pl was not found on this server."
There is no problem with apache. I followed all your steps.
Both servers are running CentOS.


Davide from Italy wrote on Aug 8th, 2014:

Very useful article.
Applied and worked perfectly.

Thank you


RSS feed

Blog Tags:

  AWS   Android   Ansible   Apache   Apple   Atlassian   BSD   Backup   Bash   Bluecoat   CMS   Chef   Cloud   Coding   Consul   Containers   CouchDB   DB   DNS   Database   Databases   Docker   ELK   Elasticsearch   Filebeat   FreeBSD   Galera   Git   GlusterFS   Grafana   Graphics   HAProxy   HTML   Hacks   Hardware   Icinga   Icingaweb   Icingaweb2   Influx   Internet   Java   KVM   Kibana   Kodi   Kubernetes   LVM   LXC   Linux   Logstash   Mac   Macintosh   Mail   MariaDB   Minio   MongoDB   Monitoring   Multimedia   MySQL   NFS   Nagios   Network   Nginx   OSSEC   OTRS   Office   PGSQL   PHP   Perl   Personal   PostgreSQL   Postgres   PowerDNS   Proxmox   Proxy   Python   Rancher   Rant   Redis   Roundcube   SSL   Samba   Seafile   Security   Shell   SmartOS   Solaris   Surveillance   Systemd   TLS   Tomcat   Ubuntu   Unix   VMWare   VMware   Varnish   Virtualization   Windows   Wireless   Wordpress   Wyse   ZFS   Zoneminder   


Update cookies preferences