How to migrate OTRS / Znuny from centOS to Ubuntu

In this article you will find all steps how to migrate OTRS/Znuny from centOS to Ubuntu. Since the package maintenance of OTRS/Znuny of the debian package is not very good (experience from Ubunut 6.06 LTS up to 16.04 LTS), here you will find the description how to use the tar.gz package of OTRS/Znuny with mariaDB.

From centOS to Ubuntu 20.04

First we need to prepare Ubuntu 20.04 for the installation of OTRS/Znuny tar.gz/tar.bz2 package.

install a fresh Ubuntu 20.04

install database mariadb-server

sudo apt update
sudo apt install -y mariadb-server libdbd-mariadb-perl

Secure mariaDB

sudo mysql_secure_installation

probably you have no password set if you follow these instructions

Enter current password for root (enter for none):

press enter

Set root password? [Y/n]

press y

Remove anonymous users? [Y/n]

press y

Disallow root login remotely? [Y/n]

press y

Remove test database and access to it? [Y/n]

press y

Reload privilege tables now? [Y/n]

press y

Prepare database for OTRS / Znuny

run

sudo tee /etc/mysql/mariadb.conf.d/otrs.cnf<<EOF
[mysqld]
max_allowed_packet=64M
query_cache_size=36M
innodb_log_file_size=256M
EOF

sudo systemctl restart mariadb

Create the database otrs

mysql -u root -p

now execute this command

CREATE DATABASE otrs CHARACTER SET utf8 COLLATE utf8_general_ci;
GRANT ALL PRIVILEGES ON otrs.* TO otrs@localhost IDENTIFIED BY 'Str0ngOTRSDBP@ssw0rd';
FLUSH PRIVILEGES;
QUIT

now install apache and perl prerequisits

sudo apt install -y wget apache2 apache2-bin apache2-data apache2-utils aspell aspell-en dbconfig-common \
  dictionaries-common emacsen-common fontconfig-config fonts-dejavu-core fonts-dejavu-extra \
  fonts-font-awesome libalgorithm-c3-perl libapache-dbi-perl libapache2-mod-perl2 \
  libapache2-reload-perl libappconfig-perl libaprutil1-dbd-sqlite3 libaprutil1-ldap \
  libarchive-zip-perl libaspell15 libb-hooks-endofscope-perl libbit-vector-perl libbsd-resource-perl \
  libcarp-clan-perl libcgi-fast-perl libcgi-pm-perl libclass-accessor-lite-perl libclass-c3-perl \
  libclass-c3-xs-perl libclass-data-inheritable-perl libclass-inspector-perl \
  libclass-method-modifiers-perl libclass-mix-perl libclass-singleton-perl libclass-xsaccessor-perl \
  libcommon-sense-perl libconvert-asn1-perl libconvert-binhex-perl libcpan-audit-perl \
  libcpan-distnameinfo-perl libcrypt-eksblowfish-perl libcrypt-passwdmd5-perl libcss-minifier-perl \
  libdata-optlist-perl libdate-pcalc-perl libdatetime-locale-perl libdatetime-perl \
  libdatetime-timezone-perl libdevel-caller-perl libdevel-lexalias-perl libdevel-stacktrace-perl \
  libdevel-symdump-perl libemail-valid-perl libencode-hanextra-perl libencode-perl \
  libeval-closure-perl libexcel-writer-xlsx-perl libexception-class-perl libfcgi-perl \
  libfile-sharedir-perl libfont-ttf-perl libfontconfig1 libgd-graph-perl libgd-perl libgd-text-perl \
  libgd3 libgssapi-perl libhtml-truncate-perl libio-interactive-perl libio-socket-inet6-perl \
  libio-string-perl libio-stringy-perl libjavascript-minifier-perl libjbig0 libjpeg-turbo8 libjpeg8 \
  libjson-perl libjson-xs-perl liblingua-translit-perl liblinux-distribution-perl liblua5.2-0 \
  libmail-pop3client-perl libmime-tools-perl libmodule-cpanfile-perl libmodule-refresh-perl \
  libmro-compat-perl libnamespace-autoclean-perl libnamespace-clean-perl libnet-imap-simple-perl \
  libnet-imap-simple-ssl-perl libnet-ldap-perl libnet-smtp-tls-butmaintained-perl \
  libnet-sslglue-perl libpackage-stash-perl libpackage-stash-xs-perl libpadwalker-perl \
  libparams-util-perl libparams-validationcompiler-perl libpdf-api2-perl libpod-strip-perl \
  libproc-daemon-perl libproc-processtable-perl libref-util-perl libref-util-xs-perl \
  librole-tiny-perl libschedule-cron-events-perl libset-crontab-perl libsisimai-perl libspecio-perl \
  libsub-exporter-perl libsub-exporter-progressive-perl libsub-identify-perl libsub-install-perl \
  libsub-quote-perl libtemplate-perl libtext-csv-perl libtext-csv-xs-perl libtext-diff-perl libtiff5 \
  libtypes-serialiser-perl libvariable-magic-perl libwebp6 libxml-feedpp-perl \
  libxml-libxml-simple-perl libxml-libxslt-perl libxml-parser-lite-perl libxml-treepp-perl libxpm4 \
  libxstring-perl libyaml-libyaml-perl libyaml-perl procmail ttf-dejavu-core ttf-dejavu-extra \
  libdatetime-perl libcrypt-eksblowfish-perl libcrypt-ssleay-perl libgd-graph-perl libapache-dbi-perl \
  libsoap-lite-perl libarchive-zip-perl libgd-text-perl libnet-dns-perl libpdf-api2-perl \
  libauthen-ntlm-perl libdbd-odbc-perl libjson-xs-perl libyaml-libyaml-perl libxml-libxml-perl \
  libencode-hanextra-perl libxml-libxslt-perl libpdf-api2-simple-perl libmail-imapclient-perl \
  libtemplate-perl libtext-csv-xs-perl libdbd-pg-perl libapache2-mod-perl2 libtemplate-perl \
  libnet-dns-perl libnet-ldap-perl libio-socket-ssl-perl libmoo-perl

