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.
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.
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:
image
describes the container pulled from the internet i.e the software that you want to install. Images can be found on the docker hub website.environment
specifies additional settings for the container. For instance:TZ
specifies the timezone for the softwarePUID/PGID
the id of the user and group under which the software will run.- to find out your
PUID/PGID
you can run the following command for user id:and for group id:1id -u username
1id -g username
- to find out your
volumes
describe where data from the software is saved. The first path is the physical location on the computer, while the second is a virtual location inside the docker container, the paths are separated by:
.ports
specify which ports are exposed to the docker container.restart
instructs Docker on what to do if the container shuts down unexpectedly.
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:
create a file titled
calibre-web-compose.yml
and copy the content of the above into the YAML file.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.
Move the file to your server. Save it in your home directory, and use
scp
to transfer it if needed.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.After installation, check the container status by running:
1docker ps -a
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.
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:
- Download Calibre on your computer create an empty library and export it or
- You can download an already created database, via the command:If you do download this file make sure to make yourself the owner of the file and give you full permission on this file(see “My Homelab Part 2: DietPi”).
1weget sempervieo.de/metadata.db
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
Configuration -> Edit Basic Confguration -> Feature Configuration -> Enable Uploads
admin -> edit user
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:
Open the menu by tapping on the top of the screen
Navigate to the magnifying glass.
Press the ODPD Catalog option, and press the + Button in the top left corner to add an ODPS Catalogue.
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.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: