How to Sync Your Calibre Library Between Computers on Ubuntu Linux with Dropbox

It’s easier than it sounds, I promise. I’ve tried to keep this simple & step-by-step for non-techies. And everything I use here is free.

Calibre and Ebooks…

If you like ebooks, you’re probably already familiar with the multi-platform ebook management software Calibre. It’s been called "the iTunes for ebooks" and can catalogue, tag, convert and sync ebooks to various readers such as Nook and Kindle.

Calibre stores all the books you add to it in a folder, which is sub-sorted into other folders based on author, and then based on title + a number- i.e., Calibre Library/Charles Dickens/A Tale of Two Cities (58). All of Calibre’s "important" data is located in the Calibre Library folder and its subfolders- which makes syncing Calibre between computers a breeze if you know what you’re doing.

If you want to sync between Ubuntu Linux and Windows or between two Windows installations, see the paragraph on Windows towards the end, under the heading "Syncing Between Windows and Linux/Windows". Be sure to read the rest of the tutorial first, though!

Syncing Your Calibre Library On Ubuntu Linux : The Setup

1. First of all, you need to sign up for Dropbox. It’s free, private and keeps your files synced between computers. The storage space starts at 2GB and can be increased by links and contests- or by buying more space. Install the Dropbox Linux Sync Daemon. Restart the computer if required. After it runs the first time, you should now have a folder titled Dropbox in your home folder and (most likely) an icon in the system tray showing you Dropbox’s status (syncing, done syncing, paused).

2. Download Calibre Ebook Software and install it. It’s possible to do this via the command-line in Ubuntu Linux, should you so choose; to install via the command-line, enter this code in the gnome-terminal:
sudo apt-get update
sudo apt-get install calibre
).

3. ALTERNATE, EASIER METHOD USING THE START WIZARD:
lafattaturchina helpfully pointed out in the comments that "in Calibre 0.9.12, you can choose where to place the library by going in Preferences > Start Wizard". lafattaturchina has successfully used this method with the somewhat-similar-to-Dropbox Ubuntu One service, and it’s working thus far. If you can get this method to work, I recommend using it instead of the steps 3-6 below; then to sync with another computer, you could use steps 7-8 below the heading Adding a Second (or Third) Computer, BUT using the Start Wizard to select the downloaded library folder in your Dropbox folder when you’re setting up Calibre on the second comp. I HAVEN’T TRIED THIS, but it seems like it should work. Please comment below if you’ve tried it successfully.

3. Run Calibre for the first time and add some books to it. (If you don’t have any ebooks, Project Gutenberg has loads of free ones, including most of the classics.) This should create a folder full of them in your home folder called Calibre Library. Close Calibre.

4. MOVE the entire Calibre Library folder into your newly-formed Dropbox folder. It should start uploading the books/data to back them up. (DON’T start Calibre again yet, or it will just try to make another folder there to replace the moved one.)

5. Now we’re going to create a symbolic link to trick Calibre into thinking that its library is still in the home folder. It will still access/update your books just like before, but Dropbox will sync them and any updates to them (i.e., converted formats or new tags/author info). Open the gnome-terminal and enter the following short code to make sure it’s looking at the home folder:
cd ~
Now enter the following code to make a symbolic link pointing to your Calibre library; since the link will have the same name as the old folder, Calibre will treat the folder it points to as if it’s the original Calibre Library:
ln -s Dropbox/Calibre\ Library/ Calibre\ Library
The ln stands for "link" and the -s means that it’s symbolic. When making symbolic links, you enter the "real" location first, and then the "fake" location you want to point to the real one.

6. Open Calibre and add some more books (to make sure it works). The books and any edits to them should be added to the Calibre Library folder in your Dropbox folder and automatically updated. If you just want to back up your Calibre Library, rather than syncing it, then you’re done here.

Adding a Second (or Third) Computer

