centos7 安装otrs
yum install -y wget vim-enhanced htop tmpwatch mailx telnet unzip
rpm -ivh http://repository.it4i.cz/mirrors/repoforge/redhat/el6/en/x86_64/rpmforge/RPMS/rpmforge-release-0.5.3-1.el6.rf.x86_64.rpm
rpm -Uvh http://espejos.ucr.ac.cr/epel/7/x86_64/Packages/e/epel-release-7-11.noarch.rpm
#升级系统
#yum update
yum install -y bash-completion net-tools
#安装 MariaDB
yum install -y mariadb-server
systemctl start mariadb
systemctl enable mariadb.service
#安装 apache
yum install -y httpd mod_ssl
systemctl start httpd
systemctl enable httpd.service
#临时关闭SELINUX
vim /etc/selinux/config
setenforce 0
安装 OTRS
#配置MariaDB
/usr/bin/mysql_secure_installation
rm -f /var/lib/mysql/ibdata*
rm -f /var/lib/mysql/ib_logfile*
#修改配置文件
vim /etc/my.cnf
添加
• max_allowed_packet=64M
• query_cache_size=16M
• innodb_log_file_size=256M
• innodb_file_per_table=1
• character-set-server=utf8
#重启数据库
systemctl restart mariadb
#下载OTRS
http://ftp.otrs.org/pub/otrs/RPMS/rhel/7/
wget http://ftp.otrs.org/pub/otrs/RPMS/rhel/7/otrs-6.0.17-01.noarch.rpm
rpm -ivh otrs-6.0.17-01.noarch.rpm
yum install -y "perl(Archive::Zip)" "perl(Crypt::SSLeay)" "perl(Date::Format)" "perl(IO::Socket::SSL)" "perl(LWP::UserAgent)" "perl(Net::DNS)" "perl(Net::LDAP)" "perl(Template)" "perl(URI)" "perl(XML::LibXML)" "perl(XML::LibXSLT)" "perl(XML::Parser)" perl-core procmail "perl(DateTime)"
cd /opt/otrs/bin/
./otrs.CheckModules.pl
yum install -y "perl(Mail::IMAPClient)" "perl(ModPerl::Util)" "perl(Text::CSV_XS)" "perl(YAML::XS)" "perl(JSON::XS)" "perl(Crypt::Eksblowfish::Bcrypt)"
yum install "perl(Encode::HanExtra)"
#根据./otrs.CheckModules.pl返回的提示 安装软件 最后只剩下面3个不需要安装 缺啥照着他提示的安装命令敲就行了
#重启apache
systemctl restart httpd
#配置OTRS
su otrs
/opt/otrs/bin/otrs.Daemon.pl start
/opt/otrs/bin/Cron.sh start
#这里要是配置有问题会一直报错 必须要kill才可以
#sendmail安装
yum install -y sendmail
yum install -y sendmail-cf
#创建自定义服务启动。
systemctl enable sendmail
systemctl start sendmail
sendmail配置SMTP认证 将下面两行内容前面的dnl去掉。在sendmail文件中,dnl表示该行为注释行,是无效的,因此通过去除行首的dnl字符串可以开启相应的设置行。 先备份在编辑
cp /etc/mail/sendmail.mc /etc/mail/sendmail.mc.bak
vim /etc/mail/sendmail.mc
TRUST_AUTH_MECH(`EXTERNAL DIGEST-MD5 CRAM-MD5 LOGIN PLAIN')dnl
define(`confAUTH_MECHANISMS', `EXTERNAL GSSAPI DIGEST-MD5 CRAM-MD5 LOGIN PLAIN')dnl
设置Sendmail服务的网络访问权限(如果是直接本机调用,可以不用操作,采用默认的127.0.0.1。不过最后还是改成0.0.0.0) 将127.0.0.1改为0.0.0.0,意思是任何主机都可以访问Sendmail服务。 如果仅让某一个网段能够访问到Sendmail服务,将127.0.0.1改为形如192.168.1.0/24的一个特定网段地址。
[root@otrs ~]# vim /etc/mail/sendmail.mc
DAEMON_OPTIONS(`Port=smtp,Addr=0.0.0.0, Name=MTA')dnl
#重启服务
systemctl restart sendmail
#查看日志和队列 我发现qq邮箱在这里比阿里云邮箱好用
[root@otrs ~]# mailq
/var/spool/mqueue is empty
Total requests: 0
[root@localhost bin]# tail -99f /var/log/maillog
Sep 7 13:51:51 localhost sendmail[19460]: alias database /etc/aliases rebuilt by root
Sep 7 13:51:51 localhost sendmail[19460]: /etc/aliases: 76 aliases, longest 10 bytes, 771 bytes total
Sep 7 13:53:07 localhost sendmail[19584]: starting daemon (8.14.7): SMTP+queueing@01:00:00
Sep 7 13:53:07 localhost sendmail[19584]: NOQUEUE: SYSERR(root): opendaemonsocket: daemon MTA: cannot bind: Address already in use
Sep 7 13:53:07 localhost sendmail[19584]: daemon MTA: problem creating SMTP socket
Sep 7 13:53:07 localhost postfix/postfix-script[19583]: stopping the Postfix mail system
Sep 7 13:53:07 localhost postfix/master[6720]: terminating on signal 15
Sep 7 13:53:12 localhost sm-msp-queue[19603]: starting daemon (8.14.7): queueing@01:00:00
Sep 7 13:55:16 localhost sendmail[19697]: starting daemon (8.14.7): SMTP+queueing@01:00:00
Sep 7 13:55:16 localhost sm-msp-queue[19712]: starting daemon (8.14.7): queueing@01:00:00
Sep 7 13:55:20 localhost sendmail[19735]: starting daemon (8.14.7): SMTP+queueing@01:00:00
Sep 7 13:55:20 localhost sm-msp-queue[19750]: starting daemon (8.14.7): queueing@01:00:00
Sep 7 13:56:57 localhost sendmail[19829]: x87HuvNl019829: from=root, size=246, class=0, nrcpts=1, msgid=<201909071756.x87HuvNl019829@localhost.localdomain>, relay=root@localhost
Sep 7 13:56:57 localhost sendmail[19830]: x87HuvK9019830: from=<root@localhost.localdomain>, size=504, class=0, nrcpts=1, msgid=<201909071756.x87HuvNl019829@localhost.localdomain>, proto=ESMTP, daemon=MTA, relay=localhost [127.0.0.1]
Sep 7 13:56:57 localhost sendmail[19829]: x87HuvNl019829: to=hugo.xu@pdabc.com, ctladdr=root (0/0), delay=00:00:00, xdelay=00:00:00, mailer=relay, pri=30246, relay=[127.0.0.1] [127.0.0.1], dsn=2.0.0, stat=Sent (x87HuvK9019830 Message accepted for delivery)
Sep 7 13:56:58 localhost sendmail[19832]: STARTTLS=client, relay=mxw.mxhichina.com., version=TLSv1/SSLv3, verify=FAIL, cipher=AES256-GCM-SHA384, bits=256/256
Sep 7 13:56:58 localhost sendmail[19832]: x87HuvK9019830: to=<hugo.xu@pdabc.com>, ctladdr=<root@localhost.localdomain> (0/0), delay=00:00:01, xdelay=00:00:01, mailer=esmtp, pri=120504, relay=mxw.mxhichina.com. [42.120.219.135], dsn=5.0.0, stat=Service unavailable
Sep 7 13:56:58 localhost sendmail[19832]: x87HuvK9019830: x87HuwK9019832: DSN: Service unavailable
Sep 7 13:57:00 localhost sendmail[19832]: x87HuwK9019832: to=<root@localhost.localdomain>, delay=00:00:02, xdelay=00:00:02, mailer=local, pri=31739, dsn=2.0.0, stat=Sent
Sep 7 14:00:01 localhost sendmail[19920]: x87I01RK019920: from=root, size=245, class=0, nrcpts=1, msgid=<201909071800.x87I01RK019920@localhost.localdomain>, relay=root@localhost
Sep 7 14:00:01 localhost sendmail[19921]: x87I01IE019921: from=<root@localhost.localdomain>, size=502, class=0, nrcpts=1, msgid=<201909071800.x87I01RK019920@localhost.localdomain>, proto=ESMTP, daemon=MTA, relay=localhost [127.0.0.1]
Sep 7 14:00:01 localhost sendmail[19920]: x87I01RK019920: to=423308591@qq.com, ctladdr=root (0/0), delay=00:00:00, xdelay=00:00:00, mailer=relay, pri=30245, relay=[127.0.0.1] [127.0.0.1], dsn=2.0.0, stat=Sent (x87I01IE019921 Message accepted for delivery)
Sep 7 14:00:02 localhost sendmail[19925]: STARTTLS=client, relay=mx3.qq.com., version=TLSv1/SSLv3, verify=FAIL, cipher=ECDHE-RSA-AES128-GCM-SHA256, bits=128/128
Sep 7 14:00:03 localhost sendmail[19925]: x87I01IE019921: to=<423308591@qq.com>, ctladdr=<root@localhost.localdomain> (0/0), delay=00:00:02, xdelay=00:00:02, mailer=esmtp, pri=120502, relay=mx3.qq.com. [14.215.140.20], dsn=2.0.0, stat=Sent (Ok: queued as )
测试发送邮箱 [root@otrs ~]#yum -y install mailx 创建一个邮件内容文件,然后发邮件(注意-s参数后的邮件标题要用单引号,不能使用双引号,否则发邮件会失败!)
[root@otrs ~]# echo 'This is test mail'>/root/content.txt
[root@otrs ~]# cat /root/content.txt
This is test mail
[root@otrs ~]# mail -s 'this is otrs test message' xxxxxxx@qq.com < /root/content.txt
#浏览器登录http://192.168.10.129/otrs/installer.pl
#之前设置了免密 到第三步会提示报错。
#创建成功
#浏览器登录http://192.168.10.129/otrs/customer.pl
#注册之后可以通过管理员修改密码登陆 登陆之后可以创建工单
#创建工单之后 管理员可以收到工单但是回复工单 有点问题 会报错 但是明明和smtp是通的虽然会报错 但是客户的账号还是会看到处理这边的回复 只是没有邮件通知而已