SMTP: Configure a mail transfer agent (MTA) to accept inbound email from other systems.

Share this link

In order to test a mail server, you will need to set up a DNS server.

Remove the sendmail package (sendmail is more complicated to configure):

# yum erase sendmail

Install the postfix package:

# yum install -y postfix

Add a new rule to the firewall:

# iptables -I INPUT -m state --state NEW -m tcp -p tcp --dport 25 -j ACCEPT

Save the firewall configuration:

# service iptables save

Activate the postfix service at boot:

# chkconfig postfix on

Start the postfix service:

# service postfix start

Let’s assume that your server is called mail.example.com on the 192.168.1.0/24 network.
Edit the /etc/postfix/main.cf file and change the following directives:

myhostname = mail.example.com
mydomain = example.com
myorigin = $mydomain
inet_interfaces = all
mydestination = $mydomain, $myhostname, localhost.$mydomain, localhost
mynetworks = 192.168.1.0/24, 127.0.0.0/8

Check the syntax:

# postfix check

Check the non-default configuration:

# postconf -n

Reload the postfix configuration:

# service postfix reload

Set the ‘allow_postfix_local_write_mail_spoolSElinux boolean to ‘on’:

# setsebool -P allow_postfix_local_write_mail_spool on

Test from a client (it should display: 25/tcp open smtp):

# yum install -y nmap
# nmap mail.example.com

Alternatively, test from a client:

# yum install -y telnet
# telnet mail.example.com 25

In addition, you can look at configuring a MTA to forward (relay) email through a smart host.

1 Star2 Stars3 Stars4 Stars5 Stars (No Ratings Yet)
Loading...

Leave a Reply

RHCSA7: Task of the day

Allowed time: 10 minutes.
Archive and compress the content of the /opt directory (create files if none exists).
Uncompress and unarchive the resulting file in /root

RHCE7: Task of the day

Allowed time: 10 minutes.
Set up a NFS server that exports the /opt directory in read-only mode.

Follow me on Twitter

Poll for favorite RHEL 7 book

What is your favorite RHEL 7 book to prepare RHCSA & RHCE exams?

View Results

Loading ... Loading ...

Poll for most difficult RHCSA 7 topic

What do you think is the most difficult RHCSA 7 topic?

View Results

Loading ... Loading ...

Poll for most difficult RHCE 7 topic

What do you think is the most difficult RHCE 7 topic?

View Results

Loading ... Loading ...

Archives