Jump to content

OpenEMM installation

From TetraWiki
Revision as of 11:15, 30 July 2012 by Raunaq (talk | contribs) (=)

OpenEMM Installation GUIDE for Red Hat and compatible Linux distributions




1. Download binary tarball to directory /tmp from web address

http://sourceforge.net/projects/openemm/files/ 


2. Package Installation :

#yum install mysql-server sendmail-cf MySQL-python libxml2


Check package of “make”, if not installed then install it.

#yum install make 


3. Installation: Sun Java JDK : download and install JDK

http://www.oracle.com/technetwork/java/javase/downloads/jdk-6u26-download-400750.html 

Copy the file to your /tmp directory:

#cp jdk-6u18-linux-i586.bin /tmp 
#cd /tmp 
#chmod u+x jdk-6u18-linux-i586.bin 
#./jdk-6u18-linux-i586.bin 
#mkdir -p /opt/openemm.org/software 
#mv jdk1.6.0_18 /opt/openemm.org/software 
#cd /opt/openemm.org/software 
#ln -s jdk1.6.0_18 java 
#/opt/openemm.org/software/java/bin/java -version 

You should get an output like this:

java version "1.6.0_18" 
Java(TM) SE Runtime Environment (build 1.6.0_18-b01) 
Java HotSpot(TM) Client VM (build 14.2-b01, mixed mode, sharing) 


4. Create a special group and user for OpenEMM: Add a group "openemm" and after that add user "openemm"

#groupadd openemm  
#useradd -m -g openemm -d /home/openemm -c "OpenEMM 6.x.x" openemm  


5. Installation of OpenEMM 6.x.x:

#cp OpenEMM-6.2-bin.tar.gz /home/openemm 
#cd /home/openemm 
#tar -xzvpf OpenEMM-6.2-bin.tar.gz 
#mkdir -p /usr/share/doc/OpenEMM-6.2 
#cp USR_SHARE/* /usr/share/doc/OpenEMM-6.2  


6. Read Access to Maillog :

#vi /etc/logrotate.d/syslog 
and add the following line after the line sharedscripts: 
create 0604  
#chmod 604 /var/log/maillog

7. Initialize/Update the OpenEMM and the OpenEMM CMS Database :

#/etc/init.d/mysqld restart 

give the root password for mysql:

#mysqladmin -u root password  YOUR_PASSWORD 
  • In case you want to setup the OpenEMM database from scratch:

Create data base for openemm:

#mysqladmin -u root -p YOUR_PASSWORD create openemm 
#mysql -u root -p YOUR_PASSWORD openemm < database_backup.sql 
  • If you make server first time
#cd /usr/share/doc/OpenEMM-6.2 
#mysqladmin -u root -p YOUR_PASSWORD create openemm 

If you plan to use the redirect features of OpenEMM, open .sql file with a text editor like edit or vim, and find and replace the string "http://localhost:8080" with a valid redirection URL. In our example it is "http://www.openemm.org:8080"

Finally, load the OpenEMM database layout by

#mysql -u root -p YOUR_PASSWORD openemm < openemm-6.2.sql 

Give full permission to user for acces the data bases:

#mysql -u root -p YOUR_PASSWORD 
mysql> GRANT DELETE, INSERT, UPDATE, LOCK TABLES, SELECT, ALTER, INDEX, CREATE TEMPORARY TABLES, DROP, CREATE ON openemm.* TO 'agnitas'@'localhost' IDENTIFIED BY 'openemm'; 
mysql> FLUSH PRIVILEGES; 
mysql> quit; 

Replace the generic string "http://localhost:8080" with the domain name of your server (like "http://www.domain.com:8080") in these files:

- /usr/share/doc/OpenEMM-6.2/openemm-6.2.sql (once) 
- /home/openemm/webapps/core/WEB-INF/classes/emm.properties (twice) 
- /home/openemm/webapps/core/WEB-INF/classes/cms.properties (once) 


8. Database tuning :

#mysql -uroot -pYOUR_PASSWORD
mysql> use <DATABASENAE>; 
mysql> CREATE INDEX onpx$mid_cuid$idx ON onepixel_log_tbl (mailing_id, customer_id); 
mysql> CREATE INDEX rlog$mid_cuid_urlid$idx ON rdir_log_tbl (mailing_id, customer_id, url_id); 
mysql> quit; 
#vi /etc/my.cnf 

enter these lines in [mysqld] section:

---------------------------------------------- 
key_buffer_size=64M 
max_connections=50 
max_heap_table_size=32M 
query_cache_size=32M 
read_buffer_size=512K 
table_cache=128 
----------------------------------------------

9. Configuration of Sendmail : Open file /etc/mail/sendmail.mc and change the line

