💾 Archived View for envs.net › ~neovoid › notes › calibre-server.md captured on 2024-08-18 at 19:06:02.
⬅️ Previous capture (2023-07-22)
-=-=-=-=-=-=-
# Create simple calibre server as user service (without sudo) ## warm up - Install calibre via nix or pkg manager of choice - 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/user create new file called calibre-server.service `touch 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.target
Note: remember to find the correct <path> of your calibre-server binary with `whereis calibre-server` command. - Enabling the service `systemctl --user enable calibre-server` - Starting the service `systemctl --user start calibre-server` - Check the service running at `localhost:8180` in your browser - Last but not least to run the service even after your user log out run this `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. ## 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`