Update OTRS from v4.x.x+ to v5.x.x+ on centos7

mm ByYOBIHAT TEAM

Update OTRS from v4.x.x+ to v5.x.x+ on centos7

Hi Tech Guys,

Sometimes OTRS need some care to be up-to-date and secure, than here you can find a right and easy way to update OTRS from v4 to v5 (IMPORTANT: only from any v4.x.x to any v5.x.x)

We recommend to test in a clone or test machine before to move and do any edit in a production environment (avoid disaster please).

Requirements:

-Centos 7.3 server with minimal hardware configuration (depends of your needs).

-ROOT permission on server.

-Internet connection to download all needed packages.

-Small IT basic knowledge and a bit of patience…

Let’s Start!

 

Stop all services used by the ticketing system before proceding

systemctl stop crond
systemctl stop postfix
systemctl stop httpd

Move in the main path and stop daemon

cd /opt/otrs
su -c "bin/Cron.sh stop" -s /bin/bash otrs
su -c "bin/otrs.Scheduler.pl -a stop" -s /bin/bash otrs

Backup otrs database and /opt/otrs/ folder, i prefer to keep safe everything on other location than the working server

mysqldump -p otrs > otrsdbbackup.sql
scp root@10.0.0.58:/root/otrsdbbackup.sql /home/user/otrs/.
scp -r root@10.0.0.58:/opt/otrs /home/user/otrs

Rename the old folder because you will need some files of your previous configuration, download the packages of the newer version (in this case the v5.0.21) decompress and rename the folder as the oldest, without the version number

cd /opt/
mv otrs otrs-old
wget ftp://ftp.otrs.org/pub/otrs/otrs-5.0.21.tar.gz
tar -xzf otrs-5.0.21.tar.gz
mv otrs-5.0.21 otrs

Move your olds config and ticket numbers files, from the backup folder to the new

cp /opt/otrs-old/Kernel/Config.pm /opt/otrs/Kernel/
cp /opt/otrs-old/Kernel/Config/GenericAgent.pm /opt/otrs/Kernel/Config/
cp /opt/otrs-old/Kernel/Config/Files/ZZZAuto.pm /opt/otrs/Kernel/Config/Files/
cp /opt/otrs-old/var/log/TicketCounter.log /opt/otrs/var/log/

(Optional) If you store article data in the filesystem you have to restore the article folder, or the specified folder in the SysConfig if is tuned

(Optional) cp -rf  /opt/otrs-old/var/article/ /opt/otrs/var/.

Set the permission for Centos or Red Hat (Webserver with apache user)

cd /opt/otrs
bin/otrs.SetPermissions.pl --web-group=apache

Check if some PERL modules are missing, and install any modules that might be needed for your configuration

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

The output will be something like this:

