Setting up a Mail server using Roundcube - Part-1 - Centos 7


    Do you want to setup a dedicated mail server for your website, Our mail server depends on three major criteria,

  1. Postfix (SMTP)
  2. Dovecot (IMAP)
  3. Roundcube (Mail Client)

    This article will show how to install and configure the above criteria for setting up a mail server for a domain.

Postfix:

    Postfix is a mail transfer agent (MTA) that delivers electronic mail across globe. It is also called as an SMTP server. Postifx can be integrated with spamfilters, dovecot and  complex SMTP-level access-policies

    To install postfix in a rpm based machines run the below command,



    The default path of the config files are found under this directory /etc/postfix.

    The main.cf file is the core of your mail server configuration. The default main.cf file lists only a portion of the nearly 300 Postfix parameters. Most Postfix parameters do not need to be changed, but the flexibility is there when it’s required. The path for the main.cf file is /etc/postfix/main.cf

    The next important config file is the master.cf file. The master daemon uses the master.cf file for its configuration information. The master.cf file contains a line for each Postfix service or transport.
   
    Each line has columns that specify how each program should run as part of the overall Postfix system. Most of all the master.cf file can be edited for additional features such as SMTP authentication,etc.,. Since this is a simple mail server setup, we will not working on this file.

    Whenever you made changes to these files the postfix application should be reloaded or restarted.



or




Changes to be done on main.cf file:

    Since we are going to setup a global access mail server to receive mails from external world hence change the inet_interfaces to all from 127.0.0.1


Add the below lines on your main.cf files,



Your myhostname will be your mail server name.

Create the below files that you have mentioned on your main.cf files,



Creating .db files:

    You can create db files once adding a new file using postmap command, the same can be used to update the .db files too. Update their .db files on every changes, The reason for using .db files is postfix is able to lookup information in hashes faster than a normal text file.




valias.txtYour user emails associated with the username.
relay_recipientsDefines the list of valid email addresses for the domain hosted.
relay_domainsDomains that has been relayed.
vhosts.txtDomains hosted on this mail server.
vmaps.txtContains virtual email address and mailbox location.
sender_accessAllows particular senders to send mails to your mail server.
recipient_accessUsed for access control.
client_accessUsed for access control.
helo_accessUsed for access control.

    On the above files we will editing two of the files for setting up a simple dedicated mail server for a domain valias.txt and vhosts.txt

    We will be creating an email as jhony@ljunix.com with username jhony. So your valias.txt file will look like as,



    And your vhost.txt file will be like,



    Update both files hash files by postmap command,



Create a user:



    Now we have all set on our postfix configuration, we further work on dovecot configuration on the upcoming article Setting up a Mail server using Roundcube - Part-2 - Centos 7

    Feel free to ask if you have any questions.

Comments

Popular Posts on this blog

How to Install LAMP Stack on Linux - Ubuntu 17.04

Creating and Running Virtual Machines in LINUX - KVM - Cli Mode

Apache Webserver - Installation from source (tar.gz and tar.bz2)

Replacing Commands for Linux Files - Using Perl and Sed

How to install Docker on Ubuntu-17.04

Setting up a Mail server using Roundcube - Part-3 - Centos 7

Blog Top Sites

Blog Log