diyhosting/calibre.html

128 lines
3.8 KiB
HTML
Raw Permalink Normal View History

2021-07-02 21:46:11 +00:00
<!DOCTYPE html>
<html lang=en>
<head>
2021-10-10 21:31:21 +00:00
<title>Setting up a Calibre library server &ndash; diyhosting.bhh.sh</title>
2021-10-10 21:55:08 +00:00
<!--# include file=".nav.html" -->
2021-07-02 21:46:11 +00:00
</head>
<body>
<header><h1>Setting up a Calibre library server</h1></header>
<nav></nav>
<main>
2021-08-03 17:49:51 +00:00
<img src="pix/calibre.png" alt="Calibre logo" class=titleimg>
2021-07-02 21:46:11 +00:00
<p>
2021-07-07 12:26:55 +00:00
The Calibre library server is a great way to store your eBooks.
2021-07-02 21:46:11 +00:00
It allows you to:
2021-08-03 17:49:51 +00:00
</p>
<ul>
2021-07-02 21:46:11 +00:00
<li>Share your books with others.</li>
<li>Easily transfer your books between devices and access them from anywhere.</li>
2021-08-03 17:49:51 +00:00
</ul>
2021-07-02 21:46:11 +00:00
<h2>Installation</h2>
2021-08-03 17:49:51 +00:00
<p>Install the Calibre package.
You might also want rsync to upload books.</p>
2021-07-02 21:46:11 +00:00
2021-08-03 17:49:51 +00:00
<pre><code>apt install -y calibre rsync
2021-07-02 21:46:11 +00:00
mkdir /opt/calibre</code></pre>
<p>
2021-07-07 12:26:55 +00:00
Either upload your existing library using <code>rsync</code>. For example to <code>/opt/calibre/</code>.
<pre><code>cd ~/Documents
2021-08-03 17:49:51 +00:00
rsync -avuP <strong>your-library-dir</strong> root@<strong>example.org</strong>:/opt/calibre/</code></pre>
2021-07-02 21:46:11 +00:00
<p>
2021-07-07 12:26:55 +00:00
Or create a library and add a book to it:
2021-07-02 21:46:11 +00:00
</p>
<pre><code>cd /opt/calibre
2021-08-03 17:49:51 +00:00
calibredb add <strong>book.epub</strong> --with-library <strong>your-library</strong></code></pre>
2021-07-02 21:46:11 +00:00
<aside>
<p>
For more information about the <code>calibredb</code> command see <code>man calibredb</code>.
</p>
</aside>
<p>
2021-07-07 12:26:55 +00:00
Add a new user to protect your server:
2021-07-02 21:46:11 +00:00
</p>
2021-07-07 12:26:55 +00:00
2021-07-02 21:46:11 +00:00
<pre><code>calibre-server --manage-users</code></pre>
<h2>Creating a service</h2>
<p>
Create a new file <code>/etc/systemd/system/calibre-server.service</code> and add the following:
</p>
<pre><code>[Unit]
Description=Calibre library server
After=network.target
[Service]
Type=simple
User=root
Group=root
2021-07-07 12:26:55 +00:00
ExecStart=/usr/bin/calibre-server --enable-auth --enable-local-write /opt/calibre/your_library --listen-on 127.0.0.1
2021-07-02 21:46:11 +00:00
[Install]
WantedBy=multi-user.target
</code></pre>
2021-07-02 22:03:14 +00:00
<aside>
<p>
You can change the port with the <code>--port</code> prefix. Additional information <code>man calibre-server</code>.
</p>
</aside>
2021-07-02 21:46:11 +00:00
<p>
Issue <code>systemctl daemon-reload</code> to apply the changes.
</p>
<p>
Enable and start the service.
</p>
<pre><code>systemctl enable calibre-server
systemctl start calibre-server</code></pre>
<h2>A reverse proxy with Nginx</h2>
<p>
Create a new file <code>/etc/nginx/sites-available/calibre</code> and enter the following:
</p>
<pre><code>server {
2021-07-07 11:13:25 +00:00
listen 80;
client_max_body_size 64M; # to upload large books
2021-08-03 17:49:51 +00:00
server_name <strong>calibre.example.org</strong> ;
2021-07-07 12:26:55 +00:00
2021-07-07 11:13:25 +00:00
location / {
2021-07-02 21:46:11 +00:00
proxy_pass http://127.0.0.1:8080;
}
}</code></pre>
2021-08-03 17:49:51 +00:00
<p>Issue a Let's Encrypt certificate. <a href="certbot.html">Detailed instructions and additional information</a>.</p>
2021-07-02 21:46:11 +00:00
<pre><code>certbot --nginx</code></pre>
2021-08-03 17:49:51 +00:00
<p>Now just go to <strong>calibre.example.org</strong>. The server will request an username and a password.</p>
2021-07-02 21:46:11 +00:00
<a href="pix/calibre-1.png">
<img src="pix/calibre/calibre-1.png" alt="calibre">
</a>
2021-08-03 17:49:51 +00:00
<p>After login you will see something like this.</p>
2021-07-02 21:46:11 +00:00
<a href="pix/calibre-1.png">
<img src="pix/calibre/calibre-2.png" alt="calibre">
</a>
2021-08-03 17:49:51 +00:00
<h2>Contribution</h2>
<li>Author: rflx &ndash; <a href="https://rflx.xyz">website</a> -- XMR: <code class=crypto>48T5XpHTXAZ5Nn8YCypA4aWn1ffQLHJkFGDArXQB6cmrP6cqLY72cu7CR2iq2MmL5Ndu3d47e5MKjGpL4prYgdrTCFAHD9c</code>
</li>
2021-07-02 21:46:11 +00:00
</main>
2021-10-10 21:38:17 +00:00
<!--# include file=".footer.html" -->
2021-07-02 21:46:11 +00:00
</body>
</html>