Fully installation of Postfix mail systems (1)

xiaoxiao2021-03-06  110

POSTFIX mail system completely installed (Postfix Mysql Cyrus-Sasl Quota Courier-IMAP SQWEBMAIL or IGENUS) (2003-06-23 14:56:00)

This article mainly discusses the installation of source code, for PostFix SASL, Postfix2 SASL2, respectively, and the same configuration files are the same. Modify History: 2003.05.05 Create a document. 2003.05.27 Fix the QUOTA (disk limit) problem with PostFix2.0 version, correct the problem of Postfix self-start script error prompt. 2003.05.29 Add a WebMail section to use SQWwebmail (English). 2003.05.31 Fix the quota display problem in SQWwebmail, change the SQWwebmail parameter, configure. 2003.06.18 Add WebMail second part and use IGENUS (Chinese). 2003.06.23 Add a MySQL self-start script, providing IGENUS_DOCN.TAR.GZ download.

Download the following procedures from the Internet, processes as follows: 1, mysql-3.23.55.tar.gz2, cyrus-sasl-1.5.28.tar.gz (SASL-1.5.28-LDAP-SSL-Filter- Mysql-patch.tgz) or cyrus-sasl-2.1.12.tar.gz, 3, PAM_MYSQL-0.4.7.tar.gz (using this package under Linux) 4, postfix-1.1.11.tar.gz (Postfix -1.1.11_quota_mAildirsize.patch.gz) or postfix-2.0.10.tar.gz (postfix-2.0.10.patch.gz) 5, Courier-IMAP-1.7.1.tar.bz2 (also required Expect.tar .GZ, TCL, GMAKE 6, SQWWEBMAIL-3.5.1.tar.bz27, iGenus_Docn.tar.gz (this version is modified by IGENUS_2_20030311_SNAP) MYSQL-3.23.551, add mysql user group and mysql user Server # pw groupadd mysqlserver # pw useradd mysql -g mysql -s / nonexistent2, configure installation server # tar zxvf mysql-3.23.55.tar.gzserver # cd mysql-3.23.55server # ./configure --PREfix = / usr / local / mysql --with-low-memory / - with-charset = gb2312 --without-debugserver # makeserver # make installserver # scripts / mysql_install_dbserver # chown -R root / usr / local / mysqlserver # chown -R mysql / usr / local / mysql / varserver # chgrp -r mysql / usr / local / mysqlserver # cp support-files / my-medium.cnf /etc/my.cnfserver# ln -s / usr / local / mysql / bin / safe_mysqld / usr / Local / bin / safe_mysqldserver # ln -s / usr / local / mysql / bin / mysqladmin / usr / local / bin / mysqladminserver # ln -s / usr / local / mysql / bin / mysql / usr / local / bin / mysqlserver # LN -S / usr / local / mysql / lib / mysql / usr / local / lib / mysql3, editing user database mail.sql example: mail.sql4, setting self-start: Server # edit / usr / local / etc / rc. D / mysqld.sh example: mysqld.shserver # chmod 755 /usr/local/etc/rc.d/mysqld.sh1, install cyrus-sals1.1, install cyrus-sasl-1.5.28.tar.gzserver # tar zxvf Cyrus-sasl-1.5.28.tar.gz Server # tar zxvf sasl-1.5.28-ldap-ssl-filter-mysql-patch.tgzserver # cp ldap-mysql_sasl-1.5.28 / sasl-ldap mysql.patch cyrus SASL-1.5.28 Server # CD Cyrus-SASL-1.5.28 Server # patch -p1

MySQL.PATCHSERVER # ./configure --disable-sample --disable-pwcheck --disable-cram / - disable-digest --disable-krb4 --disable-gssapi --disable-anon / - with-saslauthd = / var / run / saslauthd --enable-plain --enable-login / - with-mysql = / usr / local / mysql / lib / mysql --oldincludedir = / usr / local / mysql / include / mysqlserver # MAKESERVER # Make Install Server # ln -s / usr / local / lib / sasl /usr/lib/SASL1.2, install cyrus-sasl-2.1.12server # tar -zxvf cyrus-sasl-2.1.12.tar.gz Server # CD Cyrus- SASL-2.1.12Server # ./configure --disable-sample --disable-pwcheck --disable-cram / - disable-digest --disable-krb4 --disable-gssapi --disable-anon / - with- Saslauthd = / var / run / saslauthd --enable-plain --enable-loginserver # Makeserver # make installserver # ln -s / usr / local / lib / sasl2 / usr / lib / sasl22, configuring SASL's lib library Server # Edit /etc/default/rc.conf (in ldconfig_paths = "/ usr / loca / lib / sasl or / usr / local / lib / sasl2") Server # shutdown -r now Effective) 3, run Saslauthd (if you use PAM direct authentication, this step can be omitted) Saslauthd.shserver # mkdir / var / run / saslauthdserver # Edit /us/local/etc/rc.d/saslauthd.shserver# chmod 755 /usr/local/etc/rc.d/saslauthd.sh4, prepare Postfix authentication configuration file a) Using PAM Direct authentication: Server # echo pwcheck_method: Pam> /usr/local/lib/sasl/smtpd.conf or: Server # echo pwcheck_method: Pam> /usr/local/lib/sasl2/smtpd.confb) Using Saslauthd call PAM authentication: Server # echo pwcheck_method: saslauthd> / USR / lib / sasl / smtpd.conf or: server # echo pwcheck_method: saslauthd> /usr/lib/sasl2/smtpd.conf installation PAM_MYSQL-0.4.7 (because the source code installation compile can not pass, so use FreeBSD4.7 comes with Mounting package) 1, install server # pkg_add pam_mysql-0.4.7.tgzserver # cp /usr/local/lib/pam_mysql.so / usr / lib / 2, configure Pam.conf call mysql support SASL certification Server # edit / etc /Pam.conf Adds the following code to POP3 and IMAP #):

smtp auth sufficient pam_mysql.so user = postfix passwd = liubinw host = localhost db = mail table = virtual_users usercolumn = id passwdcolumn = password crypt = 1smtp account required pam_mysql.so user = postfix passwd = liubinw host = localhost db = mail table = virtual_users UserColumn = ID password crypt = 1 (Note: Password uses Crypt encryption, if you use the plain text password Cyrpt = 0, if you use Password () encrypted CRYPT = 2) Install PostFix1, stop SendmailServer # mv / usr / bin / newaliases / usr /bin/newaliases.offserver# mv / usr / bin / mailq /usr/bin/mailq.offserver# mv / usr / sbin / sendmail /usr/sbin/sendmail.offserver# mv /etc/rc.sendmail / etc / sendmail .Offserver # edit /etc/rc.conf (in sendmail = "yes", add #) 2, add postfix users Server # PW groupadd postfix -g 2003Server # PW GroupAdd PostDrop -g 2004 Server # PW UserAdd Postfix -u 2003 -g 2003 -D / dev / null -s / nologin 3, Installation 3.1, install postfix-1.1.11.tar.gz Server # tar zxvf postfix-1.1.11.tar.gz Server # gzip -d postfix-1.1.11_quota_mAildirsize.patch. GZSERVER # cp postfix-1.1.11_quota_mailsize.patch postfix-1.1.11server # cd postfix-1.1.11server # patch -p1

-Duse_sasl_auth -dhas_mysql -i / usr / local / mysql / include / mysql -i / usr / local / include / sasl '' auxlibs = -L / usr / local / lib / -l / usr / local / mysql / lib / mysql -lmysqlclient -lsasl2 -lz -lm'Server # Makeserver # make install (for the first installation, if prompted during the installation, use / TMP when prompted to select TMP) Server # make Upgrade (upgrade old version Use this command) 4, configure server # echo 'postfix: root' >> / etc / aliasersserver # / usr / bin / newaliases (Note: If postfix can't open OpieKeys file: # chown postfix: postfix / etc / opiekeys ) A) Edit Modification /etc/posftix/main.cf Example: main.cf # ==============================MyhostName = DOCN.NANKAI.EDU.CNMYDOMAIN = nankai.edu.cnhome_mailbox = Maildir / mydestination = $ myhostname, $ mydomain, $ transport_mapslocal_recipient_maps = empty mailbox_command = / usr / lib / courier-imap / bin / deliverquota -w 90 ~ / Maildir # ======= MYSQL ============= transport_maps = mysql: /etc/postfix/transport.cf virtual_gid_maps = mysql: /etc/postfix/gids.cfvirtual_mailbox_base = / var / mailvirtual_mailbox_maps = mysql: / etc / postfix /MYSQL_VIRTUAL.CFVIRTUAL_MAPS = mysql: /etc/postfix/mysql.aliases.cfvirtual_uid_maps = m ysql: /etc/postfix/uids.cf # ======= Quota ============ message_size_limit = 2097152 // limit the size of each e-mail 2MBvirtual_mailbox_limit_inbox = novirtual_mailbox_limit_maps = mysql: / etc / postfix / mailboxsize-mysql.cfvirtual_mailbox_limit_override = yesvirtual_maildir_extended = yesvirtual_create_maildirsize = yesvirtual_mailbox_limit = 10485760 // total mailbox size of 10MB # ====== SASL =

=============== smtpd_sasl_auth_enable = yessmtpd_sasl_security_options = noanonymousbroken_sasl_auth_clients = yessmtpd_recipient_restrictions = permit_sasl_authenticated permit_auth_destinatio reject # smtpd_sasl_local_domain = $ mydomain smtpd_client_restrictions = permit_sasl_authenticatedB) is arranged to confirm /etc/postfix/master.cf following examples : Master.cfvirtual UNIX - Nn - - - Virtualc "Edit /etc/posftix/Transport.cf Sample: Transport.cfd) Edit /etc/postfix/gids.cf Sample: gids.cfe) Edit /etc/postfix/uids.cf Example: uids.cff) Edit /etc/posftix/mysql_virtual.cf Example: mysql_virtual.cfg) Edit /etc/postfix/mysql.aliases.cf Example: mysql.Aliases.cfh Edit / etc / postfix / mailboxsize-mysql. CF Example: MailboxSize-mysql.cf5, set self-launch server # ed/postfix-server.sh example: postfix-server.shserver # chmod 755 / usr / local / etc / rc. D / postfix-server.sh Installing Expect.tar.gz (Need TCL) Server # pkg_add tcl-versionServer # tar zxvf expect.tar.gz Server # ./configure --enable-threads --with- TCL = / usr / local / lib / tcl8.3 /--with-tclinclude=/usr/local/include/tcl8.3 server # makeserver # make install installation Courier-imap-1.7.1 (need gmake, expect) 1, installed server # pkg_add gmake-versionserver # pw useradd docn -g wheel (the software MUST run the configure script as normal user, not root ) Server $ bunzip2 court - imap-1.7.1.tar.bz2server $ tar xvf coourier-iMap-1.7.1.tarserver $ cd company-imap-1.7.1server # ./configure --without-ipv6 --enable-unicode / - Enable-Workarounds-for-imap-client-bugs / - with-mysql-libs = / usr / local / mysql / lib / mysql / - with-mysql-incrudes =

/ Usr / local / mysql / include / mysqlserver $ gmakeserver # su rootserver # gmake installserver # gmake install-configure2, the configuration editor to modify / usr / lib / courier-imap / etc / authmysqlrc Example: authmysqlrcMYSQL_SERVER localhostMYSQL_USERNAME courierMYSQL_PASSWORD liubinwMYSQL_SOCKET / tmp / mysql. sockMYSQL_PORT 3306MYSQL_OPT 0MYSQL_DATABASE mailMYSQL_USER_TABLE virtual_usersMYSQL_CRYPT_PWFIELD passwordMYSQL_UID_FIELD uidMYSQL_GID_FIELD gidMYSQL_LOGIN_FIELD idMYSQL_HOME_FIELD homeMYSQL_NAME_FIELD nameMYSQL_MAILDIR_FIELD maildirMYSQL_QUOTA_FIELD quotaMYSQL_WHERE_CLAUSE imapok = 1 editorial changes / usr / lib / courier-imap / etc / authdaemonrc example: authdaemonrcversion = "authdaemond.mysql" 3, is provided from the start server # cd / usr / Local / etc / rc.dserver # ln-s /usr/lib/courier-imap/libexec/iMapd.rc imapd.shserver # ln -s /usr/lib/courier-imap/libexec/pop3d.rc pop3d.shserver # Chmod 755 imapd.shserver # chmod 755 pop3d.shnow! Restart the server, mail service can be run automatically! Now we start testing: 1, set users: server # mysqlmysql> Use mail; you can see mysql> show tables; ---------------- | TABLES_MAIL | ---------------- | Aliases || Transport || Virtual_Users | ---------------- MySQL> Desc aliases; ------- -------------- ---- ----- ------- --- ---- | Field | TYPE | NULL | Key | Default | Extra | ------- ---------- ------ - ---- --------- ----- | Alias ​​| VARCHAR (255) | | Pri | | || RCPT | VARCHAR (255) | YES | | Null | | ------- -------------- ---- ----- ------- --- ---- MySQL> Insert Aliases Values ​​('PostMaster@nankai.edu.cn ',' DOCN@nankai.edu.cn '); MySQL> Insert Aliaz Values ​​(' Postmaster @

Freebsd.net ',' DOCN@freebse.net '); mysql> select * from aliases; ------------------------ - ------------------- | Alias ​​| RCPT | ------------------------ - -------------------- | Postmaster@nankai.edu.cn | DOCN@nankai.edu.cn | | Postmaster@freebsd.net | DOCN @ Freebse.net | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - Mysql> Desc Transport; ---------- ---------- ------ --- ---- ----- ------- | Field | Type | NULL | Key | Default | Extra | ---------- ------------------------ - ------ ----- ------- ------- | Domain | char (128) | | | || Transport | char (128) | | | | | ---------- ---------- ------ --- ---- ----- ----- mysql> Insert Transport Values ​​('Nankai.edu.cn', 'Virtual:'); MySQL> Insert Transport Values ​​('FreeBSD.NET', 'Virtual:' ); mysql> select * from transport; ------------- --------- | Domain | Transport | -------- --------- ----------- | Nankai.edu.cn | Virtual: | | FreeBSD.NET | Virtual: | --------------- --------- mysql> desc virtual_users; ----------- -------------------------------- --- ------------- | Field | TYPE | NULL | Key | Default | Extra | ---------- ---------- ----------- ------ ----- ------------------------ -

| Unique_ID | INT (32) Unsigned | | MUL | NULL | Auto_INCREMENT || ID | CHAR (128) | | Pri | | || Password | Char (128) | Yes | | NULL | || Uid | Int (10) Unsigned | Yes | | 104 || GID | INT (10) Unsigned | Yes | | 104 | || Home | Char (255) | Yes | | Null | || MAILDIR | CHAR (255) | Yes | | NULL | || DATE_ADD | DATE | YES | | NULL | || Time_Add | Time | Yes | | Null | || Domain | Char (128) | Yes | | Null | || Name | Char (255) | Yes | | NULL | || iMapok | Tinyint (3) Unsigned | Yes | | 1 | || quota | char (255) | Yes | | 10485760 | | ----------- -------------------------------- --- ------------- mysql> Insert Into Virtual_Users mysql> (id, home, password, maildir, date_add, time_add, domain, name) mysql> values ​​('DOCN@nankai.edu.cn ',' / var / mail / ', encrypt (' liubinw '), mysql>' nankai.edu.cn/docn/mails' ,'2003-04-23' ,','Nankai .edu.cn ',' DOCN '); MySQL> Insert Into Virtual_Usersmysql> (ID, Home, Password, MAILD, DATE_ADD, TIME_ADD, DOMAIN, NAME) MySQL> VALUES (' liubinw@freebsd.net ',' / var / Mail / ', Encrypt (' Liubinw '), MySQL>' FreeBSD.Net/Liubinw/mAildir/' ,'2003-04-23' ,'01:18:24' ,'freebsd.net' ,'liubinw '

); mysql> quit2, set users' directory and privilege: Server # mkdir -p /var/mail/nankai.edu.cn/docnserver# mkdir -p /var/mail/freebsd.net/docnserver# CD / USR / lib / Courier-Imap / BinServer # maildirmake /var/mail/nankai.edu.cn/docn/mailsrverver# maildirmake -q 5000000s /var/mail/nankai.edu.cn/docn/mAildir (if you use iGenus, this command is not required !) Server # maildirMake /var/mail/freebsd.net/mail/freebsd.net/mail/mailsrverver# maildirmake -q 5000000s /var/mail/freebsd.net/mail/freebsd.net/mail/mails (if you use IGENUS, this command is not required!) Server # chmod -r 700 /VAR/mail/nankai.edu.cn/server# chmod -r 700 /var/mail/freebsd.net/server# chown -r postfix: postfix / var/mail/nankai.edu.cn server # chown -r Postfix: postfix /var/mail/freebsd.net is complete, here only two virtual domains, you can set several virtual domains, such as: mail.com3, user login test: Server # telnet 0 25Trying 0.0. 0.0 ... Connected to 0.Escape character is '^]'. 220 server.nankai.edu.cn ESMTP Postfixehlo server250-server.nankai.edu.cn250-PIPELINING250-SIZE 10240000250-VRFY250-ETRN250-AUTH LOGIN PLAIN OTP250- Auth = login plain otp250-xverp250 8bitmimeauth login334 vxnlcm5hbwu6zg9jbkbuyw5rywk uZWR1LmNu (This user name id: docn@nankai.edu.cn) 334 UGFzc3dvcmQ6bGl1Ymludw == (this is the user password password: liubinw). 235 Authentication successful (OK, Postfix successful login) quit221 ByeConnection closed by foreign host server # telnet 0 110TRYING 0.0.0.0 ... connection to 0.escape character docn@nankai.edu.cn ok password required. (OK, POP login success) Quit Ok Bye-bye.connection Closed by Foreign Host. You can also test any other mail client program, such as Foxmail, Outlook Express, and more.

