How to Install Postfix Mail Server in Linux CentOS 8 running in a Virtual Server

Posted on

Introduction

This article will show how to install Postfix Mail Server in Linux CentOS 8. It is a virtual server running in a VirtualBox application. Actually, the installation is a part of the process of another software installation. It is a requirement for Gitlab repository source code installation. There is a reference for the installation. It exist in this link. It is an article with the title of ‘Install and Configure Gitlab on CentOS 8 / RHEL 8’. ‘.

Postfix Mail Server Installation in Linux CentOS 8 running in a Virtual Server

So, the following steps below are the sequence of the Postfix Mail Server installation in Linux CentOS 8 where it is available in a virtual server running in a VirtualBox application :

  1. Run the VirtualBox application. It will appear as follows :

    How to Install Postfix Mail Server in Linux CentOS 8 running in a Virtual Server
  2. Next step, run the virtual server with the correct label. For an example, in this article it is a virtual server with the label of ‘CentOS-8’. The following image will appear :

    How to Install Postfix Mail Server in Linux CentOS 8 running in a Virtual Server
  3. Just choose the correct entry of the Linux CentOS 8 operating system for further boot process. It will stop in the login screen as follows :

    How to Install Postfix Mail Server in Linux CentOS 8 running in a Virtual Server
    How to Install Postfix Mail Server in Linux CentOS 8 running in a Virtual Server
  4. But in this step, the installation process will not be available directly in the virtual server. Instead, it will be exist through the remote connection using SSH protocol. For more information, look at the article with the title ‘How to Remote CentOS Virtual Server running in a VirtualBox with a NAT Network using SSH’ in this link.

  5. After successfully logging in to the virtual server, just execute the following command :

    [admin@10 ~]$ sudo yum -y install postfix
    Last metadata expiration check: 0:03:00 ago on Mon 24 May 2021 11:07:28 AM EDT.
    Dependencies resolved.
    ============================================================================================================================================================================
     Package                                 Architecture                           Version                                        Repository                              Size
    ============================================================================================================================================================================
    Installing:
     postfix                                 x86_64                                 2:3.3.1-12.el8                                 baseos                                 1.4 M
    Transaction Summary
    ============================================================================================================================================================================
    Install  1 Package
    Total download size: 1.4 M
    Installed size: 4.1 M
    Downloading Packages:
    postfix-3.3.1-12.el8.x86_64.rpm                                                                                                             709 kB/s | 1.4 MB     00:02
    ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
    Total                                                                                                                                       542 kB/s | 1.4 MB     00:02
    Running transaction check
    Transaction check succeeded.
    Running transaction test
    Transaction test succeeded.
    Running transaction
      Preparing        :                                                                                                                                                    1/1
      Running scriptlet: postfix-2:3.3.1-12.el8.x86_64                                                                                                                      1/1
      Installing       : postfix-2:3.3.1-12.el8.x86_64                                                                                                                      1/1
      Running scriptlet: postfix-2:3.3.1-12.el8.x86_64                                                                                                                      1/1
      Verifying        : postfix-2:3.3.1-12.el8.x86_64                                                                                                                      1/1
    Installed:
      postfix-2:3.3.1-12.el8.x86_64
    Complete!
    [admin@10 ~]$
    
  6. Finally, just start the Postfix Mail Server’s service. But in the following sequence where the first one is by checking the status of the Postfix Mail Server’s service as follows :

    [admin@10 ~]$ sudo systemctl status postfix
    [sudo] password for admin:
    ● postfix.service - Postfix Mail Transport Agent
       Loaded: loaded (/usr/lib/systemd/system/postfix.service; disabled; vendor preset: disabled)
       Active: inactive (dead)
    [admin@10 ~]$
    

    Since the service is currently not active, follow it by starting the service as follows :

    [admin@10 ~]$ sudo systemctl start postfix
    [admin@10 ~]$
    

    Following after, just check the status once more. It is to check whether the service is currently active or not after the start execution process.

    [admin@10 ~]$ sudo systemctl status postfix
    ● postfix.service - Postfix Mail Transport Agent
       Loaded: loaded (/usr/lib/systemd/system/postfix.service; disabled; vendor preset: disabled)
       Active: active (running) since Tue 2021-05-25 11:44:13 EDT; 6s ago
      Process: 6100 ExecStart=/usr/sbin/postfix start (code=exited, status=0/SUCCESS)
      Process: 6097 ExecStartPre=/usr/libexec/postfix/chroot-update (code=exited, status=0/SUCCESS)
      Process: 6095 ExecStartPre=/usr/libexec/postfix/aliasesdb (code=exited, status=0/SUCCESS)
     Main PID: 6168 (master)
        Tasks: 3 (limit: 11428)
       Memory: 16.6M
       CGroup: /system.slice/postfix.service
               ├─6168 /usr/libexec/postfix/master -w
               ├─6169 pickup -l -t unix -u
               └─6170 qmgr -l -t unix -u
    May 25 11:44:09 10.0.2.15 systemd[1]: Starting Postfix Mail Transport Agent...
    May 25 11:44:13 10.0.2.15 postfix/master[6168]: daemon started -- version 3.3.1, configuration /etc/postfix
    May 25 11:44:13 10.0.2.15 systemd[1]: Started Postfix Mail Transport Agent.
    [admin@10 ~]$
    

    Apparently, the service is running properly. Next step, enable it so that when the restart or the reboot process event starting the virtual server again will automatically start the Postfix Mail Server. Just execute the following command :

    [admin@10 ~]$ systemctl enable postfix
    ==== AUTHENTICATING FOR org.freedesktop.systemd1.manage-unit-files ====
    Authentication is required to manage system service or unit files.
    Multiple identities can be used for authentication:
     1.  Administrator (admin)
     2.  podman
    Choose identity to authenticate as (1-2): 1
    Password:
    ==== AUTHENTICATION COMPLETE ====
    Created symlink /etc/systemd/system/multi-user.target.wants/postfix.service → /usr/lib/systemd/system/postfix.service.
    ==== AUTHENTICATING FOR org.freedesktop.systemd1.reload-daemon ====
    Authentication is required to reload the systemd state.
    Multiple identities can be used for authentication:
     1.  Administrator (admin)
     2.  podman
    Choose identity to authenticate as (1-2): 1
    Password:
    ==== AUTHENTICATION COMPLETE ====
    [admin@10 ~]$
    

Leave a Reply