2016-05-19 06:51:20 -05:00
<!DOCTYPE html>
2015-02-05 01:27:55 -06:00
< html >
< head >
< meta http-equiv = "Content-Type" content = "text/html; charset=utf-8" / >
< title > Install iRedMail with a remote MySQL server< / title >
2015-07-31 23:14:52 -05:00
< link rel = "stylesheet" type = "text/css" href = "./css/markdown.css" / >
2015-02-05 01:27:55 -06:00
< / head >
< body >
< div id = "navigation" >
2016-04-19 12:48:51 -05:00
< a href = "/index.html" target = "_blank" >
< img alt = "iRedMail web site"
src="./images/logo-iredmail.png"
style="vertical-align: middle; height: 30px;"
/>
< span > iRedMail< / span >
< / a >
2016-02-29 02:15:19 -06:00
// < a href = "./index.html" > Document Index< / a > < / div > < h1 id = "install-iredmail-with-a-remote-mysql-server" > Install iRedMail with a remote MySQL server< / h1 >
2015-02-05 01:27:55 -06:00
< div class = "toc" >
< ul >
< li > < a href = "#install-iredmail-with-a-remote-mysql-server" > Install iRedMail with a remote MySQL server< / a > < ul >
< li > < a href = "#summary" > Summary< / a > < / li >
< li > < a href = "#requirements" > Requirements< / a > < / li >
< li > < a href = "#install-iredmail" > Install iRedMail< / a > < / li >
< li > < a href = "#after-iredmail-installation" > After iRedMail installation< / a > < / li >
< / ul >
< / li >
< / ul >
< / div >
< h2 id = "summary" > Summary< / h2 >
< p > This article describes how to install iRedMail (iRedMail-0.8.6 or later
releases) with a remote MySQL server, and you must choose MySQL backend in
iRedMail installation wizard.< / p >
< p > We use below server IP addresses in our example:< / p >
< ul >
< li > < code > 192.168.1.100< / code > : Remote MySQL server.< / li >
< li > < code > 192.168.1.200< / code > : iRedMail server. We're going to install the latest iRedMail
on this server.< / li >
< / ul >
< p > 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.< / p >
< h2 id = "requirements" > Requirements< / h2 >
< p > In our case, remote MySQL server runs on server < code > 192.168.1.100< / code > . It must accept
remote connection from iRedMail server < strong > BEFORE< / strong > installing iRedMail, and we
must create a new SQL user with password and proper privileges for remote login
from iRedMail server (< code > 192.168.1.200< / code > in our case).< / p >
< ul >
< li > Make sure your remote MySQL server accepts remote connection from iRedMail
server. For example, you can check it with command < code > netstat< / code > :< / li >
< / ul >
< pre > < code > # netstat -ntlp | grep 3306
tcp 0 0 0.0.0.0:3306 0.0.0.0:* LISTEN 2479/mysqld
< / code > < / pre >
< p > If MySQL server is listening on only 127.0.0.1, you should comment out
< code > bind-address< / code > parameter in MySQL config file < code > my.cnf< / code > to make it listen on all
available network interfaces, and restart MySQL service.< / p >
< ul >
< li > On Red Hat Enterprise Linux, CentOS, openSUSE, OpenBSD, it's < code > /etc/my.cnf< / code > .< / li >
< li > On Debian, Ubuntu, it's < code > /etc/mysql/my.cnf< / code > .< / li >
< li > On FreeBSD, it's < code > /var/db/mysql/my.cnf< / code > .< / li >
< / ul >
< pre > < code > #bind-address = 127.0.0.1
< / code > < / pre >
< ul >
< li >
< p > Make sure remote MySQL request will not be blocked by network firewall like
iptables (Linux), ipfw (FreeBSD) or PF (OpenBSD).< / p >
< / li >
< li >
< p > Create a new SQL user (< code > admin_iredmail< / code > ) with new password (< code > admin_password< / code > )
and all privileges on remote MySQL server (of course you must choose another
strong password):< / p >
< / li >
< / ul >
< pre > < code > mysql> GRANT ALL PRIVILEGES ON *.* TO 'admin_iredmail'@'192.168.1.200' IDENTIFIED BY 'admin_password' WITH GRANT OPTION;
mysql> FLUSH PRIVILEGES;
mysql> FLUSH HOSTS;
< / code > < / pre >
< p > With above commands, MySQL user < code > admin_iredmail< / code > is allowed to connect from IP
address < code > 192.168.1.200< / code > with password < code > admin_password< / code > .< / p >
< p > < strong > Notes< / strong > :< / p >
< ul >
< li > < code > WITH GRANT OPTION< / code > in above SQL command is required.< / li >
< li > Of course you can use < code > root< / code > or other MySQL user 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 < code > root< / code > user.< / li >
< li > You must replace < code > 192.168.1.200< / code > by the real IP address of your iRedMail
server in above command.< / li >
< li > It's recommended to delete this user AFTER iRedMail installation, it won't
be used anymore. We will give you SQL command to delete it later.< / li >
< / ul >
< p > If you tried to install iRedMail with this remote MySQL server before, please
2015-04-05 22:31:42 -05:00
backup existing databases < strong > on remote MySQL server first< / strong > , then drop them and
delete related MySQL users, because they will be created by iRedMail
automatically on remote MySQL server:< / p >
2015-02-05 01:27:55 -06:00
< pre > < code > mysql> DROP DATABASE amavisd;
mysql> DROP DATABASE cluebringer;
mysql> DROP DATABASE iredadmin;
mysql> DROP DATABASE roundcubemail;
2015-04-05 22:31:42 -05:00
mysql> DROP DATABASE sogo;
2015-02-05 01:27:55 -06:00
mysql> DROP DATABASE vmail;
mysql> DROP USER 'amavisd'@'192.168.1.200';
mysql> DROP USER 'cluebringer'@'192.168.1.200';
mysql> DROP USER 'iredadmin'@'192.168.1.200';
mysql> DROP USER 'roundcube'@'192.168.1.200';
2015-04-05 22:31:42 -05:00
mysql> DROP USER 'sogo'@'192.168.1.200';
2015-02-05 01:27:55 -06:00
mysql> DROP USER 'vmail'@'192.168.1.200';
mysql> DROP USER 'vmailadmin'@'192.168.1.200';
< / code > < / pre >
< h2 id = "install-iredmail" > Install iRedMail< / h2 >
< p > Please follow iRedMail installation guide strictly, but start iRedMail
installer with below command instead of the original one (< code > bash iRedMail.sh< / code > ):< / p >
2015-09-21 06:04:05 -05:00
< blockquote >
2015-09-29 01:27:10 -05:00
< p > WARNING:< / p >
< ul >
2015-12-03 20:13:59 -06:00
< li > The variable names (< code > MYSQL_SERVER_ADDRESS< / code > , < code > MYSQL_SERVER_PORT< / code > ,
< code > MYSQL_ROOT_USER< / code > , < code > MYSQL_GRANT_HOST< / code > ) are < strong > CASE SENSITIVE< / strong > .< / li >
< li > With < code > iRedMail-0.9.2< / code > and earlier releases, it's < code > MYSQL_SERVER< / code > , not
< code > MYSQL_SERVER_ADDRESS< / code > .< / li >
2015-09-29 01:27:10 -05:00
< / ul >
2015-09-21 06:04:05 -05:00
< / blockquote >
2015-12-30 09:42:21 -06:00
< pre > < code > # MYSQL_SERVER_ADDRESS='192.168.1.100' MYSQL_SERVER_PORT='3306' MYSQL_ROOT_USER='admin_iredmail' MYSQL_ROOT_PASSWD='admin_password' MYSQL_GRANT_HOST='192.168.1.200' bash iRedMail.sh
2015-02-05 01:27:55 -06:00
< / code > < / pre >
2015-12-30 09:42:21 -06:00
< p > It will launch iRedMail installation wizard as usual.< / p >
2015-02-05 01:27:55 -06:00
< p > Parameters we used in above command line:< / p >
< ul >
2015-12-03 20:13:59 -06:00
< li > < code > MYSQL_SERVER_ADDRESS< / code > : Remote MySQL server address.< / li >
< li > < code > MYSQL_SERVER_PORT< / code > : Remote MySQL server port. Default is < code > 3306< / code > .< / li >
2015-02-05 01:27:55 -06:00
< li > < code > MYSQL_ROOT_USER< / code > : MySQL user name we created on remote MySQL server before installing iRedMail.< / li >
2015-12-30 09:42:21 -06:00
< li > < code > MYSQL_ROOT_PASSWD< / code > : MySQL password that we created on remote MySQL server before installing iRedMail.< / li >
2015-02-05 01:27:55 -06:00
< li > < code > MYSQL_GRANT_HOST< / code > : Hostname or IP address of iRedMail server.< / li >
< / ul >
< p > iRedMail will create new SQL users for applications like Postfix, Amavisd,
Roundcube webmail, etc, and grant proper privileges to them which will connect
from iRedMail server.< / p >
< p > One more optional parameter is < code > MYSQL_SERVER_PORT< / code > . it specifies listen port
of remote MySQL server. Default one is < code > 3306< / code > , you can change it if remote
MySQL server is running on a different port.< / p >
< h2 id = "after-iredmail-installation" > After iRedMail installation< / h2 >
< p > As mentioned above, it's now ok to delete the new MySQL user < code > admin_iredmail< / code >
on remote MySQL server. It will not be used anymore.< / p >
< pre > < code > mysql> DROP USER 'admin_iredmail'@'192.168.1.200';
2016-05-19 06:51:20 -05:00
< / code > < / pre > < div class = "footer" >
< p style = "text-align: center; color: grey;" > All documents are available in < a href = "https://bitbucket.org/zhb/iredmail-docs/src" > BitBucket repository< / a > , and published under < a href = "http://creativecommons.org/licenses/by-nd/3.0/us/" target = "_blank" > Creative Commons< / a > license. You can < a href = "https://bitbucket.org/zhb/iredmail-docs/get/tip.tar.bz2" > download the latest version< / a > for offline reading. If you found something wrong, please do < a href = "http://www.iredmail.org/contact.html" > contact us< / a > to fix it.< / p >
< / div >
< script type = "text/javascript" >
2015-02-05 07:02:53 -06:00
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
ga('create', 'UA-3293801-21', 'auto');
ga('send', 'pageview');
2015-02-05 01:27:55 -06:00
< / script >
< / body > < / html >