Article

Table of Contents
Theme:
Was this article helpful?
Try Vultr Today with

$50 Free on Us!

Want to contribute?

You could earn up to $600 by adding new articles.

Set up a Calibre eBook Server on Debian 10

Author: Christopher Tarry

Last Updated: Thu, Dec 3, 2020
Debian Linux Guides Server Apps

Calibre is a popular free, open-source eBook management software. Calibre offers a local client but also provides a server for access on other devices. This tutorial explains how to create a Calibre eBook server on a Vultr Debian 10 cloud server instance. A cloud server instance is sometimes called a Virtual Private Server or VPS.

Prerequisites

1. Install Calibre

Install Calibre with the following command:

$ sudo apt install calibre

2. Create a Library

Make a folder for the new Calibre library in the home directory.

$ cd ~

$ mkdir calibre

3. Add Books to the Library

Download Shakespeare's Romeo and Juliet from Project Gutenberg.

$ wget "http://gutenberg.org/ebooks/1112.kindle.noimages" -O book.mobi

Add it to the Calibre library.

$ calibredb add book.mobi --with-library calibre

4. List the Library's Contents

Get a list of all the books in the library.

$ calibredb list --with-library calibre

id title                           authors             

1 The Tragedy of Romeo and Juliet William Shakespeare

5. Remove Books from the Library

calibredb requires the ID number to remove a book. For example, to remove book ID 1:

$ calibredb remove 1 --with-library calibre

To add the book again:

$ calibredb add book.mobi --with-library calibre

6. Run the Calibre Server

  1. Start the server. Your IP address is different than the example shown.

    $ calibre-server calibre
    
    calibre server listening on 0.0.0.0:8080
    
    OPDS feeds advertised via BonJour at: 192.0.2.123 port: 8080
    
  2. In your web browser, navigate to the server at the IP address and port reported by calibre-server. For example:

    http://192.0.2.123:8080
    
  3. Select "calibre" as the library, and the server displays a list of books.

  4. From the terminal, press CTRL-C to exit the server.

7. Create the Calibre Startup Service

Create a systemd service for Calibre, so that it can automatically start.

  1. Use nano to create a new service file.

    $ sudo nano /etc/systemd/system/calibre-server.service
    
  2. Add the following contents to the calibre-server.service.

    [Unit]
    
    Description=Calibre Server
    
    After=network.target
    
    
    
    [Service]
    
    Type=simple
    
    User=calibre
    
    Group=calibre
    
    ExecStart=/usr/bin/calibre-server  --enable-local-write /home/calibre/calibre
    
    
    
    [Install]
    
    WantedBy=multi-user.target
    
  3. Start the service and enable it to run when the server boots.

    $ sudo systemctl enable calibre-server
    
    $ sudo systemctl start calibre-server
    

8. Add Authentication

Add authentication to prevent unauthorized access to the eBook library.

  1. Stop the server.

    $ sudo systemctl stop calibre-server
    
  2. Run the user management script:

    $ calibre-server --manage-users
    
  3. Follow the prompts to make a new user named calibreuser and choose a secure password. Verify you see the confirmation message:

    User calibreuser added successfully!
    
  4. Edit the Calibre service file to enable authentication.

    $ sudo nano /etc/systemd/system/calibre-server.service
    

    Replace this line:

    ExecStart=/usr/bin/calibre-server  --enable-local-write /home/calibre/calibre
    

    With:

    ExecStart=/usr/bin/calibre-server --enable-auth --enable-local-write /home/calibre/calibre 
    
  5. Reload the service files with systemd and restart the service.

    $ sudo systemctl daemon-reload
    
    $ sudo systemctl start calibre-server
    

Authentication is now required to access the server.

Conclusion

This completes the Calibre eBook server installation on a Vultr Debian 10 cloud server instance. Use the Calibre companion apps for Android or iOS to access the server.

Want to contribute?

You could earn up to $600 by adding new articles.