How to setup BerkeleyDB with your ASSP (instead of MySQL)

 

note : at the end of this page you can find instructions to switch from BerkeleyDB to MySQL.

If you have issues using MySQL with your ASSP , or if you would use BerkeleyDB instead of MySQL for your ASSP please follow this HOW TO

Only if you already setup MySQL for your ASSP be sure to fully disable it . Click MySQL SETUP and disable MySQL . Now go to console and execute this

rm -f /usr/local/assp/deluxe/mysql_created

Now you should install BerkeleyDB 4.5 in your server, you should execute following steps

cd /usr/local/perls
wget http://www.grscripts.com/BerkeleyDB/db-4.5.20.tar.gz
tar -xzf db-4.5.20.tar.gz
rm -f db-4.5.20.tar.gz
cd db-4.5.20
cd build_unix
../dist/configure
make
make install

At end of the command above you should have BerkeleyDB installed in /usr/local/BerkeleyDB.4.5

Now you should compile BerkeleyDB module for perl used by your ASSP , by default
/usr/local/perls/perl-5.20.3/bin/perl . Please execute following steps
 

cd /usr/local/perls
wget http://www.grscripts.com/BerkeleyDB/BerkeleyDB-0.54.tar.gz
tar -xzf BerkeleyDB-0.54.tar.gz
rm -f BerkeleyDB-0.54.tar.gz
cd BerkeleyDB-0.54

now open with an editor like vi / nano /pico the file config.in and replace

INCLUDE = /usr/local/BerkeleyDB/include

with

INCLUDE =
 /usr/local/BerkeleyDB.4.5/include

and replace

LIB = /usr/local/BerkeleyDB/lib

with

LIB = /usr/local/BerkeleyDB.4.5/lib

Save the file  config.in

Now execute this

note : if you are still using older perl-5.16.3 replace perl-5.20.3 with perl-5.16.3
 

/usr/local/perls/perl-5.20.3/bin/perl Makefile.PL
make
make test
make install


Now execute this

cp /usr/local/assp/whitelist /usr/local/assp/mysql/dbimport/whitelist.add
rm -f /usr/local/assp/mysql/dbimport/whitelist.add.OK
 
cp /usr/local/assp/spamdb /usr/local/assp/mysql/dbimport/spamdb.add
rm -f /usr/local/assp/mysql/dbimport/spamdb.add.OK

cp /usr/local/assp/HMMdb /usr/local/assp/mysql/dbimport/HMMdb.add 
rm -f /usr/local/assp/mysql/dbimport/HMMdb.add.OK

Now you can execute two ways , "Automatic setup" OR the "Manual setup" below.

Automatic setup (requirements : ASSP Deluxe 8.5.0 or above versions)

/usr/local/cpanel/3rdparty/bin/php-cgi /usr/local/assp/deluxe/berk.php

You have completed the BerkeleyDB installation . Your ASSP is now using BerkeleyDB ! Open your ASSP WHM and click "RebuildSPAMDB" to populate your HMM and spamdb BerkeleyDB databases.




Manual setup

If you didn't use or don't want use the Automatic setup above open your ASSP WHM > Automation settings , search useBerkeleyDB , and set it OFF .

Now open your ASSP Web Interface

Go to
Module setup menu > and enable Use Module BerkeleyDB (useBerkeleyDB) .
Go to
File Paths and Database menu > and set

       
spamdb => DB:
        whitelistdb => DB:
        persblackdb => DB:
        delaydb => DB:
        useDB4griplist , set it enabled (check it)

Apply settings , close ASSP web interface, then open your ASSP WHM and STOP and START your ASSP .

Now open again your ASSP Web Interface , Go to File Paths and Database menu > and set

        DBdriver => BerkeleyDB

Apply settings , close ASSP web interface, then open your ASSP WHM and STOP and START your ASSP .

When you restart your ASSP, now you should see these rows in your /usr/local/assp/maillog.txt



Jan-29-15 17:21:23 [init] BerkeleyDB module version 0.54 installed - Berkeley database usage available
Jan-29-15 17:21:23 [init] BerkeleyDB DB-version 4.5 / Berkeley DB 4.5.20: (September 20, 2006) is installed
Jan-29-15 17:21:23 [init] BerkeleyDB maximum cache size is set to 50MB


[..]

Jan-29-15 17:21:51 [init] Using BerkeleyDB Database /usr/local/assp/whitelist.bdb instead of file /usr/local/assp/whitelist
Jan-29-15 17:21:51 [init] Using BerkeleyDB Database /usr/local/assp/persblack.bdb instead of file /usr/local/assp/persblack
Jan-29-15 17:21:51 [init] Using BerkeleyDB Database /usr/local/assp/delaydb.bdb instead of file /usr/local/assp/delaydb
Jan-29-15 17:21:51 [init] Using BerkeleyDB Database /usr/local/assp/delaydb.white.bdb instead of file /usr/local/assp/delaydb.white
Jan-29-15 17:21:59 [init] Using BerkeleyDB Database /usr/local/assp/spamdb.bdb instead of file /usr/local/assp/spamdb
Jan-29-15 17:21:59 [init] Using BerkeleyDB Database /usr/local/assp/spamdb.helo.bdb instead of file /usr/local/assp/spamdb.helo
Jan-29-15 17:21:59 [init] Using BerkeleyDB Database /usr/local/assp/HMMdb.bdb instead of file /usr/local/assp/HMMdb

Your ASSP is now using BerkeleyDB ! Open your ASSP WHM and click "RebuildSPAMDB" to populate your HMM and spamdb BerkeleyDB databases.

 

How to switch from BerkeleyDB to MySQL #my

if you want switch back to MySQL please follow these steps.

- stop ASSP using your ASSP WHM interface.

- go to console and execute this 

# /usr/local/cpanel/3rdparty/bin/php-cgi /usr/local/assp/deluxe/berk_off.php

- start ASSP using your ASSP WHM interface if after the step above you see it stopped.

- add these rows to your /etc/my.cnf in [mysqld] section

# REQUIRED BY ASSP V2
#######################
#The number of seconds the server waits for activity on an interactive connection before closing it.
interactive_timeout=28800
#The number of seconds the server waits for activity on a connection before closing it
wait_timeout=28800
#######################


- Restart your MySQL using your WHM/cPanel or execute this

# service mysql restart


- Now open your ASSP WHM interface and click  "MYSQL"  and enable MySQL for ASSP .

- Now open ASSP Web interface , open the "File Paths and Database" menu, and "database driver name (DBdriver)" to    mysql      , and apply settings , and close your ASSP Web interface .

- Now STOP and START ASSP using your ASSP WHM interface.

- Now open again your ASSP Web interface and you should see a GREEN dot near
  "ASSP (as daemon) - Configuration (root)"

MySQL should be installed and working correctly .