iRedMail is a shell script that lets you quickly deploy a full-featured mail solution in less than 5 minutes on CentOS 5.x and Debian (Lenny) 5.0.1 and Ubuntu (it supports both i386 and x86_64). Its object is to make a Linux mail server installation and configuration simple and easy to use. iRedMail supports both OpenLDAP and MySQL as backends for storing virtual domains and users.This tutorial shows how to use the MYSQL as the backend.
admin account: Postmaster@test.vn Mail domain: test.vn Mail delivery (mailboxes) path: /home/vmail/domains
These settings might differ for you, so you have to replace them where appropriate.
Requirements
Install CentOS 5.x, I suggest to use the minimum install, make sure you don't install Apache, PHP and MySQL. You can remove them with yum if they are installed.Yum is working, because the installation needs to use CentOS source packages.
Following example based on a environment HostA is [192.168.0.19], HostB is [192.168.0.20]. [1] Install xinetd first. It's necessary on HostA.
[root@www ~]#yum -y install xinetd
[root@www ~]#vi /etc/xinetd.d/rsync
# default: off # description: The rsync server is a good addition to an ftp server, as it \ # allows crc checksumming etc. service rsync {
disable = no// change
socket_type = stream
wait = no
user = root
server = /usr/bin/rsync
server_args = --daemon
log_on_failure += USERID
}
[root@www ~]#/etc/rc.d/init.d/xinetd start Starting xinetd:[ OK ] [root@www ~]#chkconfig xinetd on [2] Config for HostA. This example based on a configuration to copy files under /var/www/html to HostB.
(1) cluster.test.vn [192.168.0.17] Pound server (2) www.test.vn [192.168.0.18] Web server #1 (3) www2.test.vn [192.168.0.21] Web server #2
In this example, Pound server listens HTTP requests, and if requests to jpg or gif files come, they are forwarded to (2)'s server, and if requests to files except jpg or gif, they are forwarded to (3)'s server. It's also necessary to set gateway router that HTTP requests are forwared to pound server first.
ucast eth1 10.0.0.21 auto_failback on node www1.test.vn node www2.test.vn respawn root /usr/lib/heartbeat/pingd -m 100 -d 5s -a default_ping_set
[4] Start HeartBeat on both server.
[root@www1 ~]#/etc/rc.d/init.d/heartbeat start Starting High-Availability services: [ OK ] [root@www1 ~]# chkconfig heartbeat on
[5] Run crm_mon on both server, then if following result is shown, it's OK, heartbeat running normally. These are Basical configuration of HeartBeat.
[root@www1 ~]# crm_mon -i 3 Defaulting to one-shot mode You need to have curses available at compile time to enable console mode ============ Last updated: Sun Jun 15 05:04:34 2008 Current DC: www2.test.vn (f8719a77-70b4-4e5f-851b-dafa7d65e2d3a2) 2 Nodes configured. 0 Resources configured. ============ Node: www2.test.vn (f8719a77-70b4-4e5f-851b-dafa7d65e2d3a2): online Node: www1.test.vn (2bbd6408-ec01-4b8c-bb8e-20723ee7af3a99): online
II/Configure 2 web servers for cluster. httpd is also needed.
The environment of 2 web servers are like below. And more, I set virual IP address [192.168.0.100].
(1) www1.test.vn eth0:192.168.0.21] [eth1:10.0.0.21] (2) www2.test.vn eth0:192.168.0.22] [eth1:10.0.0.22] (3) cluster.test.vn Virtual IP:192.168.0.100] [1] Configure like below on both Host. if httpd is running, stop it because they are controled by HeartBeat. [root@www1 ~]#/etc/rc.d/init.d/heartbeat stop Stopping High-Availability services:[ OK ] [root@www1 ~]# cd /var/lib/heartbeat/crm [root@www1 crm]#rm -f cib.xml.* [root@www1 crm]#vi cib.xml
[root@www1 crm]# cd [root@www1 ~]# vi /etc/httpd/conf/httpd.conf
[root@www1 ~]# /etc/rc.d/init.d/heartbeat start Starting High-Availability services: [ OK ]
[2] Run crm_mon after some time passed, then following result is shown, it's OK. httpd is running on primary server.
[root@www1 ~]#crm_mon -i 3 Defaulting to one-shot mode You need to have curses available at compile time to enable console mode ============ Last updated: Sun Jun 15 05:58:18 2008 Current DC: www2.test.vn (f8719a77-70b4-4e5f-851b-dafa7d65e2d3a2) 2 Nodes configured. 1 Resources configured. ============ Node: www1.test.vn (2bbd6408-ec01-4b8c-bb8e-20723ee7af3a99): online Node: www2.test.vn (f8719a77-70b4-4e5f-851b-dafa7d65e2d3a2): online Resource Group: group_apache
ipaddr (heartbeat::ocf:IPaddr): Started www1.test.vn
apache (heartbeat::ocf:apache): Started www1.test.vn
[3] Make test page on both servers and access to virtual IP. Primary server replys normally like below.
[4] Shutdown HeartBeat on primary server and verify if HeartBeat works or not.
[root@www1 ~]# /etc/rc.d/init.d/heartbeat stop Stopping High-Availability services:[ OK ]
Access to virtual IP address you set, then running server is switched normally like below [5] Start HeartBeat again on primary server and verify if HeartBeat works or not.
[root@www1 ~]#/etc/rc.d/init.d/heartbeat start Starting High-Availability services:[ OK ]
Other we can create cluster for FTP and another service by heartbeat.