DAEMON_OPTIONS(`Port=smtp,Addr=127.0.0.1, Name=MTA')dnl 

to

dnl DAEMON_OPTIONS(`Port=smtp,Addr=127.0.0.1, Name=MTA')dnl 

optional information:


This will enable Sendmail to listen on all available network interfaces. By default Sendmail is listing only on the local interface lo0 for connections. Add the following line at the end of the file:

INPUT_MAIL_FILTER(`bav', `S=unix:/home/openemm/var/run/bav.sock, F=T')dnl 

This will enable the dynamic mail loop required by the bounce management to process delayed bounces.

If file /etc/mail/relay-domains does not exist, create the file - for example by

#touch relay-domains 

and add a line at the end of the file which specifies your DNS entry for the sender hostname (FQDN). In our example it is simply:

newsletter.tetra.in 
 

open file /etc/mail/mailertable and add a line at the end which activates the bounce management for that FQDN:

news.openemm.org procmail:/home/openemm/conf/bav/bav.rc 


10. Make change in sendmail file and activate all Sendmail changes, run the following commands:

#cd /etc/mail 
#vi sendmail.cf 

and make change in this section:

# SMTP client options 
#O ClientPortOptions=Family=inet, Address=0.0.0.0 
O ClientPortOptions=Family=inet, Address=MAIN_IP
#make 
Restart the Sendmail service by 
#/etc/init.d/sendmail restart 


11. Create scripts:

IP rotation script:

===============================================================================
#vi /usr/sbin/ipchange-sendmail.sh 
#!/bin/sh 
cp -pf /etc/mail/sendmail.cf /etc/mail/sendmail.cf.backuP 
ADDR=$(grep -r "ClientPortOptions" /etc/mail/sendmail.cf |gawk -F ","  '{print$2}') 
if [ $ADDR = "Address=74.117.62.179" ]; then 
sed '/ClientPortOptions/ c\O
ClientPortOptions=Family=inet,Address=216.24.197.44'  
/etc/mail/sendmail.cf > /tmp/temp135 ; cat /tmp/temp135 > /etc/mail/sendmail.cf
;  /etc/init.d/sendmail reload 
fi 
if [ $ADDR = "Address=216.24.197.44" ]; then 
sed '/ClientPortOptions/ c\O
ClientPortOptions=Family=inet,Address=216.24.197.37'  
/etc/mail/sendmail.cf > /tmp/temp135 ; cat /tmp/temp135 > /etc/mail/sendmail.cf
;  /etc/init.d/sendmail reload 
fi 


Mail log truncating script:

===================================================================
#vi /usr/bin/truncate-maillog.sh 
#!/bin/sh 
> /var/log/maillog 
> /var/log/maillog.1 
> /var/log/maillog.2 
> /var/log/maillog.3 
> /var/log/maillog.4 
===================================================================

OpenEMM Start & Stop script:

===================================================================
#vi /usr/bin/openemm-start-stop.sh 
#!/bin/sh 
sh /usr/sbin/ipchange-sendmail.sh 
sleep 5 
su - openemm -c "OpenEMM.sh stop" 
sleep 5 
su - openemm -c "OpenEMM.sh start" 
===================================================================

12. Set permissions to the scripts:

#chmod 755 /usr/sbin/ipchange-sendmail.sh 
#chmod 755 /usr/bin/truncate-maillog.sh 
#chmod 755 /usr/bin/openemm-start-stop.sh 

13. Install cron job package:

#yum install vixie-cron

Set crond jobs:

#crontab -l 
#3 2,8,14 * * * sh /usr/sbin/ipchange-sendmail.sh 
1 23 * * * sh /usr/bin/truncate-maillog.sh 
20 2,4,6,8,10,12,14,16,20,22,0 * * * sh /usr/bin/openemm-start-stop.sh 


14. Make iptables rules :

===================================================================
  1. vi /etc/sysconfig/iptables
# Generated by iptables-save v1.3.5 on Mon Apr 18 11:16:46 2011 
  • nat
:PREROUTING ACCEPT [512:30020] 
:POSTROUTING ACCEPT [0:0] 
:OUTPUT ACCEPT [0:0] 
-A PREROUTING -i eth+ -p tcp -m tcp --dport 80 -j REDIRECT --to-ports 8080 
COMMIT  
# Completed on Mon Apr 18 11:16:46 2011 
# Generated by iptables-save v1.3.5 on Mon Apr 18 11:16:46 2011 
*filter 
:INPUT ACCEPT [0:0] 
:FORWARD ACCEPT [0:0] 
:OUTPUT ACCEPT [754:122540] 
:RH-Firewall-1-INPUT - [0:0] 
-A INPUT -j RH-Firewall-1-INPUT 
-A INPUT -p tcp -m tcp --dport 25 -j ACCEPT 
-A FORWARD -j RH-Firewall-1-INPUT 
-A RH-Firewall-1-INPUT -i lo -j ACCEPT 
-A RH-Firewall-1-INPUT -p icmp -m icmp --icmp-type any -j ACCEPT 
-A RH-Firewall-1-INPUT -p tcp -m tcp --dport 80 -j ACCEPT 
-A RH-Firewall-1-INPUT -p tcp -m tcp --dport 25 -j ACCEPT 
-A RH-Firewall-1-INPUT -p tcp -m tcp --dport 8080 -j ACCEPT 
-A RH-Firewall-1-INPUT -p tcp -m tcp --dport 8044 -j ACCEPT 
-A RH-Firewall-1-INPUT -s 122.160.21.105 -p tcp -m tcp --dport 22 -j ACCEPT 
-A RH-Firewall-1-INPUT -s 61.246.47.68 -p tcp -m tcp --dport 22 -j ACCEPT 
-A RH-Firewall-1-INPUT -s 59.144.174.135 -p tcp -m tcp --dport 22 -j ACCEPT 
-A RH-Firewall-1-INPUT -m state --state RELATED,ESTABLISHED -j ACCEPT 
-A RH-Firewall-1-INPUT -j REJECT --reject-with icmp-host-prohibited 
COMMIT 
# Completed on Mon Apr 18 11:16:46 2011

15. Launch OpenEMM :

#su - openemm 
#cd /bin 
#./OpenEMM.sh start 
#./OpenEMM.sh stop 
#exit 


16. Turn on services on startup:

#chkconfig mysqld on
#chkconfig sendmail on
#chkconfig crond on
===================================================================

MISCELLANEOUS

=

Website: http://www.openemm.org Support: http://www.openemm.org/support.html Newsletter: http://www.openemm.org/newsletter.html