Linux Commands and Scripts

Steps to Install Calibre eBook Server on Ubuntu 20.04

In this article, we’ll explain how to install Calibre eBook server on Ubuntu 20.04.

Calibre is a free open-source suite of e-book software. Calibre offers a local client but also provides a server for access on other devices. It’ll allow you to do nearly everything and it takes things a step beyond normal e-book software.

Install Calibre eBook Server on Ubuntu 20.04

Prerequisites

Step 1 – Update the server

Keep the server up to date using following command:

# apt update -y

# apt upgrade -y

Step 2 – Install Calibre

Install Calibre with the following command:

# apt install calibre -y

Step 3 – Create a Library

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

# mkdir calibre

Step 4 – 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

Step 5 – List the library’s contents

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

Step 6 – Create the Calibre Startup Service

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

# vi /etc/systemd/system/calibre-server.service

Add the following contents to the calibre-server.service.

[Unit] Description=Calibre Server
After=network.target 

[Service] Type=simple
User=root
Group=root
ExecStart=/usr/bin/calibre-server –enable-local-write /root/calibre 

[Install] WantedBy=multi-user.target 

Note: We have setup this with root user so, we have set User and Group to root. You should change it with your user and group if you are installing Calibre server using normal user. Also replace /root/ direcory with user home directory.

Start the service and enable it to run when the server boots.

# systemctl enable calibre-server
# systemctl start calibre-server
# systemctl status calibre-server

In your web browser, navigate to the server at the IP address and port. For example:

http://192.168.1.102:8080

Select “calibre” as the library, and the server displays a list of books.

Step 7 – Add Authentication

Add authentication to prevent unauthorized access to the eBook library.

Stop the server.

# systemctl stop calibre-server

Run the user management script:

# calibre-server –manage-users

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!

Edit the Calibre service file to enable authentication.

# vi /etc/systemd/system/calibre-server.service

Replace this line:

ExecStart=/usr/bin/calibre-server –enable-local-write /root/calibre

With:

ExecStart=/usr/bin/calibre-server –enable-auth –enable-local-write /root/calibre

Reload the service files with systemd and restart the service.

# systemctl daemon-reload
# systemctl start calibre-server

Authentication is now required to access the server.

We have successfully installed and configured Calibre eBook server.

In this article, we have how to install Calibre eBook server on Ubuntu 20.04.

Related Articles