Обновление OTRS 5 на OTRS 6 Centos 7

В целом все стандартно, но есть нюансы:

Mysql

Остановка сервисов

systemctl stop httpd
systemctl stop crond
systemctl stop postfix

sudo su - otrs -c "/opt/otrs/bin/otrs.Daemon.pl stop"
sudo su - otrs -c "/opt/otrs/bin/Cron.sh stop"

update otrs 6

yum install perl-DateTime*

rpm -Uvh otrs-6.0.14-01.noarch.rpm
или
yum install --nogpgcheck otrs-6.0.14-01.noarch.rpm

Если висит пользователь otrs обновление не пройдет

Находим процесс

ps -auxw | grep otrs

Убиваем его процесс

kill -9 ID

Повторяем обновление.

запуск скрипта

cd /opt/otrs/
bin/otrs.SetPermissions.pl

sudo su - otrs -c /opt/otrs/scripts/DBUpdate-to-6.pl

Если возникает ошибка

Error: The setting character_set_database needs to be ‘utf8’.

Тогда

ALTER DATABASE otrs CHARACTER SET utf8 COLLATE utf8_general_ci;

 

Запуск обновлений дополнений, на автомате не получился, только через панель

sudo su - otrs -c /opt/otrs/bin/otrs.Console.pl Admin::Package::UpgradeAll

Проблема с отправкой почты через mail.nic.ru.
Помогла статья

В итоге получилось запустить через sendmail

Установка нужных пакетов:

yum install sendmail sendmail-cf openssl cyrus-sasl cyrus-sasl-plain nano

Создание SSL сертификатов:

