Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Postfix source code centos7 building and error tips-personal testing

2025-02-25 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/03 Report--

System: CentOS Linux release 7.3.1611 (Core) minimum installation

Software: postfix-3.2.0+MySQL-5.6.36 (preferably version 5.1) + Nginx+dovecot-1:2.2.10+courier-authlib-0.66.2

1 setenforce 0 8 systemctl stop firewalld 9 vi / etc/selinux/config 10 yum install-y wget 11 wget http://dev.mysql.com/get/mysql-community-release-el7-5.noarch.rpm 12 rpm-ivh mysql-community-release-el7-5.noarch.rpm 13 wget http://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm 14 rpm-ivh epel-release-latest-7.noarch.rpm 15 yum install nginx vim gcc gcc-c++ openssl openssl-devel db4-devel ntpdate mysql mysql-devel mysql-server bzip2 php-mysql cyrus-sasl-md5 perl-GD perl-DBD-MySQL perl-GD perl-CPAN perl-CGI perl-CGI-Session cyrus-sasl-lib cyrus-sasl-plain cyrus-sasl cyrus-sasl-devel libtool-ltdl-devel telnet mail libicu-devel

16 yum remove postfix-y

17 userdel postfix

18 groupdel postdrop

19 groupadd-g 2525 postfix

20 useradd-g postfix-u 2525-s / sbin/nologin-M postfix

21 groupadd-g 2526 postdrop

22 useradd-g postdrop-u 2526-s / sbin/nologin-M postdrop

25 yum install lrzsz

27 tar zxvf postfix-3.2.0.tar.gz

28 cd postfix-3.2.0

29 make makefiles' CCARGS=-DHAS_MYSQL-I/usr/include/mysql-DUSE_SASL_AUTH-DUSE_CYRUS_SASL-I/usr/include/sasl-DUSE_TLS''AUXLIBS=-L/usr/lib64/mysql-lmysqlclient-lz-lrt-lm-L/usr/lib64/sasl2-lsasl2-lssl-lcrypto'

30 make

31 make install

Note: tempdir: [/ root/postfix-3.0.1] / tmp/extmail this item needs to be changed, other items default

32 chown-R postfix:postdrop / var/spool/postfix

33 chown-R postfix:postdrop / var/lib/postfix/

34 chown root / var/spool/postfix

35 chown-R root / var/spool/postfix/pid

36 vi / etc/postfix/main.cf

Myhostname = mail.everyoo.com / / set the hostname

Mydomain = everyoo.com / / specify the domain name

Myorigin = $mydomain / / indicates the domain name where the sender is located

Inet_interfaces = / / all specifies the network interface on which the postfix system is listening

Mydestination = $myhostname, localhost.$mydomain, localhost,$mydomain / / specify the domain name of the recipient when postfix receives email [use virtual domain needs to be disabled]

Mynetworks_style = host / / specify the type of trust segment

Mynetworks = 192.168.1.0 Compact 24,127.0.0.0amp8 / / specify trusted client

Relay_domains = $mydestination / / specify the domain name that allows transit mail

Alias_maps = hash:/etc/aliases / / set the alias of the message

37 yum install-y dovecot dovecot-mysql

38 cd / etc/dovecot/

39 vi dovecot.conf

Protocols = imap pop3

! include conf.d/*.conf

Listen = *

Base_dir = / var/run/dovecot/

40 cd conf.d/

41 vi 10-auth.conf

Disable_plaintext_auth = no

42 vi 10-mail.conf

Mail_location = maildir:~/Maildir

Mail_location = maildir:/var/mailbox/%d/%n/Maildir

Mail_privileged_group = mail

43 vi 10-ssl.conf

Ssl = no

44 vi 10-logging.conf

Log_path = / var/log/dovecot.log

Info_log_path = / var/log/dovecot.info

45 cp auth-sql.conf.ext auth-sql.conf

46 vi auth-sql.conf

Args = / etc/dovecot/dovecot-sql.conf.ext. Ext removed, a total of two

47 vi / etc/dovecot-mysql.conf

Driver = mysql

Connect = host=localhost dbname=extmail user=extmail password=extmail

Default_pass_scheme = CRYPT

Password_query = SELECT username AS user,password AS password FROM mailbox WHERE username ='% u'

User_query = SELECT maildir, uidnumber AS uid, gidnumber AS gid FROM mailbox WHERE username ='% u'

48 cd ~

49 wget https://sourceforge.net/projects/courier/files/authlib/0.66.2/courier-authlib-0.66.2.tar.bz2

54 wget https://sourceforge.net/projects/courier/files/courier-unicode/1.2/courier-unicode-1.2.tar.bz2

55 tar xf courier-unicode-1.2.tar.bz2 install this software first, and then courier-authlib, otherwise you will report an error

56 cd courier-unicode-1.2

57. / configure

58 make & & make install

59 cd..

60 cd courier-authlib-0.66.2

61. / configure-prefix=/usr/local/courier-authlib-- sysconfdir=/etc-- without-authpam-- without-authshadow-- without-authvchkpw-- without-authpgsql-- with-authmysql-- with-mysql-libs=/usr/lib64/mysql-- with-mysql-includes=/usr/include/mysql-- with-redhat-- with-authmysqlrc=/etc/authmysqlrc-- with-authdaemonrc=/etc/authdaemonrc-- with-mailuser=postfix

62 make & & makeinstall

63 make install

64 chmod 755 / usr/local/courier-authlib/var/spool/authdaemon

65 cp / etc/authdaemonrc.dist / etc/authdaemonrc

66 cp / etc/authmysqlrc.dist / etc/authmysqlrc

67 vi / etc/authdaemonrc

Authmodulelist= "authmysql"

Authmodulelistorig= "authmysql"

69 mv / etc/authmysqlrc / etc/authmysqlrc.bak

70 vi / etc/authmysqlrc

MYSQL_SERVER localhost

MYSQL_USERNAME extmail

MYSQL_PASSWORD extmail

MYSQL_SOCKET / var/lib/mysql/mysql.sock

MYSQL_PORT 3306

MYSQL_DATABASE extmail

MYSQL_USER_TABLE mailbox

MYSQL_CRYPT_PWFIELD password

DEFAULT_DOMAIN test.com

MYSQL_UID_FIELD '2525'

MYSQL_GID_FIELD '2525'

MYSQL_LOGIN_FIELD username

MYSQL_HOME_FIELD concat ('/ var/mailbox/',homedir)

MYSQL_NAME_FIELD name

MYSQL_MAILDIR_FIELD concat ('/ var/mailbox/',maildir)

71 cp courier-authlib.sysvinit / etc/init.d/courier-authlib

72 chmod + x / etc/init.d/courier-authlib

73 chkconfig-add courier-authlib

74 chkconfig courier-authlib on

75 echo "/ usr/local/courier-authlib/lib/courier-authlib" > > / etc/ld.so.conf.d/courier-authlib.conf

76 ldconfig

77 service courier-authlib start

78 vi / usr/lib64/sasl2/smtpd.conf

Pwcheck_method: authdaemond

Log_level: 3

Mech_list: PLAIN LOGIN

Authdaemond_path:/usr/local/courier-authlib/var/spool/authdaemon/socket

79 vi / etc/postfix/main.cf

# # postfix supports SMTP##

Smtpd_sasl_auth_enable = yes

Smtpd_sasl_local_domain =''

Smtpd_recipient_restrictions = permit_mynetworks,permit_sasl_authenticated,reject_unauth_destination

Broken_sasl_auth_clients=yes

Smtpd_client_restrictions = permit_sasl_authenticated

Smtpd_sasl_security_options = noanonymous

# # postfix supports virtual users # #

Virtual_mailbox_base = / var/mailbox

Virtual_mailbox_maps = mysql:/etc/postfix/mysql_virtual_mailbox_maps.cf

Virtual_mailbox_domains = mysql:/etc/postfix/mysql_virtual_domains_maps.cf

Virtual_alias_domains =

Virtual_alias_maps = mysql:/etc/postfix/mysql_virtual_alias_maps.cf

Virtual_uid_maps = static:2525

Virtual_gid_maps = static:2525

Virtual_transport = virtual

80 cd ~

81 rz

82 mkdir-p / var/www/extsuite

83 tar xf extmail-1.2.tar.gz-C / var/www/extsuite/

84 mv / var/www/extsuite/extmail-1.2/ / var/www/extsuite/extmail

85 cd / var/www/extsuite/extmail

86 cp webmail.cf.default webmail.cf

87 vi webmail.cf

SYS_SESS_DIR = / tmp/extmail

SYS_UPLOAD_TMPDIR = / tmp/extmail/upload

SYS_USER_LANG = zh_CN

SYS_MIN_PASS_LEN = 8

SYS_MAILDIR_BASE = / var/mailbox

SYS_MYSQL_USER = extmail

SYS_MYSQL_PASS = extmail

SYS_MYSQL_DB = extmail

SYS_MYSQL_HOST = localhost

SYS_MYSQL_SOCKET = / var/lib/mysql/mysql.sock

SYS_MYSQL_TABLE = mailbox

SYS_MYSQL_ATTR_USERNAME = username

SYS_MYSQL_ATTR_DOMAIN = domain

SYS_MYSQL_ATTR_PASSWD = password

SYS_AUTHLIB_SOCKET = / usr/local/courier-authlib/var/spool/authdaemon/socket

88 mkdir-p / tmp/extmail/upload

89 chown-R postfix.postfix / tmp/extmail/

90 cd ~

91 tar xf extman-1.1.tar.gz-C / var/www/extsuite/

92 cd / var/www/extsuite/

93 mv extman-1.1/ extman

94 cd extman/

95 cp webman.cf.default webman.cf

96 chown-R postfix.postfix / var/www/extsuite/extman/cgi/

97 chown-R postfix.postfix / var/www/extsuite/extmail/cgi/

98 cd docs/

99 vi extmail.sql note that there are 5 places where TYPE should be ENGINE.

Ps: this step is very critical, MySQL version do not select the latest 5.7.I tested n times before, modified the type and password fields after import, resulting in extam login can not be authenticated! So the best version should be before 5.1! I would like to remind you not to go the wrong way!

The following is the first time to configure mysql and set the password

100 service mysql start

101 mysql

102 mysql-uroot-p

103 mysql-uroot < extmail.sql error:

ERROR 1364 (HY000) at line 31: Field 'ssl_cipher' doesn't have a default value

105 vi / etc/my.cnf

# sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES comment the line!

106 service mysqld restart

107 mysql-uroot-p < extmail.sql

108 mysql-uroot-p < init.sql

109 mysql-uroot-p to check whether to import

110 cd / var/www/extsuite/extman/docs/

111 cp mysql_virtual_* / etc/postfix/

112 mkdir / tmp/extman

113chown-R postfix.postfix / tmp/extman/

114 cd ~

115 service postfix restart

116 vi / etc/init.d/postfix

It's too long. For details, see: http://mysky0708.blog.51cto.com/474802/1925221

117 chmod + x / etc/init.d/postfix

118 chkconfig-add postfix

119 chkconfig postfix on

120 service postfix start

121 service dovecot start

122 ss-tnluo | grep: 25

123 ps aux | grep dovecot

125 service saslauthd start

126 ps aux | grep saslauthd

The following are the test steps, very important!

127 / usr/local/courier-authlib/sbin/authtest-s login postmaster@extmail.org extmail

128 mkdir / var/mailbox

129 chown-R postfix.postfix / var/mailbox/

130 printf "postmaster@extmail.org" | openssl base64

131printf "extmail" | openssl base64

132 telnet localhost 25

Trying:: 1...

Telnet: connect to address:: 1: Connection refused

Trying 127.0.0.1...

Connected to localhost.

Escape character is'^]'.

220 mail.daen.com ESMTP Postfix

Auth login

334 VXNlcm5hbWU6

CG9zdG1hc3RlckBleHRtYWlsLm9yZw==

334 UGFzc3dvcmQ6

ZXh0bWFpbA==

2352.7.0 Authentication successful / / successful

Quit

221 2.0.0 Bye

Connection closed by foreign host.

133 vi / var/www/extsuite/extmail/dispatch-init

SU_UID=postfix

SU_GID=postfix

134 / var/www/extsuite/extmail/dispatch-init start

Starting extmail FCGI server...

135 / var/www/extsuite/extman/daemon/cmdserver-v-d

Loaded ok

136 vi / etc/nginx/conf.d/extmail.conf

Server {

Listen 8080

Server_name mail.everyoo.com

Index index.html index.htm index.php index.cgi

Root / var/www/extsuite/extmail/html/

Location / extmail/cgi/ {

Fastcgi_pass 127.0.0.1:8888

Fastcgi_index index.cgi

Fastcgi_param SCRIPT_FILENAME / var/www/extsuite/extmail/cgi/$fastcgi_script_name

Include fcgi.conf

}

Location / extmail/ {

Alias / var/www/extsuite/extmail/html/

}

Location / extman/cgi/ {

Fastcgi_pass 127.0.0.1:8888

Fastcgi_index index.cgi

Fastcgi_param SCRIPT_FILENAME / var/www/extsuite/extman/cgi/$fastcgi_script_name

Include fcgi.conf

}

Location / extman/ {

Alias / var/www/extsuite/extman/html/

}

Access_log / var/log/extmail_access.log

}

137 vi / etc/nginx/fcgi.conf

Fastcgi_param GATEWAY_INTERFACE CGI/1.1

Fastcgi_param SERVER_SOFTWARE nginx

Fastcgi_param QUERY_STRING $query_string

Fastcgi_param REQUEST_METHOD $request_method

Fastcgi_param CONTENT_TYPE $content_type

Fastcgi_param CONTENT_LENGTH $content_length

Fastcgi_param SCRIPT_NAME $fastcgi_script_name

Fastcgi_param REQUEST_URI $request_uri

Fastcgi_param DOCUMENT_ROOT $document_root

Fastcgi_param SERVER_PROTOCOL $server_protocol

Fastcgi_param REMOTE_ADDR $remote_addr

Fastcgi_param REMOTE_PORT $remote_port

Fastcgi_param SERVER_ADDR $server_addr

Fastcgi_param SERVER_PORT $server_port

Fastcgi_param SERVER_NAME $server_name

138wget http://www.cpan.org/authors/id/M/MH/MHARNISCH/Unix-Syslog-1.1.tar.gz

If this software is not installed, it will prompt unix::syslog not found,pleases install it first!

139 tar xf Unix-Syslog-1.1.tar.gz

141 cd Unix-Syslog-1.1

142 perl Makefile.PL

143make & & make install

144 make install

145 setenforce 0

146 systemctl stop firewalld

147 service nginx start

148 service nginx status

Login address test: extman login account is root@extmail.org password is extmail*123*

149 cd ~

After testing, other functions are available, only the log graphics are not displayed, the solution is as follows

152 yum-y install perl-Time-HiRes perl-Time-HiRes-Value perl-File-Tail rrdtool rrdtool-perl

155 yum install libpng

157 / var/www/extsuite/extman/addon/mailgraph_ext/mailgraph-init start failed to start, and the solution is as follows:

158 mkdir / usr/local/mailgraph_ext

159 cp / var/www/extsuite/extman/addon/mailgraph_ext/mailgraph_ext.pl / usr/local/mailgraph_ext/

160 cp / var/www/extsuite/extman/addon/mailgraph_ext/qmonitor.pl / usr/local/mailgraph_ext/

161 / var/www/extsuite/extman/addon/mailgraph_ext/mailgraph-init start

164B / var/www/extsuite/extman/addon/mailgraph_ext/qmonitor.pl start &

OK!! Refresh the test again! Then configure virtual user rights assignment management!

I referred to the following two articles:

Http://blog.csdn.net/skykingf/article/details/45478651

Http://charlie928.blog.51cto.com/3741218/1433169

Http://lxsym.blog.51cto.com/1364623/498913/

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report