Notes from the Wired

My Homelab Part 3: Calibre

Published: January 19, 2024

In my free time, I enjoy reading books. For a long time, I organized the books I read on physical paper notes. However, as the list grew longer and paper deteriorated over time, I realized it was impractical. To address this, I decided to switch to a digital organization strategy, and for that, I chose the software Calibre.

Calibre is a free and open-source e-book management program. It supports organizing existing e-books into virtual libraries, displaying and editing e-books, and even synchronizing them with different e-readers.

Calibre-Web is a web app for Calibre that allows access to Calibre via the internet.

"An exemplary view of the Calibre-Web software.

In this short blog post, I’ll guide you through the process of installing Calibre-Web. If you are interested in how I set up my homeserver, you can read one of my previous blog posts.

Installation

For the installation of Calibre-Web, I used Docker, specifically Docker Compose. If you’re curious about why, you can check out my blog post “My Homelab Part 1: Introduction,” where I explain the advantages of docker.

In Docker, to start a container, you typically use a long command with configurations as arguments. This approach can be confusing and hard to reproduce.

Example of a docker command to run a container.

A better option is Docker Compose, where all the configurations are placed in a compose.yaml file, making it clearer and easier to reproduce.

In general the docker compose file uses YAML as a file format, which is a human readable data language. The Compose files uses some predefined keys that can be used to configure how docker should behave, to read more check this out.

The Docker Compose file for Calibre I used is as follows:

 1---
 2version: "2.1"
 3services:
 4  calibre-web:
 5    image: lscr.io/linuxserver/calibre-web:latest
 6    container_name: calibre-web
 7    environment:
 8      - PUID=1000
 9      - PGID=1000
10      - TZ=Europe/Berlin
11    volumes:
12      - /root/calibre/config:/config
13      - /mnt/externalDisk/calibre/libary:/books
14    ports:
15      - 8083:8083
16    restart: unless-stopped

This configuration file needs some explanation:

Normally, you will be able to find a list of keys that you can set for the given image by looking at the docker hub page or on the maintainers page. For instance you can check out linuxserver page on calibre.

To install Calibre on your server, follow these steps:

  1. create a file titled calibre-web-compose.yml and copy the content of the above into the YAML file.

  2. Edit the file to suit your needs, you should especially change the volumes, timezone, and PUID/PGID. Ensure the PUID and PGID match the owner of the volumes.

  3. Move the file to your server. Save it in your home directory, and use scp to transfer it if needed.

  4. Open a terminal at the file location and run::

    1docker compose -f calibre-web-compose.yml up -d
    

    This starts the container in the background: The -f specifies the file name of the compose file -d tells docker to start the container in the background without displaying the logs in the terminal.

  5. After installation, check the container status by running:

    1docker ps -a
    
  6. Access Calibre-Web at http://<IP_Of_Your_Server>:Calibre_Port, log in using the default credentials (Username: admin, Password: admin123).

    Should the default login data have changed, you should be able to find them on the image doc site of calibre.

  7. After login in you should get greeted by a window similar to the image below.

In order to function properly Calibre-Web will need a virtual library, which is a databank that saves all the information about your books. Unfortunately Calibre-Web, doesn’t let you create new libraries from scratch, instead it only works with already created existing libraries. For that you can either:

After you have downloaded or created the file move the file into your books volume, that you have defined in your compose file. Following that, you should be able to select the books folder as database folder in the Calibre-Web application.

The last thing you should do, is enabling uploads of books via Calibre-Web and change your password. To do that navigate to

OPDS

The Open Publication Distribution System (OPDS) is an electronic catalog format for electronic publications. OPDS can be used on the server to enable clients, such as e-readers or programs with ODPS support, to discover and download e-books.

I use ODPS to download books to my e-reader (which uses Koreader software) or to my computer (which uses Calibre) whenever I want to read an e-book.

To configure ODPS for Koreader:

  1. Open the menu by tapping on the top of the screen

  2. Navigate to the magnifying glass.

  3. Press the ODPD Catalog option, and press the + Button in the top left corner to add an ODPS Catalogue.

  4. Choose a catalogue name; the catalogue URL should be: http://<Server_IP>:Calibre_Port/opds. Enter the username and password defined in your Calibre-Web server.

  5. To connect to your OPDS catalogue, press the newly added catalogue.

As a last piece of advice,Annas Archive has an enormous library of e-books available for free download. However, please keep in mind that supporting authors is crucial for them to continue producing their awesome works.


References: