From iRedMail
Revision as of 09:18, 22 October 2013 by ZhangHuangbin (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search



This article describes how to install iRedMail (iRedMail-0.8.6 or later releases) with a remote MySQL server. We use below server IP addresses in our example:

  • Remote MySQL server.
  • iRedMail server. We're going to install the latest iRedMail on this server.

iRedMail won't install MySQL server (RPM/DEB package) on localhost with remote MySQL server, but MySQL client tools are still required for remote connection.


Requirements for iRedMail

This article is applicable to iRedMail-0.8.6 or later releases, for MySQL backend.

Requirements for remote MySQL server

In our case, remote MySQL server runs on server It must accept remote connection from iRedMail server BEFORE installing, and we should create a new SQL user with password and proper privileges for remote login from iRedMail server.

Please make sure your remote MySQL server accepts remote request from iRedMail server. For example, on Linux, you can check it with command netstat:

# netstat -ntlp | grep 3306
tcp        0      0  *               LISTEN      2479/mysqld

If MySQL server is listening on only, you should comment out bind-address parameter in MySQL config file my.cnf to make it listen on all available network interfaces, and restart MySQL service.

  • On Red Hat Enterprise Linux, CentOS, openSUSE, OpenBSD, it's /etc/my.cnf.
  • On Debian, Ubuntu, it's /etc/mysql/my.cnf.
  • On FreeBSD, it's /var/db/mysql/my.cnf.
File: my.cnf
#bind-address =
  • Please make sure remote MySQL request will not be blocked by network firewall like iptables (Linux), ipfw (FreeBSD) or PF (OpenBSD).
  • Create a new SQL user (admin_iredmail) with new password (admin_password) and all privileges on remote MySQL server:
mysql> GRANT ALL PRIVILEGES ON *.* TO 'admin_iredmail'@'' IDENTIFIED BY 'admin_password' WITH GRANT OPTION;

With above commands, MySQL user 'admin_iredmail' is allowed to connect from IP address '' with password 'admin_password'.


  • 'WITH GRANT OPTION' in above SQL command is required.
  • Of course you can use 'root' or other name as remote MySQL user name in above SQL command, but a custom user name should be better to help you understand what it's used for, and less confuse with default 'root' user.
  • You must replace '' by the real IP address of your iRedMail server in above command.
  • It's recommended to delete this user AFTER iRedMail installation, it won't be used anymore.

If you tried to install iRedMail with this remote MySQL server before, please drop existing databases and MySQL users which will be created by iRedMail on remote MySQL server:

mysql> DROP DATABASE amavisd;
mysql> DROP DATABASE cluebringer;
mysql> DROP DATABASE iredadmin;
mysql> DROP DATABASE roundcubemail;
mysql> DROP DATABASE vmail;

mysql> DROP USER 'amavisd'@'';
mysql> DROP USER 'cluebringer'@'';
mysql> DROP USER 'iredadmin'@'';
mysql> DROP USER 'roundcube'@'';
mysql> DROP USER 'vmail'@'';
mysql> DROP USER 'vmailadmin'@'';

Install iRedMail

Please follow iRedMail installation guide strictly, but start iRedMail installer with below command instead of the original one (bash


It will launch iRedMail installer as usual. When it asks MySQL root username, please input the password ('admin_password' in our case) we created on remote MySQL server before installing iRedMail.

Parameters we used in above command line:

  • MYSQL_SERVER: Remote MySQL server address.
  • MYSQL_ROOT_USER: MySQL user name we created on remote MySQL server before installing iRedMail.
  • MYSQL_GRANT_HOST: Hostname (IP address of iRedMail server in our case) which should be granted with proper privileges on remote MySQL server. This is used in iRedMail installer, it will create new SQL users for applications like Postfix, Amavisd, Cluebringer, etc, and grant proper privileges to sql users which will connect from iRedMail server.

One more optional parameter is MYSQL_SERVER_PORT. it specifies listen port of remote MySQL server. Default one is 3306, you can change it if it's running on a different port.

After iRedMail installation

  • As mentioned above, it's now ok to delete the new MySQL user 'admin_iredmail' on remote MySQL server. It will not be used anymore.
mysql> DROP USER 'admin_iredmail'@'';
Personal tools