Gregg's MOTD

Tips & Tricks that I've Encountered Over the Years...

Calibre Server Installation on a Raspberry Pi

May 26, 2023 — Gregg Szumowski

These instructions are for installing the Calibre book management software on a Raspberry Pi 4 running Ubuntu 20.04 but should work with Raspian or other Debian-derived operating systems. This is just a briefer version of the same instructions that are posted here.

Install the calibre-bin package and its dependencies:

$ sudo apt update && sudo apt install -y
$ sudo apt install calibre-bin

Create a user to run this program.

$ sudo adduser calibre

Login as the 'calibre' user and create some directories:

$ mkdir calibre-library
$ mkdir ~/books-to-add

Enable user authentication:

calibre-server --manage-users

Create a service for the Calibre server

[Unit]
Description=calibre content server
After=network.target

[Service]
Type=simple
User=calibre
Group=calibre
ExecStart=/usr/bin/calibre-server \
--port=8081 --enable-local-write --enable-auth \
/home/calibre/calibre-library

[Install]
WantedBy=multi-user.target

Enable the service:

$ sudo systemctl enable calibre-server
$ sudo systemctl start calibre-server

Create a cron job to run periodically add books from the books-to-add directory:

/5 * * * * calibredb add /home/calibre/books-to-add/ -r --with-library http://localhost:8081#calibre-library --username calibre --password *

Supplemental instructions are here

Tags: calibre, raspberry-pi, motd

Gitea Server Installation on a Raspberry Pi

May 25, 2023 — Gregg Szumowski

Create a 'git' user:

$ sudo adduser git

Login as the 'git' user and download the gitea binary from the gitea website (choose the latest version):

wget -O gitea https://dl.gitea.io/gitea/1.14.5/gitea-1.14.5-linux-amd64
chmod +x gitea

Create a service. We're keeping it simple here so we don't need a lot of the database-specific stuff:

[Unit]
Description=Gitea (Git with a cup of tea)
After=syslog.target
After=network.target

[Service]
# Modify these two values and uncomment them if you have
# repos with lots of files and get an HTTP error 500 because
# of that
#LimitMEMLOCK=infinity
#LimitNOFILE=65535
RestartSec=2s
Type=simple
User=git
Group=git
WorkingDirectory=/home/git/
# If using Unix socket: tells systemd to create the /run/gitea folder, which will contain the gitea.sock file
# (manually creating /run/gitea doesn't work, because it would not persist across reboots)
#RuntimeDirectory=gitea
ExecStart=/home/git/gitea web --config /home/git/custom/conf/app.ini
Restart=always
Environment=USER=git HOME=/home/git GITEAWORKDIR=/home/git

[Install]
WantedBy=multi-user.target

Enable and start Gitea at boot:

sudo systemctl enable gitea
sudo systemctl start gitea

Tags: git, gitea, raspberry-pi, motd