3 # otrs_setup.sh is a helper script to automate most of the steps for setting up OTRS on CentOS7.
5 # Copyright (C) 2019 Yordan Manolov
7 # This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
9 # This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
11 # You should have received a copy of the GNU General Public License along with this program. If not, see http://www.gnu.org/licenses/.
14 OTRS_VER="otrs-6.0.19-02"
15 OTRS_RPM="$OTRS_VER.noarch.rpm"
16 OTRS_URL="http://ftp.otrs.org/pub/otrs/RPMS/rhel/7/$OTRS_RPM"
19 then echo "Insufficient privileges: non-root user detected. Aborting ... "
23 sed -ie 's@^ONBOOT="no@ONBOOT="yes@' $(ls /etc/sysconfig/network-scripts/ | grep ens)
26 yum install -y epel-release mariadb-server wget
29 if [ $(grep -c "SELINUX=enforcing" /etc/selinux/config) -gt 0 ]; then
30 echo "SELINUX is preventing OTRS installation. Disabling SELINUX rules... "
31 sed -ie 's@SELINUX=enforcing@SELINUX=permissive@' /etc/selinux/config
35 touch /etc/my.cnf.d/zotrs.cnf
39 default-character-set = utf8
42 default-character-set = utf8
45 collation-server = utf8_unicode_ci
46 init-connect = 'SET NAMES utf8'
47 character-set-server = utf8
49 max_allowed_packet = 64M
50 query_cache_size = 32M
51 innodb_log_file_size = 256M
52 " > /etc/my.cnf.d/zotrs.cnf
55 echo "Could not write MariaDB config for OTRS. Aborting..."
59 systemctl enable mariadb
60 systemctl restart mariadb
63 yum install -y $OTRS_RPM
65 yum install -y "perl(YAML::XS)" "perl(Archive::Tar)" "perl(Archive::Zip)" "perl(Date::Format)" "perl(DateTime)" "perl(Digest::SHA)" "perl(Net::DNS)" "perl(Template)" "perl(Crypt::Eksblowfish::Bcrypt)" "perl(JSON::XS)" "perl(Text::CSV_XS)" "perl(DBD::ODBC)" "perl(DBD::Pg)" "perl(Mail::IMAPClient)" "perl(Authen::NTLM)" "perl(ModPerl::Util)"
67 systemctl enable httpd
68 systemctl restart httpd
70 echo "This system uses the following network interfaces: "
73 ip route add default via $(ip -br addr | tail -n 1 | awk '{print $3}' | cut -c 1-14)
74 firewall-cmd --add-port=80/tcp --permanent
75 firewall-cmd --add-port=8080/tcp --permanent
77 systemctl restart firewalld