Install SQWWebmail-3.5.1 (Note: User: DOCN) 1, install Server $ bunzip2 sqwebmail-3.5.1.tar.bz2server $ tar xvf sqwebmail-3.5.1.tarserver $ CD SQWWwebmail-3.5.1 Server $ ./configure - -prefix = / usr / local / share / webmail / - enable-imagedir = / usr / local / apache / htdocs / webmails --enable-imageurl = / webmails / - enable-cgibindir = / usr / local / apache / CGI-BIN / Webmail3 --with-defaultlang = zh_cn / - enable-mimecharset = GB2312 --With-mysql-libs = / usr / local / mysql / lib / mysql / - with-mysql-incrudes = / usr / Local / mysql / incrude / mysql --enable-unicode / - with-cachedir = / var / webmail / cache --Nable-webpass = no --without-ospell / - with-maxmsgsize = 5242880 --enable-maxpurge = 7 --without-authldap / - aout-authvchkpw --without-authshadow --with-fcgi --Nable-https = auto / - with-cacheowner = postfix --with-maxformargsize = 2097152 --with-maxmsgsize = 5242880 / - enable-mimetypesserver $ cd sqwebmail / htmlserver $ make clone from = en-us to = zh_CNserver $ echo zh_CN zh_CN> zh_CN / LANGUAGE_PREFserver $ echo zh_CN> zh_CN / LOCALEserver $ echo gb2312> zh_CN / CHARSETserver $ cd .. / ..server $ ./configure --prefix = / usr / local / shape / webmail / - enable-imagedir = / usr / local / apache / htdocs / webmails --enable-imageurl = / webmails / - enable-cgibindir = / usr / local / apache / cgi-bin / webmail3 --with-defaultlang = zh_cn / - enable-mimecharset = gb2312 --with-mysql-libs = / usr / local / mysql / lib / mysql / - with -Mysql-includees = / usr / local / mysql / include / mysql --enable-unicode / - with-cache -nable-webpass = no --without-Ospell / - with- Maxmsgsize = 5242880 --enable-maxpurge = 7 --without-authldap / --without-authvchkpw --without-authshadow --with-fcgi --Nable-https = auto / - with-cacheowner =

