Introduction
This is an article for installing Postfix Mail Server in Linux Ubuntu 19.10 operating system. Postfix is one of the available Mail Server out there where it exist as part of the opensource platform. According to the official website of Postfix in this link, it is Wietse Venema’s mail server that started life at IBM research as an alternative to the widely-used Sendmail program. Now at Google, Wietse continues to support Postfix. Postfix attempts to be fast, easy to administer, and secure. The outside has a definite Sendmail-ish flavor, but the inside is completely different. Before starting to read the rest of the line, there are two parts of the article which is focusing into different part of subject. The first one is the preparation step. The other one is the actual installation step.
Preparation for the Postfix Mail Server Installation
So, the following are the steps for the preparation before the actual installation steps :
In order to install Postfix Mail Server, just follow the steps below :
1. First of all, the normal step is for switching to root or admin user account. The switch process exist as follows :
user@hostname:~$ sudo su - [sudo] password for user: root@hostname:~#
2. After that, don’t forget to update the operating system before executing the actual installation as follows :
root@hostname:~# apt-get update Ign:1 http://dl.google.com/linux/chrome/deb stable InRelease Hit:2 http://dl.google.com/linux/chrome/deb stable Release Get:4 http://security.ubuntu.com/ubuntu eoan-security InRelease [97,5 kB] Hit:5 http://xxxxxxxxxxxxxxxxxxxxx/ubuntu eoan InRelease Get:6 http://xxxxxxxxxxxxxxxxxxxxx/ubuntu eoan-updates InRelease [97,5 kB] Get:7 http://xxxxxxxxxxxxxxxxxxxxx/ubuntu eoan-backports InRelease [88,8 kB] ... Get:10 http://xxxxxxxxxxxxxxxxxxxxx/ubuntu eoan-updates/main amd64 Packages [152 kB] Get:11 http://security.ubuntu.com/ubuntu eoan-security/main amd64 DEP-11 Metadata [204 B] Get:12 http://xxxxxxxxxxxxxxxxxxxxx/ubuntu eoan-updates/main i386 Packages [122 kB] Get:13 http://security.ubuntu.com/ubuntu eoan-security/universe amd64 DEP-11 Metadata [1.672 B] Get:14 http://xxxxxxxxxxxxxxxxxxxxx/ubuntu eoan-updates/main amd64 DEP-11 Metadata [60,3 kB] Get:15 http://xxxxxxxxxxxxxxxxxxxxx/ubuntu eoan-updates/universe amd64 Packages [71,5 kB] Get:16 http://xxxxxxxxxxxxxxxxxxxxx/ubuntu eoan-updates/universe i386 Packages [68,1 kB] Get:17 http://xxxxxxxxxxxxxxxxxxxxx/ubuntu eoan-updates/universe amd64 DEP-11 Metadata [25,9 kB] Get:18 http://xxxxxxxxxxxxxxxxxxxxx/ubuntu eoan-updates/universe DEP-11 48x48 Icons [18,5 kB] Get:19 http://xxxxxxxxxxxxxxxxxxxxx/ubuntu eoan-updates/universe DEP-11 64x64 Icons [22,9 kB] Get:20 http://xxxxxxxxxxxxxxxxxxxxx/ubuntu eoan-backports/universe amd64 DEP-11 Metadata [7.756 B] Reading package lists... Done ... N: Updating from such a repository can't be done securely, and is therefore disabled by default. N: See apt-secure(8) manpage for repository creation and user configuration details. root@hostname:~#
Postfix Mail Server Installation Process
After preparing through the steps above, the next step is the important one. It is the installation step. This is the important step which is the actual process of the Postfix Mail Server installation. The following are the steps for installing Postfix Mail Server :
1. Execute the following command of ‘apt-get -y install postfix’ below :
root@hostname:~# apt-get -y install postfix Reading package lists... Done Building dependency tree Reading state information... Done Suggested packages: procmail postfix-mysql postfix-pgsql postfix-ldap postfix-pcre postfix-lmdb postfix-sqlite sasl2-bin | dovecot-common resolvconf postfix-cdb mail-reader postfix-doc The following NEW packages will be installed: postfix 0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded. Need to get 1.198 kB of archives. After this operation, 4.569 kB of additional disk space will be used. Get:1 http://xxxxxxxxxxxxxxxxxxxxx/ubuntu eoan/main amd64 postfix amd64 3.4.5-1ubuntu1 [1.198 kB] Fetched 1.198 kB in 5s (230 kB/s) Preconfiguring packages ... Selecting previously unselected package postfix. (Reading database ... 148481 files and directories currently installed.) Preparing to unpack .../postfix_3.4.5-1ubuntu1_amd64.deb ... Unpacking postfix (3.4.5-1ubuntu1) ... Setting up postfix (3.4.5-1ubuntu1) ... Adding group `postfix' (GID 134) ... Done. Adding system user `postfix' (UID 127) ... Adding new user `postfix' (UID 127) with group `postfix' ... Not creating home directory `/var/spool/postfix'. Creating /etc/postfix/dynamicmaps.cf Adding group `postdrop' (GID 135) ... Done. setting myhostname: myserver.localhost.net setting alias maps setting alias database mailname is not a fully qualified domain name. Not changing /etc/mailname. setting destinations: myserver, $myhostname, myserver, localhost.localdomain, localhost setting relayhost: setting mynetworks: 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128 setting mailbox_size_limit: 0 setting recipient_delimiter: + setting inet_interfaces: loopback-only setting default_transport: error setting relay_transport: error setting inet_protocols: all /etc/aliases does not exist, creating it. WARNING: /etc/aliases exists, but does not have a root alias. Postfix (main.cf) is now set up with a default configuration. If you need to make changes, edit /etc/postfix/main.cf (and others) as needed. To view Postfix configuration values, see postconf(1). After modifying main.cf, be sure to run 'service postfix reload'. Running newaliases Created symlink /etc/systemd/system/multi-user.target.wants/postfix.service → /lib/systemd/system/postfix.service. Processing triggers for ufw (0.36-1ubuntu3) ... Processing triggers for systemd (242-7ubuntu3.2) ... Processing triggers for man-db (2.8.7-3) ... Processing triggers for rsyslog (8.1901.0-1ubuntu4) ... Processing triggers for libc-bin (2.30-0ubuntu2) ... root@myserver:~#
2. After successfully installing the Postfix Mail Server, don’t forget to start the service by executing the following command :
root@hostname:~# systemctl start postfix root@hostname:~#
Since the above command execution process is finish without having any warning or error messages, just go through on to the next step. Actually, it is an additional step to make sure that the service is running well. Furthermore, it is a step to make sure that the service will start automatically in the boot process of the operating system.
3. Continue on the previous step, don’t forget to check the status of the Postfix Mail Server’s service. Just execute the following command :
root@myserver:~# systemctl status postfix ● postfix.service - Postfix Mail Transport Agent Loaded: loaded (/lib/systemd/system/postfix.service; enabled; vendor preset: Active: active (exited) since Wed 2019-12-18 22:57:58; 1h 21min ago Process: 1680 ExecStart=/bin/true (code=exited, status=0/SUCCESS) Main PID: 1680 (code=exited, status=0/SUCCESS) Dec 18 22:57:58 myserver systemd[1]: Starting Postfix Mail Transport Agent... Dec 18 22:57:58 myserver systemd[1]: Started Postfix Mail Transport Agent. root@myserver:~#
As exist in the output command execution for checking the Postfix Mail Server’s service status, the service is currently active. It is obvious since there is a line containing that information. It is the line with ‘Active: active’ informing the status of the service. 5. Finally, in order to start the Postfix Mail Server’s service automatically upon boot process of the operating system, just execute the following command :
4. Last but not least, execute the following command to enable the auto-start for Postfix Mail Server’s service :
root@myserver:~# systemctl enable postfix Synchronizing state of postfix.service with SysV service script with /lib/systemd/systemd-sysv-install. Executing: /lib/systemd/systemd-sysv-install enable postfix root@myserver:~#
By enabling the auto-start feature, the Postfix Mail Server’s service will start every time the boot process of the operating system starts.