Today, i will write about postfix smtp server in Alma linux 8. Alma linux is the successor of the discontinued centos. Alma linux claim forever-free enterprise Linux distribution, focused on long-term stability, providing a robust production-grade platform. And also 1:1 binary compatible with RHEL® and pre-Stream CentOS.
Installing Postfix
On your Alma linux server, run the following commands.
yum install postfix -y
Once it’s installed, start Postfix SMTP server.
sudo systemctl start postfix
And enable auto-start at boot time.
sudo systemctl enable postfix
Now you can check its status with:
systemctl status postfix
Check Postfix version with this command:
root@server# postconf mail_version
mail_version = 3.5.8
Alma Linux 8 ships with Postfix v3.5.8.
Configuring Alma Linux 8 postfix
Listening on the public IP address
[root@server]# postconf inet_interfaces
inet_interfaces = localhost
We need to run the following command to configure Postfix to listen on the public IP address so it will be able to receive emails from other SMTP servers. The -e
option enables postconf to edit the Postfix main configuration file.
sudo postconf -e "inet_interfaces = all"
postconf myhostname
Postfix uses this hostname to identify itself when communicating with other SMTP server.
sudo postconf -e "myhostname = mail.yourdomain.com"
Setting $myorigin Parameter
The $myorigin
parameter specifies the default domain name that will be appended to sender and recipient addresses that have no @domain part. The default is to use the value of $myhostname
, as can be seen with:
postconf myorigin
Output:
myorigin = $myhostname
You need to change its value to yourdomain.com, so a sender on your mail server will have @yourdomain.com
address.
sudo postconf -e "myorigin = yourdomain.com"
Setting $mydestination Parameter
The $mydestination
parameter specifies the list of domains that your server considers itself the final destination for. You can display the current value of $mydestination with:
postconf mydestination
Output
mydestination = $myhostname, localhost.$mydomain, localhost
Default postfix SMTP server to receive emails coming for [email protected]
, [email protected]
and someone@localhost
, but it won’t allow you Postfix SMTP server to receive emails coming for [email protected]
. In order to achieve that, add yourdomain.com
to the list of domains.
sudo postconf -e "mydestination = yourdomain.com, \$myhostname, localhost.\$mydomain, localhost"
Restarting Postfix
Finally, we need to restart Postfix for the changes to take effect.
sudo systemctl restart postfix
Ok, thats it. Please feel free for comment out. Maybe usefull.
Credit Article: www.linuxbabe.com
Let's Buy Me Coffee. https://saweria.co/habibzain https://ko-fi.com/habibzain