This brief tutorial shows students and new users how to install and configure Postfix mail server on Ubuntu 18.04 | 16.04 servers…
For the uninitiated, Postfix an open-source and free mail transfer agent that routes and delivers emails.. It focuses on security and can be installed on most Linux systems, including Ubuntu using a simple command.
Students and new user looking for a Linux system to start learning on, the easiest place to start is Ubuntu Linux OS…. It’s a great Linux operating system for beginners and folks looking for easier Linux distribution to use..
Ubuntu is an open source Linux operating systems that runs on desktops, laptops, server and other devices…
When using Ubuntu, you will find that Linux isn’t so different than Windows and other operating systems in so many ways, especially when it comes to using the system to get work done.…
Both Ubuntu and Windows systems allow you to be productive, easy to use, reliable and enable you to install and run thousands of programs from gaming to productivity suite software for individuals and businesses..
This tutorial is going to show you how…..
To get stared follow the steps below:
Step 1: Install Postfix on Ubuntu
Postfix packages are available via Ubuntu default repositories… Using a simple command, you’ll be able to install it in no time.
To get Postfix installed, run the commands below:
sudo apt update sudo apt install postfix
When prompted whether to except the packages that will be downloaded and installed, type y for Yes.
During the installation, you’ll be prompted to choose Postfix configuration settings by selecting its configuration site and the mail system name or domain name..
Package configuration ┌───────────────────────────┤ Postfix Configuration ├───────────────────────────┐ │ Please select the mail server configuration type that best meets your needs. │ │ │ │ No configuration: │ │ Should be chosen to leave the current configuration unchanged. │ │ Internet site: │ │ Mail is sent and received directly using SMTP. │ │ Internet with smarthost: │ │ Mail is received directly using SMTP or by running a utility such │ │ as fetchmail. Outgoing mail is sent using a smarthost. │ │ Satellite system: │ │ All mail is sent to another machine, called a 'smarthost', for delivery. │ │ Local only: │ │ The only delivered mail is the mail for local users. There is no network. │ │ │ │ General type of mail configuration: │ │ │ │ No configuration │ │ Internet Site │ │ Internet with smarthost │ │ Satellite system │ │ Local only │ │ │ │ <Ok> <Cancel> │ │ │ └───────────────────────────────────────────────────────────────────────────────┘
When prompted, choose Internet Site as highlighted above.
Next choose a domain name for the mail system..
┌─────────────────────────────────────────┤ Postfix Configuration ├──────────────────────────────────────────┐ │ The "mail name" is the domain name used to "qualify" _ALL_ mail addresses without a domain name. This │ │ includes mail to and from : please do not make your machine send out mail from [email protected] │ │ unless [email protected] has told you to. │ │ │ │ This name will also be used by other programs. It should be the single, fully qualified domain name │ │ (FQDN). │ │ │ │ Thus, if a mail address on the local host is [email protected], the correct value for this option would be │ │ example.org. │ │ │ │ System mail name: │ │ │ │ maill.example.com_________________________________________________________________________________________ │ │ │ │ <Ok> <Cancel> │ │ │ └────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
Once the installation is complete, you can stop, start and enable the service using the commands below:
sudo systemctl stop postfix sudo systemctl start postfix sudo systemctl enable postfix
Then enable command enables the service to automatically start up everytime the system boots up..
Step 2: Configure Postfix
Now that Postfix is installed, move below to learn how to configure it..
Just like many other mail servers, Postfix comes with lots of different configuration options. Some are basic while others are more advanced..
Postfix main configuration file is located at /etc/postfix/main.cf
Run the commands below to open its default configuration file:
sudo nano /etc/postfix/main.cf
Majority of Postfix settings are found this configuration file.. At the bottom of the file you’ll find all the lines with configuration options that you’ll need to setup your environment.
smtpd_relay_restrictions = permit_mynetworks permit_sasl_authenticated defer_unauth_destination myhostname = ubuntu1804.example.com alias_maps = hash:/etc/aliases alias_database = hash:/etc/aliases myorigin = /etc/mailname mydestination = $myhostname, mail.example.com, ubuntu1804, localhost.localdomain, localhost relayhost = mynetworks = 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128 mailbox_size_limit = 0 recipient_delimiter = + inet_interfaces = all inet_protocols = all
There are three to four main configuration options that are mostly configured in a live environment: myhostname, mydestination, mynetworks and mail home folder.
These are details for some of the configurations above:
- myhostnme: describes the mail server hostname or system name… normally its fully qualified hostname:
- mydomain: describes the domain Postfix is handling mail for
- example: example.com
- mynetworks: describes the trusted networks of remote SMTP servers that can relay through the server
- example: 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128
- home_mailbx: describes user’s home mailbox..
- example: home_mailbox = Maildir/
Besides the configuration options above, Postfix also comes with a self-signed certificate settings that come configured on the system.
Postfix self-signed SSL certificate settings are located in the same configuration file mentioned above..
TLS configuration lines look similar to the ones below:
# TLS parameters smtpd_tls_cert_file=/etc/ssl/certs/ssl-cert-snakeoil.pem smtpd_tls_key_file=/etc/ssl/private/ssl-cert-snakeoil.key smtpd_use_tls=yes
Many of other Postfix configurations are located in the /etc/postfix directory. For more advanced configuration, you may have to review files in its main directory for help.
When connecting to the service for the first time, you will receive a warning message because they are self-signed and not CA certificates..
This post shows you how to install and configure Postfix mail server on Ubuntu.. If you find any error above, please use the comment form below to report it.
You may also like the post below: