Syncing contacts and calendar notes
First of all get the Funambol Server: https://www.forge.funambol.org/download/
After that download their Administration Guide: http://download.forge.objectweb.org/sync4j/funambol-installation-and-administration-guide.pdf
Setting up the server following administration guide is straight forward and not that difficult. Here are the main steps:
Start Install: "./sh funambol-8.0.0.bin" read and accept the licens and press Enter to install it to /opt/Funambol you can either start the server when asked by the installation process or later by executing: "/opt/Funambol/bin/funambol start"
Funambol requires java, but the jre is shipped with the server, so there's no need to care about.
Start the server and go to http://localhost:8080/ to see if it's running. Now bring up the admintool executing "/opt/Funambol/admin/bin/funamboladmin"
Go to "File" in the menu and choose "Login". User the default values for your first login. (You should later change the password. See the admin guide for details about that.)
User name: admin Password: sa
Now "localhost" should appear in the main window, expand the tree and double click on user. And choose "add" in the right window. Now enter user credentials and select role "User". Click "add" and voila your server with an account is set up and ready for syncing.
Next step is getting your iphone ready. If your device is jailbroken, install "iPhoneSync" from Cydia. Otherwise go to the appstore and install the app "Funambol". iPhoneSync will let you synchronize contacts calendar and notes. Funambol will only allow Contacts (probably due restrictions in the appstore). Open the app and go to "Settings"->"Account" and enter "http://192.168.1.7:8080/funambol/ds" as server (replace the ip with the local one of your server or it's hostname). For username and password you choose the same credentials, you entered adding a new user to funambol. Leave the settings and tap "Sync All" or "Sync Contacts" depending which app you're using. If everything went fine, the data from your iphone should now be transfered to the funambol server.
Now let's get to the linux client side.
Install thunderbird (a.k.a. icedove). On debian "apt-get install icedove" should do the job.
Now get the Lightning-Plugin and install it. http://www.mozilla.org/projects/calendar/lightning/
Also get the Funambol Mozilla Sync Client and install that too. https://mozilla-plugin.forge.funambol.org/
If you select the Tools menu in thunderbird, you should now find a "Funambol sync..." entry, which opens a small window with another Tools menu, where you can find the Options. Enter the same server location as in your iphone and the same user credentials. Close the options and click "Sync All" in the funambol window. thunderbird should now be synchronized with your iphone data on the funambol server.
If you prefer kontact and got an imap server running and use the buildin kolab imap store, to keep pim data on your boxes synchronized. Installing the kolab plugin for thunderbird, you can now keep kontact in sync with the iphone, using thunderbird just as a middleman in the syncing process. It's not a fancy solution, but it at least it works. The plugin can be found at https://addons.mozilla.org/en-US/thunderbird/addon/519