How to install Open Webmail 2.54 on CentOS 8

 1.安装

参考官文指导文件
How to install Open Webmail 2.54 on CentOS 8
============================================
By Thomas Chung <[email protected]>
Last Update 2020.12.10

## Open Webmail 2.54 Test for CentOS 8

2020.12.07 - CentOS 8.3-2011 released
             https://lists.centos.org/pipermail/centos-announce/2020-December/035874.html

2020.06.15 - CentOS 8.2-2004 released
             https://lists.centos.org/pipermail/centos-announce/2020-June/035756.html

2020.01.15 - CentOS 8.1-1911 released
             https://lists.centos.org/pipermail/centos-announce/2020-January/035599.html

2019.09.24 - CentOS 8.0-1905 released
	     https://lists.centos.org/pipermail/centos-announce/2019-September/023449.html


## Open Webmail 2.54 Patch for CentOS 8

2020.02.14 - Add el8_openwebmail-read.pl.patch
               
2020.01.19 - Add el8_openwebmail-abook.pl.patch

2019.11.05 - Rebuild Open Webmail 2.54 RPM pkgs for EL8
             Build missing perl-Text-Iconv for EL8
  	     Add 4 patches to be compatible with perl 5.26 for EL8


0. Install postfix and httpd if not installed

# dnf install postfix
# systemctl enable postfix && systemctl start postfix

# dnf install httpd
# systemctl enable httpd && systemctl start httpd

# firewall-cmd --permanent --zone=public --add-service=smtp
# firewall-cmd --permanent --zone=public --add-service=http
# firewall-cmd --reload
# firewall-cmd --list-services

1. Download repo file for EL8
   
# curl -s ftp://openwebmail.org/pub/openwebmail/el8/openwebmail-el8.repo -o /etc/yum.repos.d/openwebmail-el8.repo


2. Install openwebmail for EL8
   
# dnf install openwebmail


3. Install gcc if not installed

# dnf install gcc


4. Run openwebmail-tool
   
# /usr/local/bin/openwebmail-tool --init

The version of Perl on your system (5.026003) does not support set user id.
Attempting to wrap the openwebmail perl files in a C wrapper to enable set
user id capability...

   Found C compiler /usr/bin/cc
   wrapping file: openwebmail-abook.pl...done
   wrapping file: openwebmail-advsearch.pl...done
   wrapping file: openwebmail-cal.pl...done
   wrapping file: openwebmail-folder.pl...done
   wrapping file: openwebmail-main.pl...done
   wrapping file: openwebmail-prefs.pl...done
   wrapping file: openwebmail-read.pl...done
   wrapping file: openwebmail-saprefs.pl...done
   wrapping file: openwebmail-send.pl...done
   wrapping file: openwebmail-spell.pl...done
   wrapping file: openwebmail-tool.pl...done
   wrapping file: openwebmail-vdomain.pl...done
   wrapping file: openwebmail-viewatt.pl...done
   wrapping file: openwebmail-webdisk.pl...done
   wrapping file: openwebmail.pl...done

creating db /var/www/cgi-bin/openwebmail/etc/maps/b2g ...done.
creating db /var/www/cgi-bin/openwebmail/etc/maps/g2b ...done.
creating db /var/www/cgi-bin/openwebmail/etc/maps/lunar ...done.

Creating UTF-8 locales...
langconv ar_AE.CP1256 -> ar_AE.UTF-8
langconv ar_AE.ISO8859-6 -> ar_AE.UTF-8
langconv bg_BG.CP1251 -> bg_BG.UTF-8
langconv ca_ES.ISO8859-1 -> ca_ES.UTF-8
langconv cs_CZ.ISO8859-2 -> cs_CZ.UTF-8
langconv da_DK.ISO8859-1 -> da_DK.UTF-8
langconv de_DE.ISO8859-1 -> de_DE.UTF-8
langconv el_GR.ISO8859-7 -> el_GR.UTF-8
langconv en_US.ISO8859-1 -> en_US.UTF-8
langconv es_AR.ISO8859-1 -> es_AR.UTF-8
langconv fi_FI.ISO8859-1 -> fi_FI.UTF-8
langconv fr_FR.ISO8859-1 -> fr_FR.UTF-8
langconv he_IL.CP1255 -> he_IL.UTF-8
langconv hr_HR.ISO8859-2 -> hr_HR.UTF-8
langconv hu_HU.ISO8859-2 -> hu_HU.UTF-8
langconv id_ID.ISO8859-1 -> id_ID.UTF-8
langconv it_IT.ISO8859-1 -> it_IT.UTF-8
langconv ko_KR.eucKR -> ko_KR.UTF-8
langconv lt_LT.CP1257 -> lt_LT.UTF-8
langconv nl_NL.ISO8859-1 -> nl_NL.UTF-8
langconv no_NO.ISO8859-1 -> no_NO.UTF-8
langconv pl_PL.ISO8859-2 -> pl_PL.UTF-8
langconv pt_BR.ISO8859-1 -> pt_BR.UTF-8
langconv pt_PT.ISO8859-1 -> pt_PT.UTF-8
langconv ro_RO.ISO8859-2 -> ro_RO.UTF-8
langconv ru_RU.KOI8-R -> ru_RU.UTF-8
langconv sk_SK.ISO8859-2 -> sk_SK.UTF-8
langconv sl_SI.CP1250 -> sl_SI.UTF-8
langconv sr_CS.ISO8859-2 -> sr_CS.UTF-8
langconv sv_SE.ISO8859-1 -> sv_SE.UTF-8
langconv th_TH.TIS-620 -> th_TH.UTF-8
langconv tr_TR.ISO8859-9 -> tr_TR.UTF-8
langconv uk_UA.KOI8-U -> uk_UA.UTF-8
...done.

Welcome to the OpenWebMail!

This program is going to send a short message back to the developer,
so we could have the idea that who is installing and how many sites are
using this software, the content to be sent is:

OS: Linux 4.18.0-80.11.2.el8_0.x86_64 x86_64
Perl: 5.026003
WebMail: OpenWebMail 2.54 20141206

Send the site report?(Y/n) Y
sending report...

# /usr/local/bin/openwebmail-tool --fix

Permission and Ownership for openwebmail files have been fixed!


5. Disable selinux and reboot

# vi /etc/selinux/config
SELINUX=disabled

6. Reload httpd

# systemctl reload httpd

7. Login to webmail URL with non-root user account

http://{hostname}/webmail

2.配置

修改配置文件

vi /var/www/cgi-bin/openwebmail/etc/openwebmail.conf

  1. domainnames auto 改为 tsmt.com
  2. default_language en 改为 zh_CN.GB2312
  3. default_iconset Cool3D.English 改为支持中文 Cool3D.Chinese.Simplified

 3.启动

    service httpd restart

4.帐号

openwebmail是以系统用户和密码作为登录验证的

5.访问

以root用户名和密码登录,出现以下错误:

OpenWebMail ERROR:

无法写入 /var/log/openwebmail.log! (Permission denied)

查看该文件夹及文件权限,没有问题,甚至用CHMOD(chmod 777 /var/log/openwebmail.log)修改了一下,问题仍在。

通过编辑该文件:

vi /var/log/openwebmail.log

Sat Jan 23 22:22:51 2021 - [42810] (127.0.0.1) UNKNOWNUSER - send message - trying to connect to smtp server 127.0.0.1:25
Sat Jan 23 22:22:51 2021 - [42810] (127.0.0.1) UNKNOWNUSER - send message - connected to smtp server 127.0.0.1:25

得知,该错误是因为没有邮箱用户造成的。

列出用户列表:#cat /etc/passwd

