A Work In Progress howto to install Calibre Server in NethServer, as requested in this thread: Education applications wishlist
WARNING: Not yet ready to use on a production server
The calibre Content server allows you to access your calibre libraries and read books directly in a browser by downloading the book in an off-line cache.
Install Calibre Server:
sudo -v && wget -nv -O- https://download.calibre-ebook.com/linux-installer.sh | sudo sh /dev/stdin
By default Calibre Content Server will be installed under /opt/calibre
path. To use a different location check the installation options.
Create a directory to store a library. If you want to use more than one library a better naming would be /var/lib/nethserver/calibre/libraries/default
and so on. For simplicity here we will use a single library.
mkdir -p /var/lib/nethserver/calibre/library
Add books to the library. You can upload some e-books to your server, or download them form Project Gutenberg, for example. Calibre identifies file types by its extension, make sure the uploaded e-books have the appropriate file extension. For simplicity here we create an empty book:
calibredb add --empty "test.epub" --title "Test" --with-library "/var/lib/nethserver/calibre/library"
Calibre can be set to work in read-only mode and open access, or work with user credentials. You can add users and set permissions using:
#add users and set permissions (interactive)
calibre-server --userdb "/var/lib/nethserver/calibre/users.sqlite" --manage-users
To auto-start calibre-server you can create a service unit:
cat << EOF > /etc/systemd/system/calibre-server.service
[Unit]
Description=calibre content server
After=network.target
[Service]
Type=simple
User=calibre
Group=calibre
ExecStart=/opt/calibre/calibre-server \
--access-log=/var/log/calibre-server-access.log \
--enable-auth \
--log=/var/log/calibre-server.log \
--port=8008 \
--url-prefix=/calibre \
--userdb=/var/lib/nethserver/calibre/users.sqlite \
"/var/lib/nethserver/calibre/library"
[Install]
WantedBy=multi-user.target
EOF
More options for calibre-server command are described in the manual.
As we have set the service to run as calibre
user, we create that user:
useradd -r -s /sbin/nologin -d /var/lib/nethserver/calibre -c "Calibre User" calibre
Before we forget, set permissions for calibre’s database, libraries and e-books:
chown -R calibre:calibre /var/lib/nethserver/calibre
Prepare log files:
touch /var/log/calibre-server.log /var/log/calibre-server-access.log
chown calibre:calibre /var/log/calibre-server*.log
Enable a port for calibre-server:
config set fw_calibreserver service status enabled TCPPort 8008 access green
signal-event firewall-adjust
Enable and start calibre-server service:
systemctl enable --now calibre-server
Access calibre server from a web browser going to http://FQDN-or-IP:8008
or http://FQDN-or-IP:8008/calibre
and login with any user created through calibredb command.
You can browse the library, upload e-books (if user have no restrictive permissions), read/convert/download them.
To log out you have to either clean session and cookies or close the browser.
To consider:
- Use a Reverse Proxy (no additional port exposed)
- Use of a Virtual Host
- https access (current howto settings are not secure)
- logrotate
- No AD/LDAP integration. Consider an import script or, IF it’s even possible, append some action to user create/modify events (only for local accounts provider, won’t work with remote providers).
- Security
- Consider other e-book management options.
Things to test
- http(s) with and without authentication
- books upload (testing each supported file type and small/big files). Multi-upload supported.
- read epub, pdf and other formats
- convert from/to many formats (most problematic is PDF which might be missing some library, occasionally had problems converting some big epub to other formats)
- login / read from mobile devices
- …