Email Setup Center
  • Home »
  • Postfix Mail Server Configuration In Linux

Get Postfix Mail Server Configuration In Linux Step By Step?

Scroll down this web page to know how to postfix mail server configuration in Linux step by step. Most of us might know that Postfix Mail is a mail transfer agent that allows routing and delivering emails from the Linux OS. Configuring the Postfix Mail in Linux is quite simple and easy to perform. This section explains how to get a Postfix Mail server configuration in CentOS (Linux distribution) step-by-step.Before starting the configuration, make sure that you have the following setup:

Postfix Mail Server Configuration In Linux Step By Step

Step 1 - Download and install the ProtonMail IMAP/SMTP Bridge app

  • Step 1:OS: CentOS 8 server
  • Step 2:IP Address: 192.168.1.13
  • Step 3:Hostname: server1.xxxxxx.yyyy (domain name pointing to the server’s IP address)

After completing the initial setup, begin the Postfix Mail Server configuration in Linux.

Step 1: Update your Linux computer

  • Step 1:First, update your Linux computer to the latest version.
  • Step 2:To update Linux, open the terminal window on your system.
  • Step 3:Type and run the following command: #dnf update. Make sure that the no MTAs like Sendmail exists. To remove MTA, run the corresponding command in the terminal window.
  • Step 4:For example, if Sendmail exists, then remove it using the #dnf remove sendmail command.

Step 2: Set Hostname

To set the hostname for the Postfix Mail server on your Linux computer, use the following command:

  • Step 1:# hostnamect1 set-hostname server1.xxxxxx.yyyy
  • Step 2:# exec bash

Step 3: Add system’s hostname & IP address in /etc/hosts file

To do so, in the terminal window, type and run the following command:

  • Step 1:# vim/etc/hosts
  • Step 2:192.168.1.13
  • Step 3:server1.xxxxxx.yyyy

Once the above command is executed successfully, save, and close the file after the postfix mail server configuration in Linux step by step.

Step 4: Installing Postfix Mail server

To install the postfix mail server configuration in Linux step by step, type #dnf install postfix in the terminal window and run it.

Step 5: Initiate and enable the Postfix service on your Linux computer

  • Step 1:The next step in Postfix mail server configuration in Linux is starting and enabling the Postfix service. To do so, use the following commands.
  • Step 2:Starting the Postfix service: #systemctl start postfix
  • Step 3:To enable its service: # systemctl enable postfix

Step 6: Check the Postfix Mail server status

  • Step 1:In the terminal window, run the following command to check the status of the Postfix Mail server: #systemctl status postfix.
  • Step 2:If the Postfix Mail server is working properly, then install the mailx email client on your Linux computer before setting up the Postfix server.

Step 7: Install mailx email client

Run the # dnf install mailx command to install mailx on your Linux computer.

Step 8: Configure Postfix Mail server

  • Step 1:The Postfix Mail server’s configuration page is located in the following path: /etc/postfix/main.cf. You need to modify the configuration file to configure Postfix Mail server on your Linux computer. Open the Text editor using the following command:
  • Step 2:# vi /etc/postfix/main.cf.
  • Step 3:Now, the configuration file details will be displayed in the terminal window.
  • Step 4:Make changes to the lines starting with myhostname, mydomain, and myorigin.

After modifying the changes, save and close the configuration file. Make sure to restart the Postfix service using the #systemctl restart postfix command after the postfix mail server configuration in Linux step by step.

Step 9: Create a test user

To test the configured Postfix Mail Server on your Linux computer, you need to create a test user first. To do so, run the following command:

  • Step 1:#useradd postfixuser
  • Step 2:#passwd postfixuser
  • Step 3:After creating the test user, send an email from a local user server to another user by typing the following command:
  • Step 4:telnet localhost smtp or telnet localhost 25
  • Step 5:If you haven’t installed the telnet service on your Linux computer, then install it using the #dnf install telnet –y command. If the connectivity status is working fine, then get the output using the #ehlo localhost command.

Congratulations! You have successfully postfix mail server configuration in Linux step by step. If you’ve any doubts on how to get Postfix Mail server configuration in Linux step-by-step, then contact us.