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

Popular posts from this blog

Setting up NUT on a Raspberry Pi for Greencell USB UPS

  Background This article provides a guide for installing a USB UPS attached to a Raspberry Pi. In my case I had purchased a GreenCell 600 360W USB UPS. Integrating the USB UPS requires using NUT (Network UPS Tools). This UPS uses the blazer_usb driver. Installation NUT Plug-In the UPS USB-Connection to the host. My device showed up as Device 006 below: # lsusb   Bus 001 Device 006: ID 0001:0000 Fry's Electronics MEC0003 Bus 001 Device 005: ID 0bda:0309 Realtek Semiconductor Corp. USB3.0-CRW Bus 001 Device 004: ID 0658:0200 Sigma Designs, Inc. Aeotec Z-Stick Gen5 (ZW090) - UZB Bus 001 Device 003: ID 0424:ec00 Microchip Technology, Inc. (formerly SMSC) SMSC9512/9514 Fast Ethernet Adapter Bus 001 Device 002: ID 0424:9514 Microchip Technology, Inc. (formerly SMSC) SMC9514 Hub Install the NUT package with the apt package manager:   sudo apt-get install nut Make some configurations and changes in the nut directory /etc/nut: # cd /etc/nut drwxr-xr-x 2  root nut  4096   Jan 11 00:49 .

Sending SMS Messages from openHAB

Background So I setup sending SMS messages from my Raspberry Pi (see article I wrote here ) and have a bash script to automate this. The next step is to integrate this into my openHAB server, so I can send SMS messages to my mobile phone when my UPS system (managed by openHAB) is on battery power (e.g. due to a mains network failure). Installing the EXEC Binding to openHAB See here . Note especially the requirement to add commands to the whitelist. Adding a Thing to openHAB Once the EXEC binding is installed the next step is to setup a thing file to use the binding for sending bash shell commands:  $ nano /etc/openhab/things/exec.things Add the following line: Thing exec:command:sendsms [ command="/usr/local/bin/sendsms.sh %2$s", autorun=true, interval=0 ] Save the file. As you can see this thing is used to pass the command to run the bash shell script to send an SMS and pass the text sent as "%2$s" to the script. Adding Items to openHAB Two items are required, one

SMS messaging on Raspberry Pi with Gammu

Background Ever wanted to be alerted when the power fails at home? I typically worry that food in the freezer will go off when I am on vacation! (Yep, that's how I tick). I have recently installed a UPS system which I use to protect various IT and network devices from instant power loss, enabling them to shutdown gracefully. This is particulary important for my Raspberry Pi (Pi) devices, which are sensitive to this issue, as SD-Cards can be corrupted and then not re-boot.  The UPS I have installed interfaces via USB with my Raspberry Pi server using the Linux Network UPS tools NUT so that I can monitor status changes (e.g. grid power loss) and this is further integrated into my openHAB -based home automation system. This setup will be covered in another post.  I wanted to additionally be alerted when grid power fails via SMS to my mobile phone. To do this I have purchased a pre-owned USB Internet Surf Stick and a pay-as-you-go SIM card (zero cost) which I can load with credit. I a