Email Tutorials - Herong's Tutorial Examples - v1.03, by Herong Yang
Install and Configure Postfix on CentOS
This section provides a tutorial example on how to install, configure and run Postfix server on CentOS systems.
Installing Postfix on CentOS 8 is relatively easy, since it has a ready-to-run binary package in CentOS repository. Here is what I did to install, configure and run Postfix on my CentOS 8 computer.
1. Install Postfix with "dnf" command.
herong$ sudo dnf install postfix ... Installed: postfix-2:3.3.1-12.el8.x86_64
2. Configure Postfix.
herong$ sudo vi /etc/postfix/main.cf ... myhostname = mail.herongyang.com mydomain = herongyang.com myorigin = $mydomain inet_interfaces = all inet_protocols = all mydestination = $myhostname, localhost.$mydomain, localhost, $mydomain mynetworks = 192.168.1.0/24, 127.0.0.0/8 home_mailbox = Maildir/ ...
3. Make sure that my local IP address is mapped to $myhostname.
herong$ sudo vi /etc/hosts 127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4 ::1 localhost localhost.localdomain localhost6 localhost6.localdomain6 192.168.1.100 mail.herongyang.com mail herong$ ping mail PING mail.herongyang.com (192.168.1.100) 56(84) bytes of data. 64 bytes from mail.herongyang.com (192.168.1.100): icmp_seq=1 ttl=64
3. Make sure that "sendmail" daemon is un-installed to avoid conflicts. The output shows that "sendmail" is not running and not installed.
herong$ ps -ef | grep sendmail herong 17214 4230 0 06:46 pts/0 00:00:00 grep --color=auto sendmail herong$ sudo dnf info sendmail Available Packages Name : sendmail ...
4. Activate and state Postfix server.
herong$ sudo systemctl enable postfix herong$ sudo systemctl start postfix herong$ sudo systemctl status postfix * postfix.service - Postfix Mail Transport Agent Loaded: loaded (/usr/lib/systemd/system/postfix.service; enabled; ...) Active: active (running) since Fri 2023-11-13 06:15:38 EST; 26s ago Process: 29008 ExecStart=/usr/sbin/postfix start (code=exited, status=0/SUCCESS) Process: 29006 ExecStartPre=/usr/libexec/postfix/chroot-update (code=exited, ...) Process: 29003 ExecStartPre=/usr/libexec/postfix/aliasesdb (code=exited, ...) Main PID: 29075 (master) Tasks: 3 (limit: 26213) Memory: 14.3M CGroup: /system.slice/postfix.service |-29075 /usr/libexec/postfix/master -w |-29076 pickup -l -t unix -u |-29077 qmgr -l -t unix -u 06:15:37 localhost.localdomain systemd[1]: Starting Postfix Mail Transport Agent... 06:15:38 localhost.localdomain postfix/master[29075]: daemon started -- version 3.3.1, configuration /etc/postfix 06:15:38 localhost.localdomain systemd[1]: Started Postfix Mail Transport Agent.
Cool! I think my Postfix server is running and ready to handle SMTP requests.
Table of Contents
►Postfix - Mail Transport Agent (MTA)
►Install and Configure Postfix on CentOS
Test Postfix Server with "telnet" Client
SMTP Submission Service on Port 587 in Postfix
Archive Emails using "always_bcc" Setting in Postfix
Move /var/spool/postfix to New Location
"postconf" Command to Manage Postfix Configuration
Turn on Postfix Server Logging for Troubleshooting
SSL/TLS Secure Connections with Postfix Server
Dovecot - IMAP and POP3 Server
SSL/TLS Secure Connections with Dovecot Server
Email Client Tools - Mail User Agents (MUA)