7. Now you’ll want to configure your other computer(s) (which I’ll call "comp #2" from now on) to receive the updated Calibre Library from Dropbox. Turn on your other computer and install Dropbox, then download to comp #2 whatever’s in your Dropbox folder- including the Calibre Library folder. Download it all and then pause Dropbox’s syncing. (You don’t *have* to do this, but it’s just easier to tweak things when Drobox isn’t stalking your file changes…)

8. Download and install Calibre onto comp #2. Run Calibre one time, to make the Calibre Library folder inside your home folder, and then close Calibre. NOW DELETE THE Calibre Library FOLDER YOU JUST MADE.

8. Open the gnome-terminal and again make sure it’s looking at the home folder (it usually opens there by default, but if it’s already open or customized… It never hurts to make sure.)
cd ~
and now make a symbolic link from where the folder you just deleted used to be to the Calibre folder inside your Dropbox folder:
ln -s Dropbox/Calibre\ Library/ Calibre\ Library

9. Open Calibre. It should show all the books you added on your other computer, along with any custom things you did (such as, say, tagging anything by Mark Twain as "over-rated".) You can now add/remove/change books on either computer, and it will show up on the other one(s). You can repeat steps 7-9 for as many computers as you want to sync.

ONE POINT: You SHOULD NOT have two Calibres running on two different computers at the same time. This will lead to file conflicts as Dropbox tries to figure out which version the files changed should be kept. It won’t permanently break anything or ruin your computer, but it can be annoying- especially if you just finished tagging a lot of books and it over-writes all your tags. Dropbox will usually try to save the alternate versions of files in their respective folders as ItsOldFilename.conflict or something, but it’s easier just to avoid this.

This method is confirmed to work and I use it myself- it’s not one of those "you have to download 28 dependencies you’ve never heard of and it might crash your gui and it won’t work half the time!" sort of linux tutorials you sometimes see online. I’m currently using this tutorial’s method to keep my Calibre library synced between two Ubuntu 11.04-running laptops.


Syncing Between Windows and Linux/Windows

I run Calibre primarily on my favorite OS- a somewhat recent version of Ubuntu Linux. This tutorial is for Ubuntu Linux, but it could be tweaked for other linux flavors. There’s also a way to make this work between a Linux install and Windows, although you have to use the portable version of Calibre on the Windows comp. I’ve never tried it, but you could do it this way: install Dropbox on Windows FIRST, and then install the portable version of Calibre INSIDE the Dropbox folder. Add whatever books you want to Calibre, close it and then sync it to Linux. Then point the symbolic link to in your home folder to /home/YourUsernameHere/Dropbox/CalibrePortable-or-whatever-the-portable-versions-folder-is-called/Calibre\ Library or wherever the library got dumped (you might have to browse for it.) Between two Windows computers, it would be much easier: just skip the whole symbolic links deal and run the portable Calibre from within the Dropbox folders every time.

If you have any questions/comments/concerns, feel free to comment. I’ll try to reply when I can.

Helpful Links:

4 thoughts on “How to Sync Your Calibre Library Between Computers on Ubuntu Linux with Dropbox

  1. Couldn’t you just tell calibre to create the library folder directly in dropbox? I haven’t tried it, though, so there could be plenty of problems I didn’t think about :)

    • fish says:

      Hi! Thank you for your comment. I’ve looked for an option in Calibre to change where it places the library, and I haven’t found it yet. It’s probably possible for a more advanced user to hack Calibre and make a custom version- but, that would require spending hours on something that can be solved (although, admittedly, less elegantly) in a few minutes with symbolic links.

      It’s possible (probable?) that future versions of Calibre may have a library location option- OR even that it already has one, and I just couldn’t find it (the interface is notoriously clunky, even though it’s great software.)

      • Hello there! In Calibre 0.9.12 you can choose where to place the library by going in Preferences > Start Wizard
        I synchronized the library folder with Ubuntu One. It seems working smoothly so far.

      • fish says:

        Thank you for your feedback; I’ve added your comments (with credit) to the tutorial under step #3. It’s way easier than messing with symbolic links. (It’s been so long since I’ve installed Calibre from scratch, I forgot what options were under setup- or perhaps my earliest install was before they added that option. :? Anyway, thanks!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s