ÔõÑùÉèÖúÍÖÎÀíLinuxÉϵÄÓʼþЧÀÍÆ÷
ÔõÑùÉèÖúÍÖÎÀíLinuxÉϵÄÓʼþЧÀÍÆ÷
Ëæ×Å»¥ÁªÍøµÄÆÕ¼°ºÍµç×ÓÓʼþµÄÆÕ±éÓ¦Ó㬴һ¸öÎȹ̡¢Çå¾²µÄÓʼþЧÀÍÆ÷³ÉΪÁËÐí¶àÆóÒµºÍСÎÒ˽È˵ÄÐèÇó¡£ÔÚLinux²Ù×÷ϵͳÉÏ£¬ÎÒÃÇ¿ÉÒÔʹÓÃһЩ¿ªÔ´µÄÈí¼þÀ´ÉèÖúÍÖÎÀíÓʼþЧÀÍÆ÷£¬ÈçPostfix¡¢DovecotµÈ¡£±¾ÎĽ«ÏÈÈÝÔõÑùÔÚLinuxϵͳÉÏÉèÖúÍÖÎÀíÓʼþЧÀÍÆ÷£¬²¢¸ø³öÏêϸµÄ´úÂëʾÀý¡£
×°ÖúÍÉèÖÃPostfix
PostfixÊÇÒ»¸öÊ¢ÐеÄÓʼþ´«ÊäÊðÀíÈí¼þ£¬Ëü¿ÉÒÔ½«Óʼþ´Ó·¢ËÍ·½×ª´ïµ½ÎüÊÕ·½¡£Ê×ÏÈ£¬ÎÒÃÇÐèҪװÖÃPostfix£º
sudo apt-get install postfix
µÇ¼ºó¸´ÖÆ
×°ÖÃÍê³Éºó£¬ÎÒÃÇÐèÒª¾ÙÐÐһЩÉèÖ᣷¿ªPostfixµÄÉèÖÃÎļþ/etc/postfix/main.cf£¬Æ¾Ö¤ÏÖʵÐèÇó¾ÙÐÐÏìÓ¦µÄÉèÖá£ÒÔÏÂÊÇһЩ³£¼ûµÄÉèÖÃʾÀý£º
# ÉèÖÃÖ÷»úÃûºÍÓòÃû myhostname = mail.example.com mydomain = example.com # ÉèÖÃÓʼþµÄ·¢ËͺÍÎüÊÕ·½·¨ inet_protocols = all mydestination = $myhostname, localhost.$mydomain, localhost, $mydomain mynetworks = 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128 # ÉèÖÃÓʼþµÄ´æ´¢Â·¾¶ home_mailbox = Maildir/ # ÆôÓÃSMTPS smtpd_tls_security_level = may smtpd_tls_cert_file = /etc/ssl/certs/ssl-cert-snakeoil.pem smtpd_tls_key_file = /etc/ssl/private/ssl-cert-snakeoil.key # ÉèÖÃÓʼþµÄÏÞÖÆ smtpd_relay_restrictions = permit_mynetworks permit_sasl_authenticated defer_unauth_destination
µÇ¼ºó¸´ÖÆ
ÉèÖÃÍê³Éºó£¬ÖØÆôPostfixЧÀÍ£º
sudo service postfix restart
µÇ¼ºó¸´ÖÆ
×°ÖúÍÉèÖÃDovecot
DovecotÊÇÒ»¸öIMAPºÍPOP3ÓʼþЧÀÍÆ÷Èí¼þ£¬ËüÈÏÕæÎüÊպʹ洢Óʼþ¡£ÎÒÃÇ¿ÉÒÔʹÓÃÒÔÏÂÏÂÁîÀ´×°ÖÃDovecot£º
sudo apt-get install dovecot
µÇ¼ºó¸´ÖÆ
×°ÖÃÍê³Éºó£¬ÎÒÃÇÐèÒª¾ÙÐÐһЩÉèÖ᣷¿ªDovecotµÄÉèÖÃÎļþ/etc/dovecot/dovecot.conf£¬Æ¾Ö¤ÏÖʵÐèÇó¾ÙÐÐÏìÓ¦µÄÉèÖá£ÒÔÏÂÊÇһЩ³£¼ûµÄÉèÖÃʾÀý£º
# ÉèÖÃÓʼþµÄ´æ´¢Â·¾¶ mail_location = maildir:~/Maildir # ÆôÓÃSSL/TLS ssl = required ssl_cert = </etc/ssl/certs/ssl-cert-snakeoil.pem ssl_key = </etc/ssl/private/ssl-cert-snakeoil.key # ÉèÖÃÈÏÖ¤·½·¨ auth_mechanisms = plain login # ÉèÖÃÓû§ºÍÃÜÂëµÄ´æ´¢·½·¨ passdb { driver = pam } userdb { driver = passwd } # ÆôÓÃIMAPºÍPOP3ÐÒé protocols = imap pop3
µÇ¼ºó¸´ÖÆ
ÉèÖÃÍê³Éºó£¬ÖØÆôDovecotЧÀÍ£º
sudo service dovecot restart
µÇ¼ºó¸´ÖÆ
ÉèÖÃÓû§ºÍÓÊÏä
ÓʼþЧÀÍÆ÷ÐèÒª¶ÔÓû§¾ÙÐÐÈÏÖ¤ºÍÊÚȨ£¬ÎÒÃÇ¿ÉÒÔʹÓÃÒÔÏÂÏÂÁîÀ´½¨ÉèÐÂÓû§ºÍÓÊÏ䣺
sudo adduser user1 cd /home/user1 maildirmake Maildir
µÇ¼ºó¸´ÖÆ
ÆäÖУ¬user1Êǽ¨ÉèµÄÓû§Ãû£¬MaildirÊÇÓû§µÄÓÊÏä´æ´¢Â·¾¶¡£
ÉèÖÃDNS¼Í¼
ΪÁËÈÃÆäËûÓʼþЧÀÍÆ÷Äܹ»×¼È·µØ·¢ËͺÍÎüÊÕÓʼþ£¬ÎÒÃÇÐèÒªÔÚDNSЧÀÍÆ÷ÉÏÌí¼ÓÏìÓ¦µÄ¼Í¼¡£ÒÔÏÂÊÇһЩ³£¼ûµÄDNS¼Í¼ʾÀý£º
mail.example.com. IN MX 10 mail.example.com. mail.example.com. IN A 192.168.0.100
µÇ¼ºó¸´ÖÆ
ÆäÖУ¬mail.example.comÊÇÓʼþЧÀÍÆ÷µÄÖ÷»úÃûºÍÓòÃû£¬192.168.0.100ÊÇÓʼþЧÀÍÆ÷µÄIPµØµã¡£
ÉèÖ÷À»ðǽ
ΪÁ˱£»¤ÓʼþЧÀÍÆ÷µÄÇå¾²£¬ÎÒÃÇ¿ÉÒÔʹÓ÷À»ðǽÀ´ÏÞÖƶÔÓʼþЧÀÍÆ÷µÄ»á¼û¡£ÒÔÏÂÊÇһЩ³£¼ûµÄ·À»ðǽÉèÖÃʾÀý£º
sudo ufw allow 25/tcp sudo ufw allow 143/tcp sudo ufw allow 993/tcp sudo ufw enable
µÇ¼ºó¸´ÖÆ
ÆäÖУ¬25ÊÇSMTP¶Ë¿Ú£¬143ÊÇIMAP¶Ë¿Ú£¬993ÊÇIMAPS¶Ë¿Ú¡£
ͨ¹ýÒÔÉÏ°ì·¨£¬ÎÒÃÇ¿ÉÒÔÀֳɵØÔÚLinuxϵͳÉÏÉèÖúÍÖÎÀíÓʼþЧÀÍÆ÷¡£ËäÈ»£¬Ëæ×ÅÓʼþЧÀÍÆ÷µÄʹÓú͵ü´ú£¬¿ÉÄÜ»¹ÐèÒª¾ÙÐÐһЩÆäËûµÄÉèÖúÍÓÅ»¯¡£¿ÉÊÇ£¬±¾ÎĵÄʾÀý´úÂëÒѾÄܹ»Öª×ã»ù±¾µÄÓʼþЧÀÍÆ÷ÐèÇó¡£Ï£Íû±¾ÎĹØÓÚÉèÖúÍÖÎÀíLinuxÉϵÄÓʼþЧÀÍÆ÷ÓÐËù×ÊÖú¡£
ÒÔÉϾÍÊÇÔõÑùÉèÖúÍÖÎÀíLinuxÉϵÄÓʼþЧÀÍÆ÷µÄÏêϸÄÚÈÝ£¬¸ü¶àÇë¹Ø×¢±¾ÍøÄÚÆäËüÏà¹ØÎÄÕ£¡