
This is the blog cum Notes I thought I published ages ago but it turns out I never did. So here it is now.
Warm up
- Install
calibrepackage via nix or package manager of your choicesudo pacman -Sy calibre - Create library at prefered location where book going to be stored.
mkdir -p /home/you/library - Add books to that location
calibredb add /path/of/books.pdf --with-library /home/you/library
Main Course
-
Create a systemd user service in
~/.config/systemd/usercreate new file calledcalibre-server.servicetouch calibre-server.service -
Write init script
nvim calibre-server.service
[Unit]
Description=calibre content server
[Service]
Type=simple
ExecStart=/<path>/calibre-server --port=8180 --enable-local-write /home/you/library
[Install]
WantedBy=default.targetremember to find the correct location of your calibre-server binary with
whereis calibre-servercommand.
- Enabling the service
systemctl --user enable calibre-server - Starting the service
systemctl --user start calibre-server - Check the service running at
localhost:8180in your browser - Last but not least enable service to keep running in background even after your user logged out:
loginctl enable-linger username
Optionals:
Provide domain name for your service using reverse proxy
write nginx.conf file
server {
listen 10.0.0.20:80;
server_name library.yourdomain.com;
root /var/www/html;
index index.html;
location / {
proxy_pass http://127.0.0.1:8180/;
}
}Now simply going to https://library.yourdomain.com you will reach to the calibre server without having to know backend hostname or port number.
To Have multiple libraries
- Inorder to have multiple libraries running on same server just add the different library path to the main command
i.e.
/<path/calibre-server --port=8180 --enable-local-write /home/you/library/fiction /home/you/library/tech