Email Setup Center
  • Home »
  • Linux Mail Settings

How To Set Up Linux Mail Configuration?  

In order to use email, you have to configure the Linux mail server on your Linux system. Postfix is the most commonly used mail server in Linux. The section below will let you know how to configure the Postfix mail server using the SquirrelMail webmail on your Linux OS. Carry out the below steps to know how to setup Linux mail configuration.

This configuration process has five major steps. They are listed below.

  • Install Apache2 and PHP7
  • Install Postfix Mail Server
  • Install Dovecot
  • Install the SquirrelMail webmail in Linux
  • Create Mail Users
 
Linux mail configuration

Step 1: Install Apache2 and PHP7

  • First, you need to install both Apache2 and PHP7 to create a mail server using SquirrelMail.
  • To do so, open Terminal and run the following commands on it.
  • $ sudo apt-get update –y
  • $ sudo apt-get upgrade -y
  • $ sudo apt-get install apache2 php7
  • Now, both Apache2 and PHP7 will be installed on Linux.

Step 2: Install Postfix Mail Server

  
  • Postfix Mail Server acts as a mail transfer agent (MTA).
  • In the Terminal window, run:
  • $ sudo apt-get install postfix
  • Now, the Postfix Mail Server installation process will be initiated on your Linux.
  • When prompted, select the Internet Site option as the mail configuration type.
  • Enter the domain name in the System mail name field.
  • Once the FQDN has been set, you will be prompted to restart the Postfix Mail Server.
  • To do so, run the command mentioned below in the Terminal window.
  • $ sudo service postfix restart 
  • And then start your Linux mail configuration settings.

Step 3: Install Dovecot

  • Dovecot act as a mail delivery agent (MDA). 
  • To install Dovecot on your Linux, run the following command in the Terminal window.
  • $ sudo apt-get install dovecot-imapd dovecot-pop3d
  • Wait for the installation process to complete.
  • Once the Dovecot installation process has been completed, restart it by running the command mentioned below.
  • $ sudo service dovecot restart
Linux mail configuration

Step 4: Install the SquirrelMail webmail on Linux

  • SquirrelMail helps you to manage all your emails and mailboxes. To install SquirrelMail, run the following commands in the Terminal window.
  • $ wget https://sourceforge.net/projects/squirrelmail/files/stable/1.4.22/squirrelmail-webmail-1.4.22.zip
  • $ unzip squirrelmail-webmail-1.4.22.zip
  • $ sudo mv squirrelmail-webmail-1.4.22 /var/www/html/
  • $ sudo chown -R www-data:www-data /var/www/html/squirrelmail-webmail-1.4.22/
  • $ sudo chmod 755 -R /var/www/html/squirrelmail-webmail-1.4.22/
  • $ sudo mv /var/www/html/squirrelmail-webmail-1.4.22/ /var/www/html/squirrelmail
  • Once SquirrelMail has been installed, configure it by running the command mentioned below forLinux mail configuration.
  • $ sudo perl /var/www/html/squirrelmail/config/conf.pl
  • When prompted, edit the server settings by entering 2 and modify your domain name by typing 1.
  • Return to the main menu by entering R. If required, configure the general options as per your needs.
  • To enable the Allow server-side sorting? option, enter Y. After configuring the general options, save them by entering S.
  • Now, try to access your mail settings.

Step 5: Create Mail Users

  • Create a mail user by running the command mentioned below.
  • $ sudo useradd myusername
  • In the command above, enter a user name of your choice by replacing myusername. For example, $ sudo useradd xxxxx.
  • To add a password for the mail user, run the command mentioned below.
  • $ sudo passwd myusername
  • Now, for the mail, user create a home folder and make it as the default directory by running the following commands used for Linux mail configuration.
  • $ sudo mkdir -p /var/www/html/myusername
  • $ usermod -m -d /var/www/html/myusername myusername
  • Now, try to sign in to the newly created user by entering the account credentials correctly in the corresponding fields.
  • If you see an error stated ERROR: Connection dropped by the IMAP server, then return to the Terminal window and run the command given below. 
  • $ sudo chown -R myusername:myusername /var/www/html/myusername
  • After setting the permissions correctly, try to send or receive emails.

Contact us if you need remote assistance for Linux mail configuration settings.