######################################## ### Postfix installation document ############
Set up Postfix + extmail in centos6.4
System Environment centos6.4 x64
1. Install mysql-5.0.60
Yum remove MySQL
Rm-F/etc/My. CNF
Groupadd MySQL
Useradd-G mysql-S/bin/false-M MySQL
Tar zxvf mysql-5.0.60.tar.gz
CD mysql-5.0.60
. /Configure -- prefix =/usr/local/MySQL -- enable-thread-safe-client -- enable-local-infile -- With-charset = GBK -- With-extra-charset = all -- with-low-memory
Make & make install & Echo "OK"
CP support-files/my-medium.cnf/etc/My. CNF
Chown-r MySQL/usr/local/MySQL/var
/Usr/local/MySQL/bin/mysql_install_db -- user = MySQL
CP support-files/MySQL. Server/etc/rc. d/init. d/mysqld
Chmod U + x/etc/init. d/mysqld
Chkconfig -- add mysqld
Chkconfig -- level 345 mysqld on
Service mysqld start
Ln-S/usr/local/MySQL/bin/*/usr/local/bin
Echo "/usr/local/MySQL/lib/MySQL">/etc/lD. So. conf
Ldconfig-V
2. Install httpd-2.2.20
Yum install OpenSSL-devel
Tar jxvf httpd-2.2.20.tar.bz2
CD httpd-2.2.20
. /Configure -- prefix =/usr/local/Apache -- sysconfdir =/etc/httpd -- enable-so -- enable-SSL --- enable-track-vars -- enable-Rewrite -- With-zlib -- enable-mod-shared = most -- enable-suexec -- With-suexec-caller = daemon -- With-suexec-docroot =/var/WWW
Make & make install & Echo "OK"
Echo "/usr/local/Apache/bin/apachectl start">/etc/rc. Local (the service starts automatically when the system starts)
3. Install php-5.2.17
Yum install curl-devel libjpeg-devel libpng-devel FreeType * patch libxml2
Ln-S/usr/lib64/libjpeg. So/usr/lib/
Ln-S/usr/lib64/LibPNG. So/usr/lib/
Tar-zvxf php-5.2.17.tar.gz
CD php-5.2.17
. /Configure -- prefix =/usr/local/PHP -- with-apxs2 =/usr/local/Apache/bin/apxs -- With-mysql =/usr/local/MySQL -- With-mysqli = /usr/local/MySQL/bin/mysql_config -- With-OpenSSL -- enable-FastCGI -- enable-mbstring -- enable-force-CGI-redirect -- enable-sockets -- With-curl -- -Gd -- With-zlib -- With-PNG-dir -- With-FreeType-dir -- With-JPEG-Dir
Make & make install & Echo "OK"
Cp php. ini-Dist/usr/local/PHP/lib/PHP. ini
Note: edit the Apache configuration file httpd. conf to support PHP in Apache.
VI/etc/httpd. conf
1. Add the following two rows:
Addtype application/X-httpd-PHP. php
Addtype application/X-httpd-PHP-source. PHPs
2. Locate directoryindex index.html
To:
Directoryindex index. php index.html
######################################## ####### The above are the underlying environment support for lamp installation.
4. Compile and install Postfix
1. Create a user and group that runs Postfix. Install cyrus-sasl
Yum install cyrus-sasl *
Groupadd-G 1000 Postfix
Groupadd-G 1200 postdrop
Useradd-u 1000-G postfix-G postdrop-m-S/sbin/nologin Postfix
2. decompress and release the source code package and merge the patch package.
Yum install dB *-devel
Tar zxvf postfix-2.8.3.tar.gz
Gunzip postfix-2.8.3-vda-ng.patch.gz
CD postfix-2.8.3
Patch-P1 <../postfix-2.8.3-vda-ng.patch
3. Compile and install the SDK.
Make makefiles 'ccargs =-dhas_mysql-I/usr/local/MySQL/include/MySQL-duse_sasl_auth-duse_cyrus_sasl-I/usr/include/SASL ''' auxlibs =-L/usr/ local/MySQL/lib/MySQL-lmysqlclient-LZ-lm-L/usr/lib64/sasl2-lsasl2'
Make & make install & Echo "OK"
4. Configure the Postfix service.
# Vim/etc/Postfix/Main. cf
Myhostname = mail.upchina.cn
Myorigin = $ mydomain
Mydomain = upchina.cn
Mydestination = $ myhostname, localhost. $ mydomain, localhost
Inet_interfaces = 192.168.1.83, 127.0.0.1
Home_mailbox = maildir/
# Postfix check
Postfix start
5. Add email users and Test
Groupadd mailusers
Useradd-S/sbin/nologin-G mailusers test1
Useradd-S/sbin/nologin-G mailusers Test2
Passwd test1
Passwd Test2
5. Create a virtual user database.
Tar zxvf extman-1.0.1.tar.gz
CD extman-0.2.5/docs/
Mysql-u root-P <extmail. SQL
Mysql-u root-P <init. SQL
Modify the Postfix configuration.
Vim/etc/Postfix/Main. Cf add
# Mydestination = $ myhostname, localhost. $ mydomain, comment out this line
Broken_sasl_auth_clients = Yes
Smtpd_recipient_restrictions = permit_mynetworks, permit_sasl_authenticated, reject_unauth_destination
Smtpd_sasl_auth_enable = Yes
Mynetworks = 127.0.0.1
Smtpd_sasl_local_domain = $ mydomain
Smtpd_sasl_security_options = noanonymous
Smtpd_sasl_application_name = smtpd
Smtpd_banner = welcome to our $ myhostname ESMTP, warning: Version Not available!
Virtual_mailbox_base =/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: 1000
Virtual_gid_maps = static: 1000
# Postfix reload
CP mysql_virtual _ */ETCC/Postfix/
5. Set User authentication.
Tar jxvf courier-authlib-0.60.2.tar.bz2
CD courier-authlib-0.60.2
. /Configure -- prefix =/usr/local/courier-authlib -- without-stdheaderdir -- With-authmysql -- With-RedHat -- With-mysql-libs =/usr/local/MySQL/lib /MySQL -- With-mysql-connector des =/usr/local/MySQL/include/MySQL
Make & make install
Make install-configure
Chmod 755/usr/local/courier-authlib/var/spool/authdaemon (Note that if this step does not exist, the authdaemon permission is denied .)
Modify the master configuration file of authdaemonrc. Only authmysql authentication methods are retained, and other methods are removed.
CD/usr/local/courier-authlib/etc/authlib/
Vim authdaemonrc
Authmodulelist = "authmysql"
Authmodulelistorig = "authmysql"
Daemons = 10
Debug_login = 2
Edit the authmysqlrc configuration file
# Vim authmysqlrc
Mysql_server localhost
Mysql_username extmail
Mysql_password extmail
Mysql_socket/tmp/MySQL. Sock
Mysql_port 3306
Mysql_opt 0
Mysql_database extmail
Mysql_user_table mailbox
Mysql_crypt_pwfield Password
Mysql_uid_field uidnumber
Mysql_gid_field gidnumber
Mysql_login_field Username
Mysql_home_field Concat ('/mailbox/', homedir)
Mysql_name_field name
Mysql_maildir_field Concat ('/mailbox/', maildir)
#
CP courier-authlib.sysvinit/etc/rc. d/init. d/courier-authlib
Chmod 755/etc/rc. d/init. d/courier-authlib
Chkconfig -- add courier-authlib
Chkconfig courier-authlib on
Echo "/usr/local/courier-authlib/lib/courier-authlib">/etc/lD. So. conf
Ldconfig
Service courier-authlib start
6. Install courier-imap
Tar jxvf courier-imap-4.1.0.tar.bz2
CD courier-imap-4.1.0
. /Configure -- prefix =/usr/local/courier-imap -- With-RedHat -- enable-Unicode -- disable-root-check -- With-trashquota -- without-ipv6 cppflags = '-I/usr /include/OpenSSL-I/usr/local/courier-authlib/include 'ldflags = '-L/usr/local/courier-authlib/lib/courier-authlib 'courierauthconfig =' /usr/local/courier-authlib/bin/courierauthconfig'
Make & make install & Echo "OK"
CP/usr/local/courier-imap/etc/imapd. Dist/usr/local/courier-imap/etc/imapd
CP/usr/local/courier-imap/etc/imapd-ssl.dist/usr/local/courier-imap/etc/imapd-SSL
CP/usr/local/courier-imap/etc/PoP3D. Dist/usr/local/courier-imap/etc/PoP3D
CP/usr/local/courier-imap/etc/pop3d-ssl.dist/usr/local/courier-imap/etc/pop3d-ssl
Configure courier-IMAP to provide users with the POP3 Service:
VI/usr/local/courier-imap/etc/PoP3D
#
Pop3dstart = Yes
Note: If you want to provide IMAP services for users, you must set "imapdstart = yes" in the "/usr/local/courier-imap/etc/imapd" file;
#
Mkdir/mailbox
Chown-r Postfix: Postfix/mailbox
CP courier-imap.sysvinit/etc/rc. d/init. d/courier-imapd
Chmod 755/etc/rc. d/init. d/courier-imapd
Chkconfig -- add courier-imapd
Chkconfig -- level 35 courier-imapd on
Service courier-imapd start
Modify Cyrus SASL settings.
Vim/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
#
Service saslauthd start
Create a virtual user's mailbox directory and adjust permissions.
Mkdir-P/mailbox/extmail.org/postmaster/maildir/
CD/mailbox/extmail.org/postmaster/maildir/
Chown-r Postfix: Postfix/mailbox
Test and verification.
/Usr/local/courier-authlib/sbin/authtest-s login [email protected] extmail
7. Use extmail and the management platform.
Install and configure extmail.
Tar zxvf extmail-1.0.5.tar.gz-C/var/WWW
CD/var/www/
Music extmail-1.0.5 extmail
CD extmail/
Chown-r Postfix: Postfix CGI
CP webmail. Cf. Default webmail. cf
Vim/var/www/extmail/webmail. cf
#
Sys_user_lang = zh_cn
Sys_maildir_base =/mailbox
Sys_mysql_user = extmail
Sys_mysql_pass = extmail
Sys_mysql_host = localhost
Sys_mysql_socket =/tmp/MySQL. Sock
Sys_config =/var/www/extmail
Sys_langdir =/var/www/extmail/lang
Sys_templdir =/var/www/extmail/html
Sys_mysql_table = mailbox
Sys_authlib_socket =/usr/local/courier-authlib/var/spool/authdaemon/socket
#
Chown Postfix: Postfix/var/www/extmail/cgi
8. Install extman
1. Installation and basic configuration
Tar zxvf extman-1.0.1tar.gz
Music extman-1.0.1/var/www/extman
Modify the configuration file to meet the needs of this example:
VI/var/www/extsuite/extman/webman. cf
#
Sys_maildir_base =/mailbox
Sys_config =/var/www/extmail
Sys_langdir =/var/www/extmail/lang
Sys_templdir =/var/www/extmail/html
Sys_mysql_user = webman
Sys_mysql_pass = webman
Sys_mysql_db = extmail
Sys_mysql_host = localhost
Sys_mysql_socket =/tmp/MySQL. Sock
Sys_lang = zh_cn
#
Chown Postfix: Postfix/var/www/extman/cgi
Mkdir/tmp/extman
Chown-r Postfix. Postfix/tmp/extman/
Adjust the configuration in the HTTP. conf file (add a virtual host) and restart the service program.
Vim/etc/httpd/HTTP. conf
#
User Postfix
Group Postfix
Include/etc/httpd/extra/httpd-vhosts.conf
#
Vim/etc/httpd/extra/ httpd-vhosts.conf
#
<Virtualhost *: 80>
Servername mail.upchina.cn
DocumentRoot/var/www/extmail/html/
ScriptAlias/extmail/cgi/var/www/extmail/cgi
Alias/extmail/var/www/extmail/html
ScriptAlias/extman/cgi/var/www/extman/cgi
Alias/extman/var/www/extman/html
</Virtualhost>
#
Apache start
The browser accesses mail.upchina.cn and adds a domain to extman. The default Administrator account is root and the password is extmail * 123 *. Then, add a user to test the password.
This article is from the "Technical Forum" blog, please be sure to keep this source http://wlb0110.blog.51cto.com/4217411/1562152
Centos install Postfix