Wednesday 20 January 2016

Setup mail server on ubuntu 14.04 ( Postfix )

Setup mail server on ubuntu 14.04 ( Postfix )

Installing and configuring postfix.

This is easy to install postfix on ubuntu 14.04 because postfix exists on repository web servers.

In order to install postfix first you should configure FQDN and IP address in your computer.

Configuring FQDN.  

Assign static IP and hostname and add a host entry for the host name
Edit your /etc/hostname file with the following command.

sudo gedit /etc/hostname                                                                                          

and Add a hostentry in /etc/hosts with following command.

sudo gedit /etc/host                                                                                                  

In my case  "mail.amcositsupport.com" is my FQDN.



Installing Postfix:

Now install postfix and dependencies.

sudo apt-get update                                                                                                  

sudo apt-get install postfix                                                                                           
this will ask that 

"The following packages were automatically installed and are no longer required:  libkyotocabinet16 libmailutils4 mailutils-common
Do you want to continue? [Y/n]  "
Press Y and enter to install Postfix.

On the next window the default option is Internet Site, Let it selected and press ok to continue.

 In the next window, The System mail name should be the same as the name you assigned the FQDN, in my case it is showing a subdomain as mail.amcositsupport.com so I have changed it to amcositsupport.com, change these parameters with your FQDN.and click ok, as shown below.

 

"Installation part of postfix is completed, now you need to configure postfix"


 Configuring Postfix:


In order to configure Postfix, open the main configuration file.
with the command

sudo nano /etc/postfix/main.cf                                                                                  

 Now find myhostname in main.cf it should look like

myhostname = amcositsupport.com 

replace "amcositsupport.com" with your domain name.

now scroll main.cf file and look and pont the following entries



mailbox_size_limit = 0
recipient_delimiter = +
inet_interfaces = all

now replace inet_interfaces = all to inet_interfaces = loopback-only as shown below


mailbox_size_limit = 0
recipient_delimiter = +
inet_interfaces = loopback-only 

Now to finish editing type Ctrl+O and then Ctrl+X, to save and exit from editor.
Now restart your postfix service to apply changes with the command
sudo service postfix restart                                                                                         

Sending mail from Postfix: