Thursday, April 22, 2021

Mail Server Configuration - Fedora (CentOS)

  • Webmin DNS
  1. install Fedora with GUI
  2. set static id address with DNS:
  3. set hostname
    1. root# cp /etc/hostname /etc/hostname.bak
    2. root# vi /etc/hostname
    3. fedora8
  4. set hosts
    1. root# cp /etc/hosts /etc/hosts.bak
    2. root# vi /etc/hosts
    3.           fedora8
  5. install bind
    1. root# dnf install -y bind
    2. root# systemctl enable named
    3. root# systemctl start named
  6. after install dns server, we modify setting of DNS.
    1. vi /etc/named.conf
    2. listen-on port 53 { 10.64.201.x; }
    3. dnssec-validation no;
    4. add recursion yes;
  7. install sendmail
    1. root# dnf install -y sendmail sendmail-cf
    2. root# systemctl enable sendmail
    3. root# systemctl start sendmail
  8. go to to install webmin
  9. open webmin by https://fedora8:10000
  10. create master zone

  1. create A records

  1. create alias records for FTP

  1. create MX record with priority 5

  1. change dns from8.8.8.8 to itself
  2. transfer dns zone to class dns server

  1. turn off firewall
    1. systemctl disable firewalld
    2. Systemctl stop firewalld
  2. go to class dns server to create secondary zoon.


  1. force fedora forward the dns zoon always to class dns server.


  • Setup 2nd Domain DNS and Sendmail

  1. create master zone:

  1. create MX records

  1. zoon transfer to class dns

  1. go to class dns server to create sendory zoon:
  2. go back to fedora, modify configure file of sendmail: /etc/mail/

  1. comment out the line: DAEMON_OPT….

  1. generate a new configure file of sendmail after any change.
    1. make -C /etc/mail

  1. restart sendmail : systemctl restart sendmail
  2. install alpine for testing.

dnf install -y alpine

  1. change local configure of alpine

  1. change the access file to add relay:
    1. vi /etc/mail/access
  2. generate a new configure file of sendmail after any change.
    1. make -C /etc/mail
  3. restart sendmail and test using alpine.

                You can test by nslokup -q=mx before send mail to the mailbox

  • Install Dovecot
  1. Install dovecot

for fedora and centos:

dnf install -y dovecot

  1. Check the configure file:
  2. vi /etc/dovecot/dovecot.conf
  3. vi /etc/covecot/conf.d/10-mail.conf
  1. remove the # to indicate the mail location.
  1. cd /etc/dovecot/conf.d
  2. vi 10-auth.conf
  3. disable_plaintext_auth = no
  4. save the file and restart the service in outlook turn of secure authentication SPA
  5. And under the advanced tab uncheck the pop3 ssl authentication
  1. change the mail folder permission to 600.

  • Now we can setup the client email using outlook
  1. add new pop and imap account in outlook





Gur Isler said...

Good job, thanks a lot Hualong! Good luck with tomorrow's exam everyone!

Hualong Wang said...

good luck to you too!!