找到邮箱用户:postfixuser:x:1006:1007::/home/postfixuser:/bin/bash

                         注册名:有密码:usrid:groopid::usrdir:命令解释程序

以该用户登录,问题依然如故。

命令执行chown postfixuser:postfixuser /var/log/openwebmail.log无效;

6.登录问题解决

#groupadd  mymailuser   //建立新组 mymailuser
#useradd tsmusr
#passwd tsmusr
#usermod -a -G mymailuser tsmusr (加入新建组)
#cd /home
#mkdir tsmusr
#cd tsmusr
#mkdir mymail
#chmod 777 mymail
#cd /
#chown -R tsmusr:mymailuser /home/tsmusr

  重新启动系统,以tsmusr用户登录,出现以下画面,成功。测试成功后,只要是centos下的帐户(不一定要加入特定组),均可登录成功。

7. 上述工作完成后,只能发送邮件,但不能接收邮件,我已经完成的工作如下:

    postfix,dns,openwebmail有了上面这三个工作基础,我可以在自己的邮件服务器上创建邮箱帐号,如:[email protected],并可通过:http://mail.tsmt.com/webmail来发送邮件了。

    下面我们继续安装一个工具Dovecot,就可以接收邮件了,至于邮件列表,需要安装mailman,我暂时不需要,就不介绍了,以后若需要,再来更新此篇文章。

     Dovecot的安装没有新意,我的机器已安装好,这里就不介绍了。下面说说如何配置:

     # vi /etc/dovecot/dovecot.conf

     找到下面这行,去掉前面的注释和最后一个单词

       protocols = imap pop3 lmtp  

       listen = *

       login_trusted_networks = 192.168.1.0/24

        # vi /etc/dovecot/conf.d/10-ssl.conf

      将  ssl = required 改为  ssl = no

     #vi /etc/dovecot/conf.d/10-auth.conf

     把disable_plaintext_auth = yes改为disable_plaintext_auth = no

     #vi /etc/dovecot/conf.d/10-master.conf

       修改这一部分如下:

       # Postfix smtp-auth
          unix_listener /var/spool/postfix/private/auth {
               mode = 0666
               user = postfix
               group = postfix
             }

     设定邮件存放位置

      # vi /etc/dovecot/conf.d/10-mail.conf

      mail_location = maildir:~/Maildir(与postfix相同)

      重启系统

       service dovecot reload或service dovecot start或service dovecot restart

       上述工作完成后,postfix与dovecot是可以正常收发邮件了,但openwebmail仍然只能发邮件,不能收邮件。

        8.问题解决

修改openwebmail 的一些配置文件


[root@ser defaults]#  vim /var/www/cgi-bin/openwebmail/etc/defaults/dbm.conf 
dbm_ext                 .db
dbmopen_ext             .db
dbmopen_haslock         yes
smtpserver  192.168.1.202
[root@ser defaults]#  vim openwebmail.conf
domainnames             tsmt.com
smtpserver              192.168.1.202
authpop3_server         192.168.1.202
再次初始化openwebmail
[root@ser defaults]#/usr/local/bin/openwebmail-tool --init
  
出现Y/N 时,按Y。

把Postfix+Dovecot+Openwebmail 三者个格式统一下就行了
1.postfix 配置 main.cf
# vi /etc/postfix/main.cf
mail_spool_directory = /var/spool/mail
home_mailbox = /var/spool/mail/user
proxy_interfaces = 0.0.0.0
2.Dovecot 配置 10-mail.conf
vi /etc/dovecot/conf.d/10-mail.conf
mail_location = mbox:~/mail:INBOX=/var/spool/mail/%u
3.Openwebmail.conf
 vi /var/www/cgi-bin/openwebmail/etc/openwebmail.conf
 mailspooldir /var/spool/mail

         注:main.cf的配置还是有问题,更新中

    

    

猜你喜欢

转载自blog.csdn.net/tswang6503/article/details/113063178