Email Setup Center
  • Home »
  • Linux Mail Server Configuration

Mail Server Configuration in Linux  

A mail server is a computer that stores all your emails, sends and receives emails like a Gmail server and Yahoo server. You can create your mail server and email account without using Google, Yahoo, or Hotmail services. The following procedure will help you create a mail server using Postfix and SquirrelMail as the webmail client on the Linux system, and also, understand the mail server configuration in Linux.

mail server configuration in Linux

Step-1: Install Apache & PHP7

  • The mail server configuration in Linux using the postfix and squirrelMail.
  • For using the SquirrelMail server, you need to install the packages Apache2 and PHP7. 
  • Open the terminal on the screen and enter the below commands.
  • $ sudo apt-get update –y
  • $ sudo apt-get upgrade –y
  • $ sudo apt-get install apache2 php7

Step-2: Install Postfix mail server

  • Input the command and press Enter to install Postfix.
  • $ sudo apt-get install postfix
  • Under the ‘General type’ tab, select Internet Site.
  • Enter a system name and select OK. Then, run the command below to restart Postfix mail server.
  • $ sudo service postfix restart

Step-3: Install Dovecot

  • You need to install Dovecot, which is the MDA (Mail Delivery Agent).
  • $ sudo apt-get install dovecot-imapd dovecot
  • Then enter the command to restart Dovecot.
  • $ sudo service dovecot restart

Step-4: Install SquirrelMail 

  • Here, we are using the email server SquirrelMail for mail server configuration in Linux. To Install it on the Linux system, download the SquirrelMail package and then run the following commands.
  • $ unzip squirrelmail-webmail-1.4.22.zip
  • $ sudo mv squirrelmail –webmail-1.4.22 /var/www/html /
  • $ sudo chown –R www-data :www/html/squirrelmail-webmail-1.4.22/
  • $ sudo chown 755 -R /var/www/html/squirrelmail-webmail-1.4.22/ 
  • $ sudo mv /var/html/squirrelmail-webmail-1.4.22/ /var/www/html/squirrelmail

Step-5: Configure SquirrelMail server

  • Enter the command line to configure the mail server.
  • $ sudo perl /var/html/squirrelmail/config/conf.pl
  • Input “2” to modify the server settings and then enter “1” to change the domain name.
  • Return to the main menu by entering “R” and pressing Enter, next, type “4” to edit the general options.
  • Enter the code of ‘Allow server-side sorting’ and then enter “true” to change the setting.
  • Following that, type “S” and press Enter to save the settings.
  • After completing the mail server configuration in Linux your server is ready now. You can access it from the link ‘domain.com/squirrelmail’ and enter a username and password to log in to the email.