postfix --with-maxformargsize = 2097152 --with-maxmsgsize = 5242880 / - enable-mimetypesserver $ gmake configure-checkserver $ gmakeserver $ suserver # gmake install-stripserver # gmake install-configure2, modify the configuration editor / usr / local / share / sqwebmail / authmysqlrc example: authmysqlrcMYSQL_SERVER localhostMYSQL_USERNAME 1 editorial changes / usr / local / share / sqwebmail / authdaemonrc exemplary courierMYSQL_PASSWORD liubinwMYSQL_SOCKET /tmp/mysql.sockMYSQL_PORT 3306MYSQL_OPT 0MYSQL_DATABASE mailMYSQL_USER_TABLE virtual_usersMYSQL_CRYPT_PWFIELD passwordMYSQL_UID_FIELD uidMYSQL_GID_FIELD gidMYSQL_LOGIN_FIELD idMYSQL_HOME_FIELD homeMYSQL_NAME_FIELD nameMYSQL_MAILDIR_FIELD maildirMYSQL_QUOTA_FIELD quotaMYSQL_WHERE_CLAUSE imapok =: authdaemonrcversion = "authdaemond. MySQL "3, set up SERVER # Edit /usr/local/tc/rc.d/authdeamond.sh Example: Authdaemond.sh Server # chmod 755 /usr/local/tc/rc.d/authdeamond.sh4, use: final Enter: http://www.nankai.edu.cn/cig-bin/webmail3/sqwebmail Install IGENUSIGENUS_2_20030311_SNAP (herein, the version modified by IGENUS_2_20030516_SNAP.TGZ) 1, Install: Server # CD / VAR / M AILSERVER # TAR ZXVF IGENUS_DOCN.TAR.GZSERVER # edit /usr/local/apache/conf/httpd.conf2, configuration: 1, group number, user number modified to: Group Postfix, User Postfix2, DocumentRoot "/ usr / local / apache / htdocs "modified as: DocumentRoot" / var / mail / webmail "3, config_inc.php modify the file $ CFG_BASEPATH =" / var / mail / webmail "; $ CFG_MYSQL_HOST = 'localhost'; $ CFG_MYSQL_USER = 'postfix'; $ CFG_MYSQL_PASS = 'liubinw'; (with the above password, you can modify it yourself) $ cfg_mysql_db = 'mail'; 3, use: In the last entered in the browser's URL: http://www.nankai.edu.cn4, the last description: The latest POSTFIX-2.0.12 is updated because the installation test is not passed, so it is recommended to use version 2.0.10.

转载请注明原文地址:https://www.9cbs.com/read-124695.html

New Post(0)