<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Knowledge Management on Claws Garden</title><link>https://claws.top/blog/knowledge-management/</link><description>Recent content in Knowledge Management on Claws Garden</description><generator>Hugo</generator><language>zh-CN</language><managingEditor>jingjiecb@gmail.com (Claws)</managingEditor><webMaster>jingjiecb@gmail.com (Claws)</webMaster><copyright>Copyright © 2020, Claws.</copyright><lastBuildDate>Sat, 23 May 2026 22:23:44 +0800</lastBuildDate><follow_challenge><feedId>00000000000000000</feedId><userId>00000000000000000</userId></follow_challenge><atom:link href="https://claws.top/blog/knowledge-management/index.xml" rel="self" type="application/rss+xml"/><item><title>Build Your Online Ebook Library</title><link>https://claws.top/p/build-your-online-ebook-library/</link><pubDate>Sat, 23 May 2026 22:23:44 +0800</pubDate><author>jingjiecb@gmail.com (Claws)</author><guid>https://claws.top/p/build-your-online-ebook-library/</guid><description>&lt;p>This article introduce a solution to build your own online E-book library which can be accessed from any dervice(based on web, so any device with a browser is okay) and anywhere(exposed on public internet with https and user authentication, convenient and safe). The core techniques used are Calibre and OneDrive.&lt;/p>
&lt;p>&lt;a href="https://calibre-ebook.com/">Calibre&lt;/a> is a outstanding open-source E-book management service, which provide great E-book reading, editing and converting experience. It is a desktop applications and store the library locally. OneDrive is a file sync service from Microsoft, compatible on windows, mac and linux service(via opensource tool OneDrive Client for Linux). Combine these two tools, we can read E-book on any desktop devices offline, and sync the library across devices once online.&lt;/p>
&lt;p>But how about mobile? Don&amp;rsquo;t worry, Calibre has a feature called &amp;ldquo;content service&amp;rdquo; which can serve the library on web. We can deploy calibre content service on a server to provide the content of a Calibre library synced by OneDrive. Following content focuses on setting up the whole solution on a public, remote server.&lt;/p>
&lt;h2 id="onedrive-client-for-linux">Onedrive Client for Linux&lt;/h2>
&lt;p>Onedrive Client for Linux is a open-source onedrive cli, &lt;a href="https://github.com/abraunegg/onedrive">github link&lt;/a>.&lt;/p>
&lt;h3 id="installation">Installation&lt;/h3>
&lt;p>For ubuntu 24.04, don&amp;rsquo;t directly install onedrive from apt default repository(seems outdated), instead install from OpenSuSE Build Service repository. &lt;a href="https://github.com/abraunegg/onedrive/blob/master/docs/ubuntu-package-install.md#distribution-ubuntu-2404">guide&lt;/a>.&lt;/p>
&lt;h3 id="usage">Usage&lt;/h3>
&lt;p>First, run &lt;code>onedrive&lt;/code> , it will prompt an url used for authentication. Open the link in browser and login in to your Microsoft account. Once done, the browser will redrict you to a new url(which only appears shortly, so be quick), copy and paste the new link to onedrive to login in. The page may display text like &amp;ldquo;this is a incorrect page, you should never see the page.&amp;rdquo;, never mind.&lt;/p>
&lt;p>Check config: use &lt;code>onedrive --display-config&lt;/code> to print the current configuration. The sync dir is &lt;code>~/OneDrive&lt;/code> by default, which can be changed later.&lt;/p>
&lt;p>Sync mode:&lt;/p>
&lt;ul>
&lt;li>Sync once: &lt;code>onedrive --sync&lt;/code>, or &lt;code>onedrive -s&lt;/code>&lt;/li>
&lt;li>Ongoing sync: &lt;code>onedrive --monitor&lt;/code> or &lt;code>onedrive -m&lt;/code>. Usually there&amp;rsquo;s no need to keep the process running in background on our own because onedrive has already installed a user level systemd configuration. Use &lt;code>systemctl --user status/start/stop onedrive&lt;/code> to manage the onedrive systemd daemon, which sync the files continuously.&lt;/li>
&lt;/ul>
&lt;blockquote>
&lt;p>⚠️&lt;strong>Note&lt;/strong>: by default onedrive will sync &lt;strong>all files&lt;/strong> from cloud. If you don&amp;rsquo;t want to sync everything, Client Side Filter can be used.&lt;/p>
&lt;/blockquote>
&lt;p>Client side filter: most client filters are exclude files(specify which kind of files &lt;em>not&lt;/em> to sync), and only one &lt;code>sync-list&lt;/code> config directly specify the files to sync. Create a file named &lt;code>sync-list&lt;/code> in the onedrive config dir(by default &lt;code>~/.config/onedrive&lt;/code>) and add one file/dir per line. An example to only sync my Calibre library dir:&lt;/p>
&lt;pre tabindex="0">&lt;code>/Calibre-library/
&lt;/code>&lt;/pre>&lt;p>Test the config: Onedrive Client for Linux provide a dry-run way to verify if the onedrive will sync the files exactly you want. Run &lt;code>onedrive --sync --dry-run&lt;/code> to dry-run, which will print the operations to do instead of actually doing them.&lt;/p>
&lt;h2 id="calibre-content-server">Calibre content server&lt;/h2>
&lt;h3 id="installation-1">Installation&lt;/h3>
&lt;p>Calibre content service is a tool included in official Calibre release, and depends on the full version Calibre. Install calibre on ubuntu server using the official install script, refer to &lt;a href="https://calibre-ebook.com/download_linux">guide&lt;/a>. If encounter any library missing error, install the missing library mentioned in the error message, or ask genAI tools for help. Finally calibre will be installed at &lt;code>/opt/calibre&lt;/code>, with the &lt;code>calibre-server&lt;/code> command which we will use to start a e-book content server.&lt;/p>
&lt;h3 id="configuration">Configuration&lt;/h3>
&lt;p>&lt;strong>User management&lt;/strong>: I&amp;rsquo;d like to expose the content server on public internet, so both nginx reverse proxy and authenitcation is needed. Calibre content server itself support multi-user and user login, we can manage the user and password using &lt;code>calibre-server --manage-users&lt;/code>, follow the promots to add new user or modify password for existing users.&lt;/p>
&lt;p>&lt;strong>Test the service&lt;/strong>: &lt;code>calibre-server /path/to/OneDrive/Calibre-library --port 38080 --enable-auth&lt;/code> will start a calibre content server against the given library path and custome port, also need user to be authenticated to access the content. Try to run the command in shell to test if anything missing.&lt;/p>
&lt;p>&lt;strong>Create systemd service&lt;/strong>: Use systemd service to ensure the service always running in the background. refer to the following systemd file to setup systemd service:&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-systemd" data-lang="systemd">&lt;span style="display:flex;">&lt;span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"> 1&lt;/span>&lt;span>&lt;span style="color:#75715e"># /etc/systemd/system/calibre.service&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"> 2&lt;/span>&lt;span>&lt;span style="color:#66d9ef">[Unit]&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"> 3&lt;/span>&lt;span>&lt;span style="color:#a6e22e">Description&lt;/span>&lt;span style="color:#f92672">=&lt;/span>&lt;span style="color:#e6db74">calibre Content server&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"> 4&lt;/span>&lt;span>&lt;span style="color:#a6e22e">After&lt;/span>&lt;span style="color:#f92672">=&lt;/span>&lt;span style="color:#e6db74">network.target&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"> 5&lt;/span>&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"> 6&lt;/span>&lt;span>&lt;span style="color:#66d9ef">[Service]&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"> 7&lt;/span>&lt;span>&lt;span style="color:#a6e22e">Type&lt;/span>&lt;span style="color:#f92672">=&lt;/span>&lt;span style="color:#e6db74">simple&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"> 8&lt;/span>&lt;span>&lt;span style="color:#a6e22e">User&lt;/span>&lt;span style="color:#f92672">=&lt;/span>&lt;span style="color:#e6db74">root&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"> 9&lt;/span>&lt;span>&lt;span style="color:#a6e22e">ExecStart&lt;/span>&lt;span style="color:#f92672">=&lt;/span>&lt;span style="color:#e6db74">/opt/calibre/calibre-server &amp;#34;/root/OneDrive/Calibre-library&amp;#34; --enable-auth --port 38080&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">10&lt;/span>&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">11&lt;/span>&lt;span>&lt;span style="color:#66d9ef">[Install]&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">12&lt;/span>&lt;span>&lt;span style="color:#a6e22e">WantedBy&lt;/span>&lt;span style="color:#f92672">=&lt;/span>&lt;span style="color:#e6db74">multi-user.target&lt;/span>
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>Then you can use systemctl to manage the state of the calibre service. If you are not familiar with systemctl tool, just remember the following commonly used commands:&lt;/p>
&lt;ul>
&lt;li>&lt;code>systemctl daemon-reload&lt;/code>. reload the service config. Once you&amp;rsquo;ve modified the service file, run this to reload the service config.&lt;/li>
&lt;li>&lt;code>systemctl start calibre&lt;/code> start the calibre service. It will find the service with given service name and start the service in background.&lt;/li>
&lt;li>&lt;code>systemctl stop calibre&lt;/code> stop the service.&lt;/li>
&lt;li>&lt;code>systemctl status calibre&lt;/code> check the status of the service.&lt;/li>
&lt;/ul>
&lt;blockquote>
&lt;p>My new tips: If you run many services on a single server, it&amp;rsquo;s easy to forget which services are installed and running. My approach is to create an &lt;code>app&lt;/code> dir in the home directory, and create a directory for each service deployed on this server. For example, if the service is based on docker, I put the docker-compose.yaml file which define how to run the whole application in its dir. In this calibre case, I create a symbol link to the systemd file to remind me calibre is directly running on this machine and managed by systemd. When I want to see which services are running on the machine, I only need to check the &lt;code>app&lt;/code> directory and will know how to manage each service.&lt;/p>
&lt;/blockquote>
&lt;p>&lt;strong>Setup nginx reverse proxy&lt;/strong>: install nginx and create a new site configuration like this:&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-nginx" data-lang="nginx">&lt;span style="display:flex;">&lt;span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"> 1&lt;/span>&lt;span> &lt;span style="color:#66d9ef">server&lt;/span> {
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"> 2&lt;/span>&lt;span> &lt;span style="color:#f92672">listen&lt;/span> &lt;span style="color:#ae81ff">443&lt;/span> &lt;span style="color:#e6db74">ssl&lt;/span> &lt;span style="color:#e6db74">http2&lt;/span>;
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"> 3&lt;/span>&lt;span> &lt;span style="color:#f92672">server_name&lt;/span> &lt;span style="color:#e6db74">example.com&lt;/span>;
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"> 4&lt;/span>&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"> 5&lt;/span>&lt;span> &lt;span style="color:#f92672">ssl_certificate&lt;/span> &lt;span style="color:#e6db74">/etc/nginx/ssl/example.com.cert&lt;/span>;
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"> 6&lt;/span>&lt;span> &lt;span style="color:#f92672">ssl_certificate_key&lt;/span> &lt;span style="color:#e6db74">/etc/nginx/ssl/example.com.key&lt;/span>;
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"> 7&lt;/span>&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"> 8&lt;/span>&lt;span> &lt;span style="color:#f92672">location&lt;/span> &lt;span style="color:#e6db74">/&lt;/span> {
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"> 9&lt;/span>&lt;span> &lt;span style="color:#f92672">proxy_pass&lt;/span> &lt;span style="color:#e6db74">http://127.0.0.1:38080&lt;/span>;
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">10&lt;/span>&lt;span> }
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">11&lt;/span>&lt;span> }
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>If you don&amp;rsquo;t have a certificate, don&amp;rsquo;t hurry to buy one. My suggestion is to use opensource certificate management &amp;amp; continuous deployment solution like &lt;a href="https://github.com/certimate-go/certimate">certimate&lt;/a>. It supports setting up a certificate workflow to check, apply and deploy the certificate to your server.&lt;/p>
&lt;h3 id="access-from-browser">Access from browser&lt;/h3>
&lt;p>Use a password manager like Bitwarden to automatically get authenticated when accessing the Calibre website, then you don&amp;rsquo;t need to remember and input the username/password every time reading the e-books.&lt;/p></description></item></channel></rss>