Setting up your own email server on Linux from scratch is a long and tedious process, a pain in the butt if you are not an advanced user. This tutorial will be showing you how to use iRedMail to quickly set up a full-featured mail server on CentOS 7, saving you lots of time and headaches.
What is iRedMail?
iRedMail is a shell script that automatically installs and configures all necessary mail server components on your Linux/BSD server, thus eliminating manual installation and configuration. With iRedMail, you can easily create unlimited mailboxes and unlimited mail domains in a web-based admin panel. Mailboxes can be stored in MariaDB/MySQL, PostgreSQL database, or OpenLDAP. The following is a list of open-source software that will be automatically installed and configured by iRedMail.
- Postfix SMTP server
- Dovecot IMAP server
- Nginx web server to serve the admin panel and webmail
- OpenLDAP, MySQL/MariaDB, or PostgreSQL for storing user information
- Amavised-new for DKIM signing and verification
- SpamAssassin for anti-spam
- ClamAV for anti-virus
- Roundcube webmail
- Fail2ban for protecting SSH
- mlmmj mailing list manager
- Netdata server monitoring
- iRedAPD Postfix policy server for greylisting
To log into your server, you use an SSH client. If you are using Linux or macOS on your computer, then simply open up a terminal window and run the following command to log into your server. Replace public-ip
with your server’s IP address.
ssh root@public-ip
Step 2: Creating DNS MX Record
- rDNS -> You Must Have For Your IPv4 Address
- Set PTR Record For Domain As -> smtp.learnlinux.in
- here smtp refers to an Public ipv4 address
- Create MX @ smtp.learnlinux.in TTL
Step 3: Configuring Hostname
Log into your server via SSH, then run the following command to update existing software packages.
sudo yum update -y
And set a fully qualified domain name (FQDN) for your server with the following command.
sudo hostnamectl set-hostname mail.your-domain.com
We also need to update /etc/hosts
file with a command-line text editor like Nano.
sudo nano /etc/hosts
127.0.0.1 mail.your-domain.com localhost
Save and close the file. (To save a file in Nano text editor, press Ctrl+O
, then press Enter
to confirm. To close the file, press Ctrl+X
.)
To see the changes, re-login and run the following command to see your hostname.
hostname -f
Step 4: Setting up Mail Server on CentOS
Run the following commands to download the latest version of iRedMail script installer from its Github repository.
sudo dnf install wget tar -y
wget https://github.com/iredmail/iRedMail/archive/1.3.2.tar.gz
tar xvf 1.3.2.tar.gz
cd iRedMail-1.3.2/
chmod +x iRedMail.sh
sudo bash iRedMail.sh
More Stories
Squid Proxy
Firewall
Zimbra Troubleshooting