Install iRedMail on Rocky Linux 8 [Step-by-Step]

Install iRedMail on Rocky Linux 8 - Introduction

Installing and configuring a Mail server can be quite a hectic and time-consuming process, even for users well versed with Linux systems. That's because mail servers contain so many components that need to be correctly configured and fine-tuned to communicate with each other. Luckily all that has been made easier with iRedMail.

iRedMail is an open-source mail server solution that installs and configures all the necessary components to build an email server. It runs on all the major Linux distributions and ships with the following essential packages that are installed automatically:

Advertisement
  • Postfix: SMTP server
  • Dovecot: POP3/POP3S, IMAP/IMAPS, Managesieve server
  • Nginx: Web server.
  • SpamAssassin for anti-spam
  • MySQL/PostgreSQL
  • mlmmj mailing list manager
  • OpenLDAP: Storing mail accounts.
  • Policyd (Postfix policy server)
  • Amavised-new for DKIM signing and verification
  • Roundcube webmail
  • Awstats: Apache and Postfix log analyzer.
  • iRedAPD Postfix policy server
  • Fail2ban: scans log files (e.g. /var/log/maillog) and bans IPs that show malicious system attempts.

This post will give you a detailed guide to install iRedMail on Rocky Linux 8. Let's dive in and get started setting up and installing iRedMail.

 

Pre-requisites

 

Step 1: Set a Static IP address

As a rule of thumb, update the system by executing the commands below to ensure you are using the latest packages:

sudo yum update
sudo yum upgrade

There are different methods you can use to set a static IP address. In this post, we will use the ifconfig command. Execute the ifconfig command to see your currently assigned address.

ifconfig

If you get an error like "-bash: ifconfig: command not found," execute the command below to install network tools.

sudo yum install net-tools

Sample Output:
Install iRedMail on Rocky Linux 8 [Step-by-Step]

 

From the image above, we can pick three main things that we will use to set up our static IP address:

Advertisement
  • Network interface: ens33
  • IP address: 192.168.1.61
  • Netmask value: 255.255.255.0

To set it as our static IP, we will use the syntax below:

ifconfig <interface> <IP Address> netmask <netmask_value>
e.g
ifconfig ens33 192.168.1.61 netmask 255.255.255.0

Sample Output:
Install iRedMail on Rocky Linux 8 [Step-by-Step]

 

Step 2: Setup an FDQN Hostname

When installing iRedMail, you need to set a Fully Qualified Domain Name (FQDN), else the system will output the error "Please configure a fully qualified domain name." For this post, we will set our FQDN to mail.golinux.lan. Execute the command below, replacing the FQDN (mail.golinux.lan) with your variable.

hostnamectl set-hostname mail.golinux.lan

You can verify if the hostname was set successfully by executing the commands below:

hostname -s # Short Name
hostname -f # FQDN
hostname -d # Domain Name

Sample Output:
Install iRedMail on Rocky Linux 8 [Step-by-Step]

If you do not have a DNS server then you can use /etc/hosts file to perform the FQDN lookup. We need to edit the /etc/hosts file and map the FQDN and short name to our local host address. Execute the command below to open the hosts file with the nano editor:

sudo nano /etc/hosts

Add the line below and remember to replace the FQDN and the short name

127.0.0.1 mail.golinux.lan mail localhost localhost.localdomain

Sample Output:
Install iRedMail on Rocky Linux 8 [Step-by-Step]

Advertisement

 

Step 3: Disable SELinux

For iRedMail to work correctly on your system, the developers insist on disabling SELinux before starting the installation process. Open the SELinux configuration file and change the status from enforcing or permissive to disabled. Use the command below to edit the config file.

sudo nano /etc/selinux/config

Sample Output:
Install iRedMail on Rocky Linux 8 [Step-by-Step]

Now reboot your system to apply the changes.

sudo reboot now

 

Step 4: Install the Necessary Packages and Download iRedMail

Execute the command below to install some packages that will come in handy when configuring iRedMail after installation.

yum install bzip2 net-tools bash-completion wget

Once done, we can now download iRedMail. Navigate to the official iRedMail website and copy the download link of the latest stable release. On your terminal, use the wget utility to download iRedMail, as shown below.

wget https://github.com/iredmail/iRedMail/archive/1.4.2.tar.gz

Sample Output:
Install iRedMail on Rocky Linux 8 [Step-by-Step]

iRedMail will be downloaded as a zipped file.

 

Step 5: Install iRedMail

Next we will extract the zipped file and install iredmail. Remember to replace the name of the zipped file accordingly.

tar -xvzf 1.4.2.tar.gz ## If it's a tar.gz file
tar xjf 1.4.1.tar.bz2 ## If it's a tar.bz2 file

When you run the ls command, you will see a new iRedMail folder. Navigate to that directory using the cd command as shown below:

cd iRedMail-1.4.2

When you run the ls command, you will see a script named iRedMail.sh. Make this script executable and run it using the commands below:

chmod +x iRedMail.sh
sudo bash iRedMail.sh

That will start the iRedMail installer, and a series of questions will pop up on your screen.

On the first welcome screen, select Yes and hit Enter.

NOTE:
Use the Tab key to navigate the various options on the prompt screens and the space key to select different options.