mkdir /etc/mail/certs
chmod 700 /etc/mail/certs 
cd /etc/mail/certs
openssl dsaparam 1024 -out dsa1024 -out dsa1024.pem
openssl req -x509 -nodes -days 3650 -newkey dsa:dsa1024.pem -out /etc/mail/certs/mycert.pem -keyout /etc/mail/certs/mykey.pem
openssl req -x509 -new -days 3650 -key /etc/mail/certs/mykey.pem -out /etc/mail/certs/mycert.pem
ln -s /etc/mail/certs/mycert.pem /etc/mail/certs/CAcert.pem
chmod 600 /etc/mail/certs/*

Создание файла с данными для аутентификации:

nano /etc/mail/auth/authinfo

 

AuthInfo:mail.nic.ru "U:support@MYDOMEN.RU" "I:support@MYDOMEN.RU" "P:PASSWORD"
AuthInfo: "U:support@MYDOMEN.RU" "I:support@MYDOMEN.RU" "P:PASSWORD"

Конвертируем:

makemap hash -r /etc/mail/auth/authinfo < /etc/mail/auth/authinfo

Добавляем в sendmail.mc нужную конфигурацию (важно: сделать это до первого FEATURE):

dnl # Smtp relay
define(`CERT_DIR', `MAIL_SETTINGS_DIR`'certs')
define(`confCACERT_PATH', `CERT_DIR')
define(`confCACERT', `CERT_DIR/CAcert.pem')
define(`confSERVER_CERT', `CERT_DIR/mycert.pem')
define(`confSERVER_KEY', `CERT_DIR/mykey.pem')
define(`confCLIENT_CERT', `CERT_DIR/mycert.pem')
define(`confCLIENT_KEY', `CERT_DIR/mykey.pem')
dnl #
dnl # mail.nic.ru auth
define(`SMART_HOST',`[mail.nic.ru]')dnl
define(`RELAY_MAILER_ARGS', `TCP $h 587')dnl
define(`ESMTP_MAILER_ARGS', `TCP $h 465')dnl
define(`confAUTH_OPTIONS', `A p')dnl
TRUST_AUTH_MECH(`EXTERNAL DIGEST-MD5 CRAM-MD5 LOGIN PLAIN')dnl
define(`confAUTH_MECHANISMS', `EXTERNAL GSSAPI DIGEST-MD5 CRAM-MD5 LOGIN PLAIN')dnl
FEATURE(`authinfo',`hash -o /etc/mail/auth/authinfo.db')dnl

Компилируем конфигурацию, перезапускаем sendmail и проверяем отправку почты:

make -C /etc/mail
service sendmail restart

В OTRS выставляем отправку через Sendmail

Посмотреть сообщения для отправки

sudo -u otrs /opt/otrs/bin/otrs.Console.pl Maint::Email::MailQueue --list

Можно удалить из очереди

 sudo -u otrs /opt/otrs/bin/otrs.Console.pl Maint::Email::MailQueue --delete --filter ID::540

Или удалить все

--delete-all

Информация взята  отсюда

Необходимо изменить еще хранимые процедуры, структура базы OTRS 6 немного другая.

CREATE DEFINER=`root`@`%` PROCEDURE `DeleteArticleByID`(IN ID_article_id INT)
BEGIN
-- Удаляем article
START TRANSACTION;
-- Provide the values of the primary key of the row to delete.
SET @id_to_delete = ID_article_id;

DELETE FROM article_data_mime
    USING article_data_mime, article
    WHERE `article`.`id` = `article_data_mime`.`article_id`
          AND article.id = @id_to_delete;
DELETE FROM article_data_mime_attachment
    USING article_data_mime_attachment, article
    WHERE `article`.`id` = `article_data_mime_attachment`.`article_id`
          AND article.id = @id_to_delete;
DELETE FROM article_data_mime_plain
    USING article_data_mime_plain, article
    WHERE `article`.`id` = `article_data_mime_plain`.`article_id`
          AND article.id = @id_to_delete;
DELETE FROM article_data_mime_send_error
    USING article_data_mime_send_error, article
    WHERE `article`.`id` = `article_data_mime_send_error`.`article_id`
          AND article.id = @id_to_delete;
DELETE FROM article_data_otrs_chat
    USING article_data_otrs_chat, article
    WHERE `article`.`id` = `article_data_otrs_chat`.`article_id`
          AND article.id = @id_to_delete;
DELETE FROM article_flag
    USING article_flag, article
    WHERE `article`.`id` = `article_flag`.`article_id`
          AND article.id = @id_to_delete;
DELETE FROM article_search_index
    USING article_search_index, article
    WHERE `article`.`id` = `article_search_index`.`article_id`
          AND article.id = @id_to_delete;
DELETE FROM mail_queue
    USING mail_queue, article
    WHERE `article`.`id` = `mail_queue`.`article_id`
          AND article.id = @id_to_delete;
DELETE FROM ticket_history
    USING ticket_history, article
    WHERE `article`.`id` = `ticket_history`.`article_id`
          AND article.id = @id_to_delete;
DELETE FROM time_accounting
    USING time_accounting, article
    WHERE `article`.`id` = `time_accounting`.`article_id`
          AND article.id = @id_to_delete;
DELETE FROM article
    USING article
    WHERE article.id = @id_to_delete;
COMMIT;
    

SELECT 1;
END

и

CREATE DEFINER=`root`@`%` PROCEDURE `DeleteTicketByID`(IN ID_ticket_id INT)
BEGIN
-- Удаляем ticket
START TRANSACTION;
-- Provide the values of the primary key of the row to delete.
SET @id_to_delete = ID_ticket_id;

DELETE FROM ticket_flag
 USING ticket_flag, ticket
 WHERE `ticket`.`id` = `ticket_flag`.`ticket_id`
 AND ticket.id = @id_to_delete;
DELETE FROM ticket_history
 USING ticket_history, ticket
 WHERE `ticket`.`id` = `ticket_history`.`ticket_id`
 AND ticket.id = @id_to_delete;
DELETE FROM ticket_index
 USING ticket_index, ticket
 WHERE `ticket`.`id` = `ticket_index`.`ticket_id`
 AND ticket.id = @id_to_delete;
DELETE FROM ticket_lock_index
 USING ticket_lock_index, ticket
 WHERE `ticket`.`id` = `ticket_lock_index`.`ticket_id`
 AND ticket.id = @id_to_delete;
DELETE FROM ticket_watcher
 USING ticket_watcher, ticket
 WHERE `ticket`.`id` = `ticket_watcher`.`ticket_id`
 AND ticket.id = @id_to_delete;
DELETE FROM time_accounting
 USING time_accounting, ticket
 WHERE `ticket`.`id` = `time_accounting`.`ticket_id`
 AND ticket.id = @id_to_delete;
DELETE FROM ticket
 USING ticket
 WHERE ticket.id = @id_to_delete;
COMMIT;
SELECT 1;
END

Проверка модулей perl

sudo su - otrs -c "/opt/otrs/bin/otrs.CheckModules.pl"

Disable OTRS business

Резервная копия

/opt/otrs/scripts/backup.pl -d /var/backup

Пример создания заявки через SOAP