Logo
  • Ubuntu
  • CentOS
  • Debian
  • Fedora
  • RedHat

How to Setup a Complete Mail Server (Postfix) using ‘SquirrelMail’ (Webmail) on Ubuntu/Debian - DesignLinux

Sep 09 2020
designlinux 0 Comments

Creating a mail server on Linux powered machines can be one of the most essential things that every system administrator needs to do while configuring the servers for the first time, if you don’t know what it means; it’s simple, if you have a website like “example.com”, you can create an email account like “[email protected]” to use it to send/receive emails easily instead of using services like Hotmail, Gmail, Yahoo Mail, etc.

In this article, we’ll learn how to do so by installing the Postfix mail server with the “SquirrelMail” webmail application and its dependencies on Debian 10/9 and Ubuntu 20.04/18.04/16.04 LTS releases.

Step 1: Installing Apache2 and PHP7

1. In order to create a running mail server using “SquirrelMail”, we’ll have to install both Apache2 & PHP7 packages first, to do so, run.

$ sudo apt-get update -y
$ sudo apt-get upgrade -y
$ sudo apt-get install apache2 php7
OR
$ sudo apt-get install apache2 php
Install Apache and PHP
Install Apache and PHP

Step 2: Installing Postfix Mail Server

2. Postfix is a mail transfer agent (MTA) which is the responsible software for delivering & receiving emails, it’s essential in order to create a complete mail server.

To install it on Ubuntu/Debian or even Mint, run:

$ sudo apt-get install postfix

During installation, you will be asked to choose the type of mail configuration, choose “Internet Site”.

Install Postfix in Ubuntu
Install Postfix in Ubuntu

3. Now enter the fully qualified domain name that you want to use for send and receive emails.

Set Postfix Mail Domain
Set Postfix Mail Domain

4. Once the FQDN set, you’ve to restart the Postfix mail server using.

$ sudo systemctl restart postfix
OR
$ sudo service postfix restart
Start Postfix Mail Server in Ubuntu
Start Postfix Mail Server in Ubuntu

Step 3: Installing Dovecot

5. Dovecot is a mail delivery agent (MDA), it delivers the emails from/to the mail server, to install it, run the following command.

$ sudo apt-get install dovecot-imapd dovecot-pop3d
Install Dovecot in Ubuntu
Install Dovecot in Ubuntu

6. Next, restart the Dovecot service using the following command.

$ sudo systemctl restart dovecot
OR
$ sudo service dovecot restart
Start Dovecot in Ubuntu
Start Dovecot in Ubuntu

Step 4: Installing SquirrelMail in Ubuntu

7. SquirrelMail is the email server that you’ll be using to manage emails on your server, it has a simple web interface to do the job, it can be customized by installing more modules & themes.

$ 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

8. After the installation, you will have to run this command in order to configure SquirrelMail.

$ sudo perl /var/www/html/squirrelmail/config/conf.pl
Configure Squirrelmail in Ubuntu
Configure Squirrelmail in Ubuntu

09. Next, enter “2” in order to edit the server settings, and you will be prompted to it.

Squirrelmail Server Settings
Squirrelmail Server Settings

10. Now enter “1” in order to change the domain name and write up your domain (e.g: tecmint.com).

Set Mail Domain
Set Mail Domain

11. Go back to the main menu by writing “R” and hitting the enter key, write “4” in order to configure the general options.

You see “Allow server-side sorting”? Enter “11” and change it from “false” to “true” by entering “y”. Now hit the Enter key, and enter the “S” key in order to save the configuration file.

Configure General Mail Options
Configure General Mail Options

12. You can now access the mail server by going to domain.com/squirrelmail.

Access Squirrelmail in Ubuntu
Access Squirrelmail

Step 5: Creating Mail Users

13. In order to start using SquirrelMail webmail, you’ll have to create a new user, to do so, run.

$ sudo useradd myusername

Replace “myusername” with the user name you want, create a password for the new user by running.

$ sudo passwd myusername

14. Create a home folder for the user in /var/www/html/myusername and make it the default home directory.

