[Guide] Funambol MySQL and Debian lenny/squeeze

[Guide] Funambol MySQL and Debian lenny/squeeze

If you are looking for an Open Source application to synchronize all your devices like mail client (Thunderbird & MS Outlook), mobile phone (Symbian, Windows Mobile, SmartPhones, Iphone etc) funambol would be the perfect choice.

I’ve decided to make a little guide for Debian, since I was not able to find a decent one online.

Log in to your debian box and su to root.
cd /tmp
wget http://download.forge.objectweb.org/sync4j/funambol-8.0.2.bin

Make the file executable: chmod 777 funambol-8.0.2.bin
Run the Funambol installation: ./funambol-8.0.2.bin
Accept the license agreement
Choose the Funambol installation folder
Choose no to start Funambol

Now funambol is installed the folder of your choice. We did not start the Funambol since there is a few modifications to be done, ex. Installing MySQL and creating a sql user and database.

Do: apt-get install mysql-server mysql-client libmysqlclient15-dev
Stop the mysql server: /etc/init.d/mysql stop
ONLY NEEDED IF USING A REMOTE mySQL SERVER, this makes the mySQL server listen on all interfaces: nano /etc/mysql/my.cnf and comment out #bind-address = 127.0.0.1
Now start the mysql server again: /etc/init.d/mysql start
Set the root password to mysql: mysqladmin -h localhost -u root password some_password
Now test if it works: mysql -u root -p (Click enter and type your password, type exit to quit)

Okay now we have the mysql setup and ready to use – This takes us to the point where we have to add a new sql user and a database to use with Funambol.

Login to mysql: mysql -h localhost -u root -p
create user ‘funambol_usr’@’locahost’ identified by ‘some_password’;
grant all privileges on *.* to ‘funambol_usr’@’localhost’ with grant option;
flush privileges;
create database funambol;
grant all on funambol.* to funambol_usr@’localhost’ identified by ‘some_password’;

Now we have created a user called funambol_usr with the password you chose and given him access to the database funambol.

Next step is to install the mysql java connector so Funambol can communicate with the mysql server. Funambol is based on Java that is why we need a connector so java can communicate with mysql.
apt-get install libmysql-java
This will install the mysql -> java connector.
Copy the java connector to the funambol java dir: cp /usr/share/java/mysql-connector-java.jar /opt/Funambol/tools/jre-1.5.0/jre/

It’s time to edit the Funambol files to make funambol work with mysql.

nano /opt/Funambol/ds-server/install.properties
Change: dbms=hypersonic to dbms=mysql
Comment out these lines:
#jdbc.classpath=../tools/hypersonic/lib/hsqldb.jar
#jdbc.driver=org.hsqldb.jdbcDriver
#jdbc.url=jdbc:hsqldb:hsql://localhost/funambol
#jdbc.user=sa
#jdbc.password=

Now uncomment:
jdbc.classpath=/opt/Funambol/tools/jre-1.5.0/jre/mysql-connector-java.jar
jdbc.driver=com.mysql.jdbc.Driver
jdbc.url=jdbc:mysql://localhost/funambol
jdbc.user=funambol_usr
jdbc.password=some_password

Funambol should be ready to run, but before we start the new installation of Funambol with mysql support we should make a start script it’s already included in Funambol just not put in the debian init folder.

cp /opt/Funambol/bin/funambol /etc/init.d/
Edit the newly copied start script and change the Funambol home folder location: nano /etc/init.d/funambol
And change: DS_SERVER_HOME=$FUNAMBOL_HOME/ds-server to DS_SERVER_HOME=/opt/Funambol/ds-server

Now we have a working start script, this brings us to the final step, the installation to get Funambol working with mysql.

Run: /opt/Funambol/bin/install and answer yes to all questions asked.

If you run in to this error:
BUILD FAILED
/var/Funambol/ds-server/install/install.xml:172: The following error occurred while executing this line:
/var/Funambol/ds-server/install/install.xml:353: The following error occurred while executing this line:
/var/Funambol/ds-server/install/install.xml:380: The following error occurred while executing this line:
/var/Funambol/ds-server/install/install.xml:437: The following error occurred while executing this line:
/var/Funambol/ds-server/install/install.xml:452: com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure

You need to disable IPv6 for Java, this is one of the reasons why I’ve made this guide, since I had this issues without really being able to find a solution for it until now. Copy paste the lines below:
sed -i 's/net.ipv6.bindv6only\ =\ 1/net.ipv6.bindv6only\ =\ 0/' \
/etc/sysctl.d/bindv6only.conf && sudo invoke-rc.d procps restart

When you’ve done that, rerun the installation script: /opt/Funambol/bin/install and the error should be gone, answer yes to all the questions you asked.
Now go to Funambol.com and download the administration tool.
Default username: admin
Default password: sa

It’s highly recommended to change these when connecting to Funambol, further questions read the Funambol installation and administration guide by Click here