Disclaimer:
This howto is tested on Ubuntu 16, 18, 20 and Debian 10, 11 edition.
Installing and configuring postfix
Step 1 » Assign static IP and hostname and add a host entry for the host name .
Assign hostname in /etc/hostname
mail.tweenpath.net
Add a host entry in /etc/hosts
192.168.1.10 mail.tweenpath.net
Step 2 » Update the repositories.
tweenpath@mail:~$ sudo apt-get update
Step 3 » Install postfix and dependencies . Press enter for all prompted questions during installation. we will do that in the next step.
tweenpath@mail:~$ sudo apt-get install postfix
Step 4 » After installation issue the below command to configure postfix.
tweenpath@mail:~$ sudo dpkg-reconfigure postfix
Now you will be prompted for set of details . choose the following values and replace tweenpath.net with your domain name.