o Apache::DBI......................ok (v1.12) 
o Apache2::Reload..................ok (v0.13)
o Archive::Tar.....................ok (v1.92)
o Archive::Zip.....................ok (v1.30)
o Crypt::Eksblowfish::Bcrypt.......Not installed! Use: 'yum install "perl(Crypt::Eksblowfish::Bcrypt)"' (optional - For strong password hashing.)
o Crypt::SSLeay....................ok (v0.64)
o Date::Format.....................ok (v2.24)
o DBI..............................ok (v1.627)
o DBD::mysql.......................ok (v4.023
o DBD::ODBC........................Not installed! (optional - Required to connect to a MS-SQL database.)
o DBD::Oracle......................Not installed! (optional - Required to connect to a Oracle database.)
o DBD::Pg..........................Not installed! Use: 'yum install "perl(DBD::Pg)"' (optional - Required to connect to a PostgreSQL database.)
o Digest::SHA......................ok (v5.85)
o Encode::HanExtra.................Not installed! Use: 'yum install "perl(Encode::HanExtra)"' (optional - Required to handle mails with several Chinese character sets.)
o IO::Socket::SSL..................ok (v1.94)
o JSON::XS.........................Not installed! Use: 'yum install "perl(JSON::XS)"' (optional - Recommended for faster AJAX/JavaScript handling.)
o List::Util::XS...................ok (v1.27)
o LWP::UserAgent...................ok (v6.13)
o Mail::IMAPClient.................Not installed! Use: 'yum install "perl(Mail::IMAPClient)"' (optional - Required for IMAP TLS connections.)
o IO::Socket::SSL................ok (v1.94)
o Authen::SASL...................ok (v2.15)
o Authen::NTLM...................Not installed! Use: 'yum install "perl(Authen::NTLM)"' (optional - Required for NTLM authentication mechanism in IMAP connections.)
o ModPerl::Util....................Not installed! Use: 'yum install "perl(ModPerl::Util)"' (optional - Improves Performance on Apache webservers dramatically.)
o Net::DNS.........................ok (v0.72)
o Net::LDAP........................ok (v0.56)
o Template.........................ok (v2.24)
o Template::Stash::XS..............ok (undef)
o Text::CSV_XS.....................Not installed! Use: 'yum install "perl(Text::CSV_XS)"' (optional - Recommended for faster CSV handling.)
o Time::HiRes......................ok (v1.9725)
o Time::Piece......................ok (v1.20_01)
o XML::LibXML......................ok (v2.0018)
o XML::LibXSLT.....................ok (v1.80)
o XML::Parser......................ok (v2.41)
o YAML::XS.........................Not installed! Use: 'yum install "perl(YAML::XS)"' (required - Very important)

As you can see, all checked modules are followed by a comment that will help you in the installation. Not all modules are necessary to you, for example if you have a my-sql DB (DBD::mysql module already install), the “perl(DBD::Pg)” or “perl(DBD::ODBC)” or  “perl(DBD::Oracle)” are not required to OTRS, instead if you have a PG DB than follow the comments and install with the command shown below, an so on…

 example: yum install "perl(DBD::Pg)"

In my case i will not install any DB modules other than my-sql, but i’ll proceed with the missing tagged like required, optional and recommended needed to me (so analyze your needs before continue and install your needs )

yum install "perl(XML::LibXSLT)" 
yum install "perl(Authen::NTLM)" 
yum install "perl(YAML::XS)"
yum install "perl(Text::CSV_XS)"
yum install "perl(ModPerl::Util)"
yum install "perl(Mail::IMAPClient)
yum install "perl(JSON::XS)"
yum install "perl(Crypt::Eksblowfish::Bcrypt)"

You can re-check the modules with the script:

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

Now is time to apply the database changes and update schema as otrs user NOT as root.

cd /opt/otrs

cat scripts/DBUpdate-to-5.mysql.sql | mysql -p -f -u root otrs
su -c "bin/otrs.Console.pl Maint::Database::Check" -s /bin/bash otrs
su -c "scripts/DBUpdate-to-5.pl" -s /bin/bash otrs

Always as otrs user delete caches and refresh the configuration

su -c "bin/otrs.Console.pl Maint::Config::Rebuild" -s /bin/bash otrs
su -c "bin/otrs.Console.pl Maint::Cache::Delete" -s /bin/bash otrs

Restart your services

systemctl start httpd
systemctl start postfix
systemctl start crond

Start the daemon as otrs user.

su -c "/opt/otrs/bin/otrs.Daemon.pl start" -s /bin/bash otrs

The defaults OTRS cron files are located in /opt/otrs/var/cron/*.dist, they assicuring that the OTRS Daemon is running. They need to be activated by copying them without the “.dist” filename extension, and than use the script Cron.sh as OTRS user to schedule these jobs.

cd /opt/otrs/var/cron for foo in *.dist; do cp $foo `basename $foo .dist`; done
su -c "/opt/otrs/bin/Cron.sh start" -s /bin/bash otrs

delete the install packages, my sql backup, and otrs-old folder locate in /opt for the production server

here the link for the official docs

—>>> ENJOY!!! <<<—

About the author

mm

YOBIHAT TEAM author

YOBIHAT TEAM is a group of expertise IT (Programmers, System & Network engineer, Optic Fiber Technician, Graphics, Blogger and Users) who follow Open Source philosophy, and will drive you in deep with the YOBICLOUD platform for DevOps.

Leave a Reply

14 − ten =