Raspberry Pi 4 as Calibre Server



Published May 25, 2020

If you don’t want to use Kindle and Amazon for all your ebook needs, you can use a Raspberry PI to host your very own ebook server on the local network. This setup is specific to a RPI4 running a headless Arch Linux ARM, but should be similar to other distros using systemd as well.

First of all, install calibre:

sudo pacman -S calibre calibre-common

Next, make sure you have a calibre library on your RPI, either on an attached USB harddisk or on the SD card itself. I used rsync to copy over my existing library to the RPI. The great advantage of this is that rsync will only copy over what has changed since the last copy operation. It can also maintain all the modification dates, permissions and so on, which is handy for sorting your library on your various devices. Rsync needs to be installed separately, and it must be installed on BOTH the computers being synced. Run this on your source computer as well as on the RPI:

sudo pacman -S rsync

Next, copy the library from the source computer to the RPI, replacing user@rpi-hostname with the appropriate hostname and desired path:

rsync -avz /path/to/source/calibre/library user@rpi-hostname:/home/user/Calibre\ Library/

On the RPI you will then have to create a systemd service:

sudoedit /etc/systemd/system/calibreserver.service

The contents of the file is this:

[Unit]
Description=Run a calibre server on the local network
After=network.target

[Service]
Type=oneshot
ExecStart=/usr/bin/calibre-server /home/user/CalibreLibrary/

[Install]
WantedBy=multi-user.target 

Enable and run on the RPI.

sudo systemctl enable --now calibreserver.service

And that should be it! You can now go to your ebook-reader of choice and browse your books. They will be served on the ip address of your RPI on port 8080 by default, so on my network it looks like this: 192.168.1.125:8080. You can even point your browser to the address and get a nicely laid out catalogue of your ebooks.