Install iRedMail (Mail Server) on CentOS 7 & RHEL 7
iRedMail is a full-featured mail server solution, it provides basic features like unlimited virtual mail accounts, POP3/IMAP/SMTP, AJAX webmail. Below are some highlights :
Highlight features
In this article we will demonstrate how to install and configure iRedMail on CentOS 7 & RHEL 7.
- OS = CentOS 7 or RHEL 7
- Domain = hackthesec.co.in
- Server Hostname = mail.hackthesec.co.in
In case if you want mails from your mail server to be delivered in inbox not in spam folder then update the DNS records like A & PTR before installation and TXT ( SPF & DKIM ) after installation.
Step:1 Set hostname and disable Selinux.
Set the proper hostname using hostnamectl command if it is not set.
[root@hackthesec ~]# hostnamectl set-hostname mail.hackthesec.co.in
[root@hackthesec ~]# hostname -f
mail.hackthesec.co.in
Update the /etc/hosts file
127.0.0.1 mail.hackthesec.co.in localhost.localdomain localhost
Disable Selinux
[root@hackthesec ~]# setenforce 0
Edit the file /etc/sysconfig/selinux , set the parameter “SELINUX=disabled” , Reboot the server to disable selinux completely.
Step:2 Download the tar file of iRedmail.
Download the latest version of iRedmail from their
Official Web Site or use below wget command to download from terminal.
[root@hackthesec ~]# wget https://bitbucket.org/zhb/iredmail/downloads/iRedMail-0.9.4.tar.bz2
Step:3 Extract the tar file & execute installation Script.
[root@hackthesec ~]# ll
total 124
-rw-r--r-- 1 root root 126277 Feb 15 19:12 iRedMail-0.9.4.tar.bz2
[root@hackthesec ~]#
[root@hackthesec ~]# tar -jxvf iRedMail-0.9.4.tar.bz2
[root@hackthesec ~]# cd iRedMail-0.9.4
[root@hackthesec iRedMail-0.9.4]# sh iRedMail.sh
After couple of seconds , below screen will appear , Select yes and press enter.
Define the folder or directory where users mailbox will be stored.
Select the web Server for iRedmail. Default is Nginx.
Select the database of your choice which will store domain names and mail accounts. In my case i am using MariaDB.
Define the domain name for your mail server. In my case domain name is “hackthesec.co.in”
Set Password for postmaster account.
Select Optional Components of iRedmail installation
Press “y” to continue installation, Mail Server info & Credentials are kept in the file “/root/iRedMail-0.9.4/config”. Please keep this file in secure place.
*************************************************************************
*****************************WARNING*************************************
*************************************************************************
*
* Below file contains sensitive information (username/password), please *
* do remember to *MOVE* it to a safe place after installation. *
* *
* * /root/iRedMail-0.9.4/config
* *
*************************************************************************
*****************************Review your settings************************
*************************************************************************
* Storage base directory: /var/vmail
* Mailboxes: /var/vmail/vmail1
* Daily backup of SQL/LDAP databases: /var/vmail/backup
* Store mail accounts in: MariaDB
* Web server: Nginx
* First mail domain name: hackthesec.co.in
* Mail domain admin: postmaster@hackthesec.co.in
* Additional components: iRedAdmin Roundcubemail SOGo Awstats Fail2ban
< Question > Continue? [y|N]y
*****************************************************************
*URL of Installed web applications:
*
* - Roundcube webmail: https://mail.hackthesec.co.in/mail
* - SOGo groupware: https://mail.hackthesec.co.in/SOGo/
*
* - Web admin panel (iRedAdmin): https://mail.hackthesec.co.in/iredadmin/
*
* You can login to above links with below credential:
*
* - Username: postmaster@hackthesec.co.in
* - Password: 123456
*
*
******************************************************************
* Congratulations, mail server setup completed successfully.
* Please read the below file for more information:
*
* - /root/iRedMail-0.9.4/iRedMail.tips
*
* And it's sent to your mail account postmaster@hackthesec.co.in
*
**************************WARNING**********************************
*
*Please reboot your system to enable all mail services.
*
***************************************************************
As per instructions , reboot the server to enable all mail services.
Postfix mail logs and iRedmail logs are stored in “/var/log/maillog” and “/var/log/iredapd/iredapd.log” respectively.
Note : Default administrator name is “postmaster@hackthesec.co.in”
Following are the Important URLs after the Installation is completed , replace the domain name as per your setup in mentioned URLs.
iRedAdmin – official web-based admin panel:
https://mail.hackthesec.co.in/iredadmin/
Username: postmaster@hackthesec.co.in, password: 123456
Roundcube webmail URL :
http://mail.hackthesec.co.in/mail/
SOGo Groupware
https://mail.hackthesec.co.in/SOGo/
Step:4 Create Users & domain from Admin Panel.
To create users first login to admin panel. Use user name as “postmaster@<domain>” and password that we set during installation.
After Login Done. Create a user...
Add a new Domain :
From the admin Panel , Select “Domain & accounts” option and then click on Add domain
Step:5 Access Roundcube (Webmail).
Open the url in the browser “https://mail.hackthesec.co.in/mail/” , replace the domain name as per your setup.