In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-03 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/01 Report--
This article introduces the relevant knowledge of "how to install and configure postfix mail server under Linux system". In the operation of actual cases, many people will encounter such a dilemma, so let the editor lead you to learn how to deal with these situations. I hope you can read it carefully and be able to achieve something!
First, install postfix,cyrus-sasl,cyrus-imapd
If yum prompts you that the package cannot be found, please change the source. Please refer to the centos 6 recommended epel source
The code is as follows:
[root@localhost ~] # yum install postfix
[root@localhost ~] # yum install cyrus*
Second, delete sendmail
The code is as follows:
[root@localhost] # rpm-e sendmail
Or
The code is as follows:
[root@localhost ~] # yum remove sendmail
Third, change the default mail transfer agent (MTA)
The code is as follows:
[root@localhost sasl2] # alternatives-- config mta
There are 1 programs that provide "mta".
Select command
* + 1 / usr/sbin/sendmail.postfix
Press Enter to save the current selection [+], or type the selection number: 1
Only one postfix,sendmail on it has been deleted by me. You can view it with the following command.
The code is as follows:
[root@localhost] # alternatives-- display mta
Fourth, postfix,cyrus-sasl,cyrus-imapd-related configuration
1 the main configuration file main.cf for MagnePostfix
The code is as follows:
[root@localhost postfix] # vim / etc/postfix/main.cf
Myhostname = localhost / / 76 line, rewrite the part after the equal sign to the local hostname
Mydomain = 51yip.com / / 82 line, set the domain name
Myorigin = $mydomain / / 97 line, change $myhostname to $mydomain
Inet_interfaces = all / / 112line, change the following localhost to all
Mydestination = $myhostname, localhost.$mydomain, localhost,$mydomain / / 163line, remove the previous comment and add $mydomain
Mynetworks = 192.168.0.0 IP 24,127.0.0.0Compact 8 / / 263 lines, set the intranet and local Universe
Local_recipient_maps = / / 209line, remove the previous comment.
Smtpd_banner = $myhostname ESMTP unknow / / line 568, remove the previous comment, and then change $mail_name ($mail_version) to unknow
/ / add the following to the bottom of the main.cf file
Smtpd_sasl_auth_enable = yes / / use SMTP authentication
Broken_sasl_auth_clients = yes / / allows smtpclient that does not support RFC2554 to interact with postfix.
Smtpd_sasl_local_domain = $myhostname / / specifies the local domain name certified by SMTP
Smtpd_sasl_security_options = noanonymous / / cancel anonymous login
Smtpd_recipient_restrictions = permit_mynetworks, permit_sasl_authenticated, reject_unauth_destination / / set the restrictions on the recipient part of the message
Smtpd_sasl_security_restrictions = permit_mynetworks, permit_sasl_authenticated, reject_unauth_destination / / set the allowable range
Message_size_limit = 15728640 / / message size
Mailbox_transport=lmtp:unix:/var/lib/imap/socket/lmtp / / sets the path to connect to cyrus-imapd
If you do not add the configuration of local_recipient_maps, you will not receive your email. The following is the bounce of qq.
The recipient email address (tank@51yip.com) does not exist and the message cannot be delivered. Said: 5505.1.1: Recipient address rejected: User unknown in local recipient table (in reply to RCPT TO command)
2Perfect cyrusMussasl configuration
The code is as follows:
[root@localhost postfix] # vim / etc/sasl2/smtpd.conf / / add the following to the end of the file
Log_level: 3 / / record the mode of log
Saslauthd_path:/var/run/saslauthd/mux / / set the path for smtp to find cyrus-sasl. The path of 32-bit machine and 64-bit machine smtpd.conf is different from that mentioned here.
/ / this is the configuration file for smtpd on centos 5.532-bit machine
[root@linux sasl2] # ls | grep conf
Sendmail.conf
Smtpd.conf
[root@linux sasl2] # pwd
/ usr/lib/sasl2
/ / this is the configuration file for smtpd on the centos 6.064-bit machine. There is no configuration file for smtpd elsewhere.
[root@localhost postfix] # ls / etc/sasl2/ | grep smtpd
Smtpd.conf
There are a lot of articles about postfix installation on the Internet, but the configuration does not specify whether it is a 32-bit machine or a 64-bit machine. So mark it here.
3, configure cyrus-imapd
There are three main configuration files for cyrus-imapd
Here is the default configuration, that is to say, I have not touched the above three files. Remind imapd.conf here that in this file, you can set up an administrative account.
, set the mail storage directory, set the password connection method, and so on.
Fifth, start postfix,cyrus-sasl,cyrus-imapd
Start the cyrus-imapd service, you can provide both pop and imap services, if you have installed the dovecot service can be deleted, cyrus-imapd and dovecot one of the two on the line, two can provide pop and imap services, but cyrus-imapd can create a message for each user, and the mailbox has a hierarchical structure, easier to manage. Cyrus-imapd is recommended.
The code is as follows:
[root@linux sasl2] # / etc/init.d/postfix start
[root@linux sasl2] # / etc/init.d/saslauthd start
[root@linux sasl2] # / etc/init.d/cyrus-imapd start
Check the progress.
The code is as follows:
/ / smtp snooping is port 25
[root@linux u] # netstat-tpnl | grep smtpd
Tcp 0 0 127.0.0.1:25
The code is as follows:
/ etc/sysconfig/cyrus-imapd
/ etc/cyrus.conf
/ etc/imapd.conf
0.0.0.0VR * LISTEN 6319/smtpd
The code is as follows:
/ / 110port (POP3) and 143port (IMAP) are already available below
[root@linux u] # netstat-tpnl | grep cyrus
Tcp 0 0 0 9 9 0 0 0. 0 0 LISTEN 23593/cyrus-master
Tcp 0 0 0.0.0. 0. 0. 0. 0. 0. 0. 0. 0. 9. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0 of the LISTEN 23593/cyrus-master
Tcp 0 0 0.0.0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 00
Tcp 00 0.0.0.0Viru 2000 0.0.0.0purl * LISTEN 23593/cyrus-master
Tcp 0 0: 993: * LISTEN 23593/cyrus-master
Tcp 0 0: 995: * LISTEN 23593/cyrus-master
Tcp 0 0: 110: * LISTEN 23593/cyrus-master
Tcp 0 0: 143: * LISTEN 23593/cyrus-master
Tcp 00: 2000: * LISTEN 23593/cyrus-master
There is no problem with starting.
Sixth, test cyrus-sasl
The code is as follows:
[root@linux t] # passwd cyrus / / set the password for cyrus
[root@linux sasl2] # testsaslauthd-u cyrus-p'*'/ / system user and password
0: OK "Success."
If the above content says smtp, there is no problem.
Seventh, cyrus-imapd production mail administrator account, and add test account
After installing cyrus-imapd, an administrative account is generated as cyrus, and the user group is mail.
The code is as follows:
The default administrator account in [root@linux sasl2] # id cyrus / / imapd.conf is cyrus.
Uid=76 (cyrus) gid=12 (mail) groups=12 (mail), 76 (saslauth)
When authenticating the admin account, I found that there was a little difference between the 32-bit system and the 64-bit system. I have configured both systems, and the configuration is the same.
But the results are different. Look at the picture below.
User authentication of 32-bit machine cyrus administrator
64-bit machine cyrus administrator user authentication
As can be seen from the picture above, the 32-bit system does not need to be added-- auth plain,64 bit, if not, it will not be able to enter at all.
After entering, let's add a test account.
The code is as follows:
[root@linux sasl2] # cyradm-u cyrus localhost
IMAP Password:
Localhost > cm tank
Localhost > lm
Tank (\ HasNoChildren)
Localhost > quit
So we can see in / var/spool/imap that the generated directories are different from those generated by 32-bit and 64-bit machines.
The code is as follows:
/ / this is the directory generated by the 64-bit system
[root@localhost u] # ls
Username ^ user
[root@localhost u] # pwd
/ var/spool/imap/u
/ / this is the directory generated by the 32-bit system
[root@linux t] # ls
Tank
[root@linux t] # pwd
/ var/spool/imap/t
Eighth, test sending and receiving email.
Add DNS before testing
1meme mail.51yip.com A defaults to 122.225.room.resume *
2pen mail.51yip.com A Unicom 60.12.China Unicom
3Jing @ MX default mail.51yip.com
1 and 2, is to add two A records, the third line, set up a MX record, this must not forget, otherwise your domain name is impassable.
There are many methods, we can use telnet to test, but it is troublesome to use telnet to test sending and receiving email, using linux's
Mail command is much more convenient.
The code is as follows:
[root@localhost u] # mail-s' take a look '95219454@qq.com < / etc/imapd.conf
This is the end of the introduction of "how to install and configure postfix mail server under Linux system". Thank you for reading. If you want to know more about the industry, you can follow the website, the editor will output more high-quality practical articles for you!
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.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.