Atlantic.Net Blog

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

Hitesh Jethva
by Atlantic.Net (6posts) under VPS Hosting
0 Comments

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.

Prerequisites

  • A fresh Centos 7 VPS on the Atlantic.Net Cloud with minimum 2 GB RAM.
  • A valid domain name pointed at your VPS IP address. In this tutorial, we will use email.example.com.
  • A & MX records for your server.

Note: You can refer to the Atlantic DNS Guide for info on how to manage DNS records.

Create Atlantic.Net Cloud Server

First, log in to your Atlantic.Net Cloud server.  Create a new server, choosing Centos 7 as the operating system with at least 2GB RAM. Connect to your Cloud server via SSH and log in using the credentials highlighted at the top of the page.

Once you are logged into your Centos 7 server, run the following command to update your base system with the latest available packages.

yum update -y

Getting Started

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.

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

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: [email protected]
*
*
********************************************************************
* 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.

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 started with 12 months of free cloud services

Free Tier includes:
G2.1GB Cloud Server Free to Use for One Year
50 GB of Block Storage Free to Use for One Year


New York, NY

100 Delawanna Ave, Suite 1

Clifton, NJ 07014

United States

San Francisco, CA

2820 Northwestern Pkwy,

Santa Clara, CA 95051

United States

Dallas, TX

2323 Bryan Street,

Dallas, Texas 75201

United States

Ashburn, VA

1807 Michael Faraday Ct,

Reston, VA 20190

United States

Orlando, FL

440 W Kennedy Blvd, Suite 3

Orlando, FL 32810

United States

Toronto, Canada

20 Pullman Ct, Scarborough,

Ontario M1X 1E4

Canada

London, UK

14 Liverpool Road, Slough,

Berkshire SL1 4QZ

United Kingdom

Resources

We use cookies for advertising, social media and analytics purposes. Read about how we use cookies in our updated Privacy Policy. If you continue to use this site, you consent to our use of cookies and our Privacy Policy.