Install iRedMail on Rocky Linux 8 [Step-by-Step]

 

The next screen will prompt you to set a directory to store your mailboxes. By default, it's set to /var/vmail. We will leave it as default—hit Enter.

Install iRedMail on Rocky Linux 8 [Step-by-Step]

 

On the next screen, select the Nginx webserver. In earlier releases of iRedMail, users were given an option to choose between Apache and Nginx. As of writing this post, only the Nginx server is available.

Install iRedMail on Rocky Linux 8 [Step-by-Step]

 

Next, you will need to select a backend database that you wish to use. For this post, we will choose MariaDB. Hit Enter to continue.

Install iRedMail on Rocky Linux 8 [Step-by-Step]

 

Next, you will be prompted to set a strong password for your MySQL administrator. Note, the password cannot be empty and should not contain double quotes (").

Install iRedMail on Rocky Linux 8 [Step-by-Step]

 

On the next screen, you will be prompted to enter your first mail domain name. Enter the domain name you set as shown below and hit Enter to continue.

Install iRedMail on Rocky Linux 8 [Step-by-Step]

 

Next, you will need to set a password for the mail domain administrator. Note, white spaces, and special characters are not permitted in the password.

Install iRedMail on Rocky Linux 8 [Step-by-Step]

 

On the next screen, select additional components that you wish to use on your mail server. We highly recommend installing Roundcubemail, which will give you a web interface to manage your email accounts. However, you can easily install and configure Roundcube on another machine to free the mail server resources. Hit Enter to continue.

Install iRedMail on Rocky Linux 8 [Step-by-Step]

 

You will see a summary of the configurations you selected; if you are okay with what you see, type Y and hit Enter to start the install and configuration process.

Install iRedMail on Rocky Linux 8 [Step-by-Step]

 

This process might take some time to complete - please be patient. You will see prompts asking you to allow iRedMail to configure your Firewall and MySQL configurations: type Y and hit Enter. When the installation completes successfully, you will see the necessary information about your mail server. That includes URLs of installed web applications and the password of the postmaster administrator mail.

Install iRedMail on Rocky Linux 8 [Step-by-Step]

Reboot your system to enable the configured mail services.

sudo reboot now

When the system is back online, you can now start exploring your mail server. You can find the installation instructions in the directory created when you first extracted the iRedMail zip file to get started. The file containing the instructions is called iRedMail.tips. In our case, we can execute the command below to view the contents of the file.

cat iRedMail-1.4.2/iRedMail.tips

This information was also sent as an email to the postmaster@your_domain.tld created during the iRedMail installation.

 

Step 6: Access Webmail

On your browser, type the IP address of your system. You might see a warning that you are accessing an insecure site; click accept or continue. That will open the Roundcube login window.

Enter your postmaster email address and the password you set.

Install iRedMail on Rocky Linux 8 [Step-by-Step]

 

After a successful login, you should be able to access the administrator mailbox, which contains several emails with information about iRedMail installation.

Install iRedMail on Rocky Linux 8 [Step-by-Step]

 

Step-7: Add additional User Accounts

To add additional mail accounts, navigate to the iRedAdmin admin portal by typing your_ip_address/iredadmin on your web browser. You will see a login prompt. Login using the postmaster admin email and password as shown below.

Install iRedMail on Rocky Linux 8 [Step-by-Step]

 

After a successful login, you should see the iRedAdmin Dashboard as in the image below. To add new user accounts, simply click on the +Add button and select user.

Install iRedMail on Rocky Linux 8 [Step-by-Step]

 

Conclusion

That's it! By now, I believe you have a working mail server configured on your system. Setting up a full-featured mail server manually all by yourself can be quite hectic. Luckily, iRedMail provides an installation script that makes the whole process easy. Did you come across any issues or have any suggestions? Please feel free to leave a comment below.

 

Didn't find what you were looking for? Perform a quick search across GoLinuxCloud

If my articles on GoLinuxCloud has helped you, kindly consider buying me a coffee as a token of appreciation.

Buy GoLinuxCloud a Coffee

For any other feedbacks or questions you can either use the comments section or contact me form.

Thank You for your support!!

4 thoughts on “Install iRedMail on Rocky Linux 8 [Step-by-Step]”

    • let’s encrypt requires a registered domain name, which I unfortunately don’t have at the moment. If it helps I can write an article to use openssl to generate and use certificates with iredmail GUI.

      Reply
        • I just checked, by default iRedMail will get deployed with certificates

          [root@mail ~]# ls -l /etc/pki/tls/certs/iRedMail.crt
          -rw-r--r--. 1 root root 2179 Oct  4 15:19 /etc/pki/tls/certs/iRedMail.crt
          
          [root@mail ~]# ls -l /etc/pki/tls/private/iRedMail.key
          -rw-r--r--. 1 root root 3272 Oct  4 15:19 /etc/pki/tls/private/iRedMail.key

          If you want to add your own certificate, then you can just overwrite these files with your cert and key. Next restart following services:
          Postfix, Dovecot, Nginx or Apache

          Depends on the backend you chose during iRedMail installation, you may need to restart:
          MySQL or MariaDB, PostgreSQL, OpenLDAP

          Reply

Leave a Comment