Atlantic.Net Blog

How to Set Up a Fully-Featured Mail Server with IRedMail on Centos 7 VPS

iRedMail is a free, open-source and full-featured mail server solution that allows you to host your own mail server at no cost at all. iRedMail is a script that automatically installs and configures all necessary mail server components on your server, saving time. You can create unlimited mailboxes and unlimited mail domains using iRedMail’s web-based interface. If you are looking for a free and fully-fledged mail server solution without any headaches, then iRedMail is best choice for you. All components used in iRedMail are open source, including Postfix, Dovecot, Nginx, MariaDB, SpamAssassin, ClamAV, SOGo, Fail2ban, Roundcube and Netdata. You won’t need to pay any extra costs.

In this tutorial, we will learn how to install and configure an iRedMail server on Centos 7 VPS.

Step 1 – Disable Selinux

First, you will need to disable Selinux on your server. You can do this by editing /etc/selinux/config file:

nano /etc/selinux/config

Change the file as shown below:

SELINUX=disabled
SELINUXTYPE=targeted

Save and close the file. Then, restart your server to apply the changes.

Step 2 – Set the Hostname of Your Server

Next, you will need to set the hostname of your server. In this case, we will set a fully qualified domain name (FQDN) in /etc/hosts before we go further. You can set it by editing /etc/hosts file:

nano /etc/hosts

Change the file as shown below:

# Automatically generated
127.0.0.1 email.example.com mail localhost

Save and close the file. Then, run the following command to apply the configuration changes:

hostname -f

Step 3 – Install iRedMail

First, install some required packages with the following command:

yum install bzip2 nano wget -y

Next, you will need to download the latest version of iRedMail from their official download page. You can download it with the following command:

wget https://bitbucket.org/zhb/iredmail/downloads/iRedMail-0.9.9.tar.bz2

Once downloaded, extract the downloaded file with the following command:

 tar -jxvf iRedMail-0.9.9.tar.bz2

Next, change the directory to the extracted directory with the following command:

cd iRedMail-0.9.9

Next, run the iRedMail installation script as shown below:

bash iRedMail.sh

During the installation, you will need to answer several questions to setup iRedMail mail server.

First, you will be redirected to the iRedMail welcome screen as shown below:

Select Yes and press Enter to proceed with the installation. You should see the following screen:

Here, specify a directory to store mailboxes and click on the Next button. You should see the following screen:

Select a web server and click on the Next button. You should see the following screen:

Select a database and click on the Next button. You should see the following screen:

Specify a password for MySQL administrator and click on the Next button. You should see the following screen:

Specify a valid domain name and click on the Next button. You should see the following screen:

Specify a password for mail domain administrator. This will also used to login to webmail and iRedMail. Click on the Next button. You should see the following screen:

Select different components you want to install with iRedMail and click on the Next button. You should see the following output:

*************************************************************************
***************************** WARNING ***********************************
*************************************************************************
*                                                                       *
* Below file contains sensitive infomation (username/password), please  *
* do remember to *MOVE* it to a safe place after installation.          *
*                                                                       *
*   * /root/iRedMail-0.9.9/config
*                                                                       *
*************************************************************************
********************** Review your settings *****************************
*************************************************************************
* Storage base directory:               /var/vmail
* Mailboxes:                           
* Daily backup of SQL/LDAP databases:  
* Store mail accounts in:               MariaDB
* Web server:                           Nginx
* First mail domain name:               example.com
* Mail domain admin:                    [email protected]
* Additional components:                Roundcubemail netdata iRedAdmin
< Question > Continue? [y|N]y

Now, review all the options you have chosen, type y and press Enter to proceed with installation. Once the installation has been completed successfully, you should see the following output:

********************************************************************
* URLs of installed web applications:
*
* - Roundcube webmail: https://email.example.com/mail/
* - netdata (monitor): https://email.example.com/netdata/
*
* - Web admin panel (iRedAdmin): https://email.example.com/iredadmin/
*
* You can login to above links with below credential:
*
* - Username: [email protected]
* - Password: admin@123
*
*
********************************************************************
* Congratulations, mail server setup completed successfully. Please
* read below file for more information:
*
*   - /root/iRedMail-0.9.9/iRedMail.tips
*
* And it's sent to your mail account [email protected].
*
********************* WARNING **************************************
*
* Please reboot your system to enable all mail services.
*
********************************************************************

In the above output, you should see the URLs of all installed web applications.

Next, stop the freshclam service and update the ClamAV database with the following command:

systemctl stop clamav-freshclam
freshclam

Next, delete the iRedMail source directory with the following command:

rm -rf /root/iRedMail-0.9.9/

Finally, restart your server to enable all mail services.

Step 4 – Access iRedMail Web Interface

Now, open your web browser and type the URL https://email.example.com/iredadmin. You will be redirected to the iRedMail login screen:

Provide your administrator username and password. Then, click on the Login button. You should see the iRedMail dashboard in the following page:

Next, click on the Add > User button to create your first email account. You should see the following page:

Provide your username, password, and MailBox Quota and click on the Add button. Once the user is created successfully, you should see the following screen:

Next, open your web browser and type the URL https://email.example.com/mail to access the Roundcube webmail. You should see the following screen:

Now, provide your email username and password which you have created earlier and click on the Login button. You should see the Roundcube webmail dashboard in the following page:

You can now send and receive email with this interface.

You can also monitor your server performance with Netdata. To do so, open your web browser and type the URL https://email.example.com/netdata. You will be redirected to the Netdata dashboard in the following screen.

Conclusion

Congratulations! you have successfully installed and configured full-featured iRedMail server on Centos 7 VPS. You can now add more domains and email accounts to your mail server. If you’re ready to get started with iRedMail on Centos 7, get VPS hosting from Atlantic.Net today.

Get a $250 Credit and Access to Our Free Tier!

Free Tier includes:
G3.2GB Cloud VPS a Free to Use for One Year
50 GB of Block Storage Free to Use for One Year
50 GB of Snapshots Free to Use for One Year