First, the system environment
Reference:
http://ywzhou.blog.51cto.com/2785388/1578211
1. Local Settings
Centos-6.5-x86_64-bin-dvd1.iso
Centos-6.5-x86_64-bin-dvd2.iso
Host Name: mail.yourmail.com
IP Address: eth0 = 10.188.1.83
2. Install the Software
(1) Compilation environment
[email protected] ~]# Yum install gcc gcc-c++
(2) Dependent software
[email protected] ~]# yum install OpenSSL openssl-devel cyrus-sasl Libtool-ltdl libtool-ltdl-devel db4 db4-devel expect E Xpect-devel Pcre Pcre-devel
(3) Lamp environment
[[email protected] ~]# yum install httpd httpd-devel mysql mysql-server mysql-devel php php-mysql
3. Set up a firewall
[[email protected] ~]# iptables-i input-p tcp-m multiport--dport 21,80-j accept[[email protected] ~]# service iptable s Save
Second, installation Postfix
Postfix is an MTA (mail transfer agent) software developed by Wietse Venema under the GPL of IBM to replace SendMail, which is faster, more robust, more flexible, more secure, and more compatible than SendMail.
Official website: http://www.postfix.org/
1. Installation
[[email protected] ~]# Rpm-aq|grep postfixpostfix-2.6.6-2.2.el6_1.x86_64#centos6.5 has been installed by default version 2.6.6, then upgrade: [Email Protected] ~]# Yum update postfixpostfix-2.6.6-6.el6_5.x86_64
CentOS 7 has a built-in version of 2.10.1, and for the time being no research has been done to improve it, and will release 7 builds in the future.
2. Configuration
[[email protected] ~]# cd /etc/postfix[[email protected] postfix]# postconf -n > /etc/postfix/main2.cf[[email protected] postfix]# mv main.cf Main.cf.old[[email protected] postfix]# mv main2.cf main.cf[[email protected] postfix]# vi main.cf# comment out the following line, otherwise the 25 port can only be connected locally # inet_interfaces = localhost# Add the following basic configuration # host Settings mynetworks = 127.0.0.1 myhostname = mail.yourmail.com mydestination = $myhostname, localhost. $mydomain, localhost # Display connection information mail_name = postfix - by yourmail.com smtpd_banner = $myhostname esmtp $mail _name # Immediate Response smtpd_error_sleep_time = 0s # message size and mailbox size limit 10M, 2g message_size_limit = 10485760 mailbox_size_limit = 2097152000 show_user_ Unknown_table_name = no # Queue Timeout limit 1 days bounce_queue_lifetime = 1d maximal_queue_ lifetime = 1d
3, start
[[email protected] postfix]# service postfix start[[email protected] Postfix]# chkconfig postfix on[[email protected] postfix]# ps aux|grep postfixroot 3070 0.0 0.3 81292 3436 ? Ss 13:59 0:00 /usr/libexec/postfix/masterpostfix 3072 0.0 0.3 81372 3392 ? s 13:59 0:00 pickup -l -t fifo -upostfix 3073 0.0 0.3 81440 3440 ? s 13:59 0:00 qmgr -l -t fifo -uroot 3124 0.0 0.0 103248 880 pts/1 s+ 14:02 0:00 grep postfix[[email protected] postfix]# netstat -tlnp|grep 25 tcp 0 0 127.0.0.1:25 0.0.0.0:* listen 3070/ master tcp 0 0 ::1:25 :::* listen 3070/master
4. Check
[[email protected] postfix]# postfix check# No error return indicates the configuration is correct [[email protected] postfix]# postconf-a# appears Cyrus indicates that the Cyrus authentication user can be supported [[email protected] postfix]# postconf-m# appears MySQL indicates that MySQL storage account can be supported
5. Set up a firewall
[[email protected] ~]# iptables-i input-p TCP--dport 25-j accept[[email protected] ~]# service Iptables Save
Third, installation Courier-authlib
Courier-authlib is a data authentication library responsible for Courier-imap,maildrop certification.
Official website: http://www.courier-mta.org
1. Installation
Http://www.courier-mta.org/download.html#authlib
The following packages are required for the download page:
courier-authlib-0.66.1.tar.bz2courier-unicode-1.1.tar.bz2courier-imap-4.15.1.tar.bz2maildrop-2.7.2.tar.bz2
I have uploaded to the Download Center for free Download:
http://down.51cto.com/data/1955875
Install Courier-authlib:
#先查看下uid 1000 has used [[email protected] ~]# cat /etc/passwd#] to create a user when installing the system, taking up 1000 So use 1002[[email protected] ~]# groupadd vmail -g 1002 [[email protected] ~]# useradd vmail -u 1002 -g 1002 -d /home/domains[[ email protected] ~]# cd /usr/local/src[[email protected] src]# wget http://cznic.dl.sourceforge.net/project/courier/authlib/0.66.1/courier-authlib-0.66.1.tar.bz2[[email Protected] src]# tar -jxf courier-authlib-0.66.1.tar.bz2 [[email protected] src]# cd courier-authlib-0.66.1 [[email protected] courier-authlib-0.66.1]# ./configure --with-mysql-libs --with-mysql-includes --with-authmysql -- with-authmysql=yes --with-mailuser=vmail --with-mailgroup=vmail[[email protected] Courier-authlib-0.66.1]# make [[email protected] courier-authlib-0.66.1]# make install [[email protected] courier-authlib-0.66.1 ]# make install-configure
Description: Error may occur at compile time, basically because some packages are not installed, Yum is loaded and recompiled, so it is recommended to first install the dependent software according to the "system environment" above.
The MySQL parameter can also specify an absolute path:
--with-mysql-libs=/usr/local/mysql/lib/mysql\
--with-mysql-includes=/usr/local/mysql/include/mysql/\
2. Configuration
[[email protected] courier-authlib-0.66.1]# cd /usr/local/etc/authlib[[email protected] authlib]# vi authmysqlrcmysql_server localhost MYSQL_OPT 0MYSQL_DATABASE extmailmysql_user_table mailbox mysql_crypt_pwfield password MYSQL_UID_FIELD 1002 mysql_gid_field 1002 mysql_login_field usernameMYSQL_HOME_FIELD homedirMYSQL_NAME_FIELD nameMYSQL_MAILDIR_FIELD maildirmysql_quota_field quotamysql_select_clause Select username,password, "",uidnumber,gidnumber, concat ('/home/ domains/', Homedir), concat ('/home/domains/', Maildir), quota, name FROM mailbox where username = ' $ (local_part) @$ (domain) ' [[email protected] authlib]# vi authdaemonrcauthmodulelist= "Authmysql" authmodulelistorig= "Authmysql" [email protected] authlib]# ln -s /usr/local/etc/authlib /etc/authlib
3, start
[[email protected] authlib]# /usr/local/sbin/authdaemond start[[email protected] authlib]# ps aux|grep authdaemondroot 9954 0.0 0.0 4308 440 ? s 15:31 0:00 /usr/local/sbin/courierlogger -pid=/usr/ local/var/spool/authdaemon/pid -start /usr/local/libexec/courier-authlib/authdaemondroot 9955 0.0 0.2 66500 2720 ? s 15:31 0:00 /usr/local/ libexec/courier-authlib/authdaemondroot 9956 0.0 0.0 66500 748 ? S 15:31 0:00 /usr/local/libexec/courier-authlib/authdaemondroot 9957 0.0 0.0 66500 748 ? s 15:31 0:00 /usr/local/libexec/courier-authlib /authdaemondroot 9958 0.0 0.0 66500 748 ? S 15:31 0:00 /usr/local/libexec/courier-authlib/authdaemondroot 9959 0.0 0.0 66500 748 ? s 15:31 0:00 /usr/local/libexec/courier-authlib /authdaemondroot 9960 0.0 0.0 66500 748 ? s 15:31 0:00 /usr/ local/libexec/courier-authlib/authdaemondroot 10024 0.0 0.0 112656 980 pts/1 S+ 15:31 0:00 grep --color=auto authdaemond[[email protected] authlib]# echo " /usr/local/sbin/authdaemond start " >> /etc/rc.d/rc.local
Iv. installation of Maildrop
Maildrop is a local mail delivery agent (MDA) that supports filtering (/ETC/MAILDROPRC), posting, and disk quota (Quota) capabilities.
Maildrop with RPM package installation will automatically create VUser users and Vgroup user groups, specifically for the storage of mail; Using source installation requires manually creating users and user groups with IDs greater than 1000, which is the user Vmail (1002) and group Vmail created above (1002) , and home directory/home/domain is the mail storage directory, the next section installs webmail will speak.
1, installation Courier-unicode
The character set library file, equivalent to the RPM installation of the Courier-authlib-devel package, does not install this will result in compiling the maildrop times wrong:
Configure:error:The Courier Unicode Library appears is installed. Need to install a separate development subpackage, in addition to the main package
[Email protected] ~]# cd/usr/local/src[[email protected] src]# wget http://jaist.dl.sourceforge.net/project/courier/ Courier-unicode/1.1/courier-unicode-1.1.tar.bz2[[email protected] src]# tar-jxf Courier-unicode-1.1.tar.bz2[[email Protected] src]# CD Courier-unicode-1.1[[email protected] courier-unicode-1.1]#./configure[[email protected] courier-unicode-1.1]# make && make install
2, Installation Maildrop
[Email protected] ~]# cd/usr/local/src[[email protected] src]# wget http://jaist.dl.sourceforge.net/project/courier/ Maildrop/2.7.2/maildrop-2.7.2.tar.bz2[[email protected] src]# tar-jxf maildrop-2.7.2.tar.bz2[[email protected] src]# CD Maildrop-2.7.2[[email protected] maildrop-2.7.2]#./configure--enable-maildirquota--enable-maildrop-uid=1002-- enable-maildrop-gid=1002--with-trashquota[[email protected] maildrop-2.7.2]# Make[[email protected] maildrop-2.7.2] # make Install
3. Configuration
[Email protected] maildrop-2.7.2]# vi/etc/postfix/master.cfmaildrop unix-n N-- Pipe Flags=drhu user=vmail argv=maildrop-w 90-d ${user}@${nexthop} ${recipient} ${user} ${extension} {nexthop}
[[email protected] maildrop-2.7.2]# vi/etc/postfix/main.cf# control maildrop processing only one message at a time Maildrop_destination_recipient_ Limit = 1
Description: User Vmail and group Vmail will be accustomed to the entire mail system, be sure to remember their name Vmail and ID number 1002, if not the same as set up in this article, please modify it to your own when compiling and configuring.
Conclusion: The basic structure of the mail system is set up, the MTA and MDA are in the background, and the next section will build the foreground webmail.
This article is from the "Moon Ching Xing Fei" blog, please be sure to keep this source http://ywzhou.blog.51cto.com/2785388/1589108
Postfix Basic Installation (ii): Install Postfix backstage