Enable perl module

sudo a2enmod perl
sudo systemctl restart apache2

check if apache module perl is installed

sudo apachectl -M | grep perl

should report

AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1. Set the 'ServerName' directive globally to suppress this message
perl_module (shared)

Prepare user for OTRS / Znuny

sudo useradd -d /opt/otrs -c 'OTRS user' otrs
sudo usermod -aG www-data otrs

check

sudo id otrs

should return

uid=1001(otrs) gid=1001(otrs) groups=1001(otrs),33(www-data)

Install same version of OTRS / Znuny as on your centOS

Now we install first the same version or OTRS / Znuny, which is installed on your centOS.
In this example it will show how to do the migration with a preinstalled OTRS 5.0.42 on centOS. But it is equivalent to any Znuny versions too.

sudo su -
cd
wget https://download.znuny.org/releases/otrs-5.0.42.tar.gz
cd /opt/
tar zxf /root/otrs-5.0.42.tar.gz

Symlink the version to otrs

ln -s /opt/otrs-5.0.42 /opt/otrs

Check installed perl packages

sudo /opt/otrs/bin/otrs.CheckModules.pl

shall result into

o Apache::DBI………………….ok (v1.12)
o Apache2::Reload………………ok (v0.13)
o Archive::Tar…………………ok (v2.32)
o Archive::Zip…………………ok (v1.67)
o Crypt::Eksblowfish::Bcrypt…….ok (v0.009)
o Crypt::SSLeay………………..ok (v0.73_06)
o Date::Format…………………ok (v2.24)
o DBI…………………………ok (v1.643)
o DBD::mysql…………………..ok (v4.050)
o DBD::ODBC……………………ok (v1.61)
o DBD::Oracle………………….Not installed! (optional - Required to connect to a Oracle database.)
o DBD::Pg……………………..ok (v3.10.4)
o Digest::SHA………………….ok (v6.02)
o Encode::HanExtra……………..ok (v0.23)
o IO::Socket::SSL………………ok (v2.067)
o JSON::XS…………………….ok (v4.02)
o List::Util::XS……………….ok (v1.50)
o LWP::UserAgent……………….ok (v6.13)
o Mail::IMAPClient……………..ok (v3.42)
o IO::Socket::SSL…………….ok (v2.067)
o Authen::SASL……………….ok (v2.16)
o Authen::NTLM……………….ok (v1.09)
o ModPerl::Util………………..ok (v2.000011)
o Net::DNS…………………….ok (v1.22)
o Net::LDAP……………………ok (v0.66)
o Template…………………….ok (v2.27)
o Template::Stash::XS…………..ok (undef)
o Text::CSV_XS…………………ok (v1.41)
o Time::HiRes………………….ok (v1.9760)
o Time::Piece………………….ok (v1.33)
o XML::LibXML………………….ok (v2.0134)
o XML::LibXSLT…………………ok (v1.99)
o XML::Parser………………….ok (v2.46)
o YAML::XS…………………….ok (v0.81)

Create default configuration for your database

sudo cp /opt/otrs/Kernel/Config.pm.dist /opt/otrs/Kernel/Config.pm
sudo vim /opt/otrs/Kernel/Config.pm

modify the database password

$Self->{DatabasePw} = 'Str0ngOTRSDBP@ssw0rd';

enable the perl module on mariaDB

sudo vim /opt/otrs/scripts/apache2-perl-startup.pl

uncomment these lines to enable mariaDB

# enable this if you use mysql
use DBD::mysql ();
use Kernel::System::DB::mysql;

Set the permissions

sudo /opt/otrs/bin/otrs.SetPermissions.pl --web-group=www-data
ls -l /opt

Configure vhost for apache

sudo ln -s /opt/otrs/scripts/apache2-httpd.include.conf /etc/apache2/sites-enabled/otrs.conf

Test syntax and configs

sudo perl -cw /opt/otrs/bin/cgi-bin/index.pl

should return

/opt/otrs/bin/cgi-bin/index.pl syntax OK

Test syntax and configs

sudo perl -cw /opt/otrs/bin/cgi-bin/customer.pl

should return

/opt/otrs/bin/cgi-bin/customer.pl syntax OK

one more

sudo perl -cw /opt/otrs/bin/otrs.Console.pl

should return

/opt/otrs/bin/otrs.Console.pl syntax OK

restart apache2

sudo systemctl restart apache2

show your IP

sudo ifconfig

Please note your IP address

puhh we have the first bigger part now

Install Znuny / OTRS via web interface

This step is required to test if a “clean” Znuny / OTRS installation will work

open in browser the above IP address

http://<yourIP>/otrs/installer.pl

Accept the license

select the mySQL
use existing database
configure

user: otrs
password: Str0ngOTRSDBP@ssw0rd
host: 127.0.0.1
database name: otrs

login to OTRS / Znuny

If you can login and navigate in OTRS/Znuny, we can move on with the migration of the previous installation by

creating a mysqldump of the centOS database

creating a backup of your configuration files

Do you need help with Znuny / OTRS?
We have lot of experiences with OTRS and Znuny and can help you with your issues. Get in touch with us and we will check if and how we can help you.

Leave a Comment

Do you need help with Znuny / OTRS?​

We have lot of experiences with OTRS and Znuny.
We can help you with your issues to solve them.

From giving you support up to implementing integrations to your existing systems.

Get in touch with us and we will check if and how we can help you.​