Calibre Ebook server on OSMC

Hello all,

Since my ATV1 is retired from normal video use, I’ve been wanting to test it as a headless server for:

  • -Music playback via it’s digital out
  • -Calibre ebook server
  • -remote file server for my vero etc

I have been using an old mac laptop for calibre and NFS shares.
The battery life on the laptop has gone to zero, thereby removing it’s ability to avoid power outages. A built in “UPS” was it’s primary advantage.

I have been using a 200gb iPod in a Belkin iPod docking station, with analog out, for my 9000 + (approx) song music library.
The remote for the Belkin dock has never worked reliably.

By combining both audio playback, and file server, I can elminate extra hardware, and improve audio quality.

As a first step, I’ve got my initial setup of Calibre server working.

This is work in progress.
While my setup is now working, I’d plan on making making some changes.
Thse Include installing the latest version of calibre (instead of the older 2.x from debian packages), with it’s improved user access control etc.

I will edit this post to reflect any changes I make to my setup.

-------------------------------------

Calibre Ebook server on OSMC

This explains how I to installed CALIBRE SERVER on an atv1 running osmc 2017.08
OSMC does not have a linux desktop, therefore you cannot normally use the full calibre gui version on osmc.

What is Calibre ?:
See https://calibre-ebook.com/

Calibre server allows you access your ebook library from it’s own web server.

Since it uses a webserver, it is your responsibility to make sure you server is secure.
I do not recommend making the server remotely accessable unless you fully understand the risks and know how to secure it.

My server will only accessable from within my home network.

1) ssh into your atv1 running osmc (see osmc wiki)

2) Install the calibre package with the command:

sudo apt-get install --no-install-recommends calibre

Since I’m using this as a server only, and not using the calibre gui I used --no-install-recommends to minimize what was installed.

3) Configure the calibre server to automatically run as a service.

OSMC is a modern debian based OS that uses systemd.
You can easily create a service to run calibre at boot.

Just create the file /etc/systemd/system/calibre-server.service with the contents shown below:

[Unit]
Description=Calibre Server as a Service
After=network.target

# If you are using an existing calibre library, on a local drive, check to make sure if it exists
# if it doesn't exist, this makes sure the service start up fails with an error

# AssertPathExists=<path-to-calibre-library>

# If the calibre library is on a secondary mounted filesystem, make sure it is mounted.
# if it isn't mounted, this makes sure the service does not start

# I am using an external USB drive so I need to use this, to make sure the external drive is mounted, otherwise calibre will create a new blank library at that mount point.
# example  /media/BOOKDRIVE

AssertPathIsMountPoint=<path-to-externaldrive-mounting-point>

[Service]
User=osmc
Group=osmc

Type=simple
PIDFile=/home/osmc/.config/calibre/calibre-server.pid
ExecStart=/usr/bin/calibre-server \
        --daemonize \
        --max-cover=300x400 \
        --port=<portnumber> \
        --pidfile=/home/osmc/.config/calibre/calibre-server.pid \
        --with-library=<path-to-calibre-library>
Restart=always

[Install]
WantedBy=multi-user.target

Change path-to-calibre-library to where you want to store you calibre library.

Change portnumber to which port you want to acccess the calibre server webpage on.
It defaults to 8080, which may conflict with your kodi webserver/control panel.

The calibre documentation has more info on other calibre server run options.
For example, you can:
-password protect the server
-limit how many books the webpage will show
-limit the size of the book cover thumbnails

To start the calibre server service:
sudo systemctl start calibre-server

To check the status of the calibre server service:
sudo systemctl status calibre-server

To stop the calibre server service:
sudo systemctl stop calibre-server

Once you have the service working correctly, you can make it start automatically as boot:
sudo systemctl enable calibre-server

To access the calibre server’s webpage, you browser and go to:
ip-address-of-your-osmc-box:port
For example: 192.168.1.10:8080

You will obviously need the osmc box to be connected and accessable on your network. :thinking:

2 Likes