$ sudo mkdir -p /var/www/html/myusername
$ usermod -m -d /var/www/html/myusername myusername

15. Now go back to the login page and enter the user name and the password of the newly created user.

Access Squirrelmail in Ubuntu
Access Squirrelmail

You will be surprised to see the following error message.

Login to Squirrelmail
Login to Squirrelmail

This is just a problem in the permissions, you have to give the user “myusername” the complete permissions on its home folder.

$ sudo chown -R myusername:myusername /var/www/html/myusername

16. Once permission set, you should able to login to SquirrelMail.

Squirrelmail Mail Interface
Squirrelmail Mail Interface

You can try to send email from it, or you can try to receive emails by sending it to “[email protected]ple.com”, don’t forget to replace “myusername” with the user name you created.

If you faced any other error… Just check the “/var/log/mail.err” file, all the error message will be stored there, you won’t lose your way 🙂

Have you tried to create an email server before? How did it go? Have you used SquirrelMail or any other mail server before? What do you think about it?

Related

Tags: Debian Tips, dovecot, postfix, squirrelmail, Ubuntu Tips

HardInfo – Check Hardware Information in Linux

Prev Post

How to Install VLC Media Player on Ubuntu 20.04

Next Post
Archives
  • January 2023
  • December 2022
  • November 2022
  • October 2022
  • September 2022
  • July 2022
  • June 2022
  • April 2022
  • March 2022
  • February 2022
  • January 2022
  • December 2021
  • November 2021
  • October 2021
  • September 2021
  • August 2021
  • July 2021
  • June 2021
  • May 2021
  • April 2021
  • March 2021
  • February 2021
  • January 2021
  • December 2020
  • November 2020
  • October 2020
  • September 2020
  • August 2020
  • July 2020
  • June 2020
  • May 2020
Categories
  • AlmaLinux
  • Android
  • Ansible
  • Apache
  • Arch Linux
  • AWS
  • Backups
  • Bash Shell
  • Bodhi Linux
  • CentOS
  • CentOS Stream
  • Chef
  • Cloud Software
  • CMS
  • Commandline Tools
  • Control Panels
  • CouchDB
  • Data Recovery Tools
  • Databases
  • Debian
  • Deepin Linux
  • Desktops
  • Development Tools
  • Docker
  • Download Managers
  • Drupal
  • Editors
  • Elementary OS
  • Encryption Tools
  • Fedora
  • Firewalls
  • FreeBSD
  • FTP
  • GIMP
  • Git
  • Hadoop
  • HAProxy
  • Java
  • Jenkins
  • Joomla
  • Kali Linux
  • KDE
  • Kubernetes
  • KVM
  • Laravel
  • Let's Encrypt
  • LFCA
  • Linux Certifications
  • Linux Commands
  • Linux Desktop
  • Linux Distros
  • Linux IDE
  • Linux Mint
  • Linux Talks
  • Lubuntu
  • LXC
  • Mail Server
  • Manjaro
  • MariaDB
  • MongoDB
  • Monitoring Tools
  • MySQL
  • Network
  • Networking Commands
  • NFS
  • Nginx
  • Nodejs
  • NTP
  • Open Source
  • OpenSUSE
  • Oracle Linux
  • Package Managers
  • Pentoo
  • PHP
  • Podman
  • Postfix Mail Server
  • PostgreSQL
  • Python
  • Questions
  • RedHat
  • Redis Server
  • Rocky Linux
  • Security
  • Shell Scripting
  • SQLite
  • SSH
  • Storage
  • Suse
  • Terminals
  • Text Editors
  • Top Tools
  • Torrent Clients
  • Tutorial
  • Ubuntu
  • Udemy Courses
  • Uncategorized
  • VirtualBox
  • Virtualization
  • VMware
  • VPN
  • VSCode Editor
  • Web Browsers
  • Web Design
  • Web Hosting
  • Web Servers
  • Webmin
  • Windows
  • Windows Subsystem
  • WordPress
  • Zabbix
  • Zentyal
  • Zorin OS
Visits
  • 1
  • 613
  • 570,968

DesignLinux.com © All rights reserved

Go to mobile version