Skip to main content

Setting up Calibre Web on Raspbery Pi



Install Calibre Web

Install pip and also venv for the python version:

$ sudo apt install python3-pip python3-venv

Go to the folder where you want to install Calibre-Web, e.g. /opt/calibre-web

Create virtual environment for calibre web in folder venv

$ python3 -m venv venv

Install dependencies by running 

$ ./venv/python3 -m pip install --system -r requirements.txt

Download and extract Calibre-Web into the current folder (in this example /opt/calibre-web, need to create this directory tree)

$ pip install calibreweb


Starting Calibre Web

To start Calbre Web manually execute the command:

$ cps

To open Calibre Web web application open your web browser and enter the URL http://<server>:8083 where <server> is either the host name or the ip address of the server running Calibre Web.

Login with default admin login

Username: admin 

Password: admin123


Configuring Calibre Web

Set the location of the Calibre database to the path of the folder where the Calibre library (metadata.db) resides, push "submit" button. In my instance I am hosting the database on my NextCloud Server (same host):

/media/myCloudDrive/ncdata/ncp/files/Books

Afterwards you can configure your Calibre-Web instance (Basic Configuration and UI Configuration on admin page)


Start Calibre-Web as service with systemd

To have Calibre Web started automatically on boot create a file cps.service as root in the folder /etc/systemd/system with the following content:

$ [Unit]
Description=Calibre-Web

[Service]
Type=simple
User={Username}
ExecStart={path to starterfile}

[Install]
WantedBy=multi-user.target

Note:

  1. For {username} enter root
  2. For {path to starterfile} find the location of the Calibre-Web starterfile cps, this should be something like /home/<user>/.local/bin/cps
 

Enable Systemd Calibre-Web Service

Enable the service as follows:

$ sudo systemctl enable cps.service

Now the service will run automatically when the Server boots.


Resetting Calibre-Web Service Parameters

If it all goes horribly wrong, you can use the CPS command for Calibre-Web to manually edit some of the server and user parameters. Use CPS -h to get a list of what you can change.

If it goes horribly wrong and Calibre-Web is not loading properly you can edit the app.db file which contains the settings using a SQLlite command line interface.

For my linux distribution I installed SQLlite as follows:

$ sudo apt-get install sqllite3

Once installed I could access the database (in the directory /root./calibre-web) with SQLlite (make sure that Calibre-Web isn't running!): 

$ cd /root./calibre-web
$ sudo sqlite3 app.db  

In the SQLlite client select the "settings" table in the app.db database and list the columns available:

$ cd /root./calibre-web
$ sudo sqlite3 app.db
sqlite> .schema settings 

A list of the columns with the data type will be displayed. These are the column names for the various parameters of Calibre-Web.

We will change the HTTP port number, as I set this to something else and it screwed up loading the application and doesn't have a command line option using CPS:  

sqlite> UPDATE settings
   ...> set config_port = 8083; 

Quit SQLlite using <CTRL> D on your keyboard.

Restart Calibre-Web! :) 

Comments