July 13, 2024

Calibre-Web群晖Docker设置

环境



步骤

  1. 打开网页DSM,创建本地文件夹及准备文件,待会儿作映射到Docker容器内部

    文件夹

    • calibre/library
    • data
    • metadata_provider(可选,用于获取豆瓣书籍详情介绍用)

    文件

    • NewDouban.py(放入/metadata_provider下。可选,用于获取豆瓣书籍详情介绍)

    • metadata.db(放入/calibre/library下)

      metadata.db是Calibre软件生成的书籍数据库,可以在电脑上/Users/userName/Calibre Library下找到或下载sample使用

    文件夹架构为

    • docker
      • Calibre-Web
        • calibre
          • library
            • metadata.db
        • data
        • metadata_provider
          • NewDouban.py

    截屏2024-07-13 下午4.21.17

  2. SSH连接NAS(需要在DSM控制面板>终端机和SNMP>终端机下勾选启动SSH功能

    打开Terminal输入

    1
    2
    3
    4
    5
    6
    7
    8
    # userName:登陆群晖的用户名
    # NAS_ip:群晖的ip地址
    ssh userName@NAS_ip
    # 输入登录群晖用户名的密码,这里密码不会显示

    # Eg
    ssh [email protected]
    Password:
  3. 获取当前用户id及groups

    1
    2
    3
    4
    id

    # Eg
    andy@DS:~$ id

    输出

    1
    uid=1026(andy) gid=100(users) groups=100(users),101(administrators)
  4. 修复权限(如果出现上传书籍失败再来尝试这条

    1
    2
    3
    4
    5
    6
    7
    8
    # 此命令将 /volume1/docker/Calibre-Web/calibre/library 目录及其所有子目录和文件的所有者更改为 UID 1026,所属组更改为 GID 101。
    sudo chown -R 1026:101 /volume1/docker/Calibre-Web/calibre/library

    # 此命令将 /volume1/docker/Calibre-Web/calibre/library 目录及其所有子目录和文件的权限设置为 775,这意味着:
    # 所有者可以读取、写入和执行。
    # 所属组用户可以读取、写入和执行。
    # 其他用户可以读取和执行。
    sudo chmod -R 775 /volume1/docker/Calibre-Web/calibre/library

    书籍上传或转换格式失败大概率是因为书籍library文件夹权限错误导致的,建议查看Calibre-Web Log的具体error message。

    这两行命令的目的是确保 /volume1/docker/Calibre-Web/calibre/library 目录及其所有子目录和文件具有正确的所有权和权限,使得特定用户和组(UID 1026 和 GID 101)拥有对这些文件的完全控制权,同时其他用户可以读取和执行这些文件。

  5. 拉取Calibre-Web的映像文件

    打开Container Manager > 注册表 > 搜索calibre-web > 选择linuxserver/calibre-web > 下载 > 选择latest标签 > 应用

    Container Manager会开始下载calibre-web的映像文件到群晖本地。

    截屏2024-07-19 下午2.32.57

  6. 创建容器

    选择映像 > 选择刚下载好的linuxserver/calibre-web映像 > 运行 > 容器名称任意 > 勾选启动自动重新启动 > 下一步

    截屏2024-07-19 下午2.40.51

  7. 设置容器端口、文件夹及文件映射

    截屏2024-07-13 下午4.03.03

    本地端口:随便一个本地不被占用的端口,也可以选择默认的8083端口(如果没被其他应用占用的话)

    存储空间设置(用于将文件夹及文件映射到容器内部)

    1
    2
    3
    4
    5
    # Eg
    # /metadata_provider/NewDouban.py 可选,用于获取豆瓣书籍详情介绍用
    /docker/Calibre-Web/data /config
    /docker/Calibre-Web/calibre/library /books
    /docker/Calibre-Web/metadata_provider/NewDouban.py /app/calibre-web/cps/metadata_provider/NewDouban.py
    本地 映射到 容器内部
    /calibre/library 映射到 /books
    /data 映射到 /config
    /metadata_provider/NewDouban.py 映射到 /app/calibre-web/cps/metadata_provider/NewDouban.py
  8. 设置环境变量

    1
    2
    3
    4
    TZ=Asia/Shanghai
    PUID=1026
    PGID=101
    DOCKER_MODS=linuxserver/mods:universal-calibre

    TZ=Asia/Shanghai 可选,用于设置时区

    PUID和PGID改成第3步获取的用户uid和groups。

    例如这里的群晖用户PUID为1026,想要在此容器内使用的权限为管理员权限所以设置用户组为administrators(系统管理员)用户组即PGID=101。

    DOCKER_MODS=linuxserver/mods:universal-calibre 可选, 仅限x86-64, 添加可以开启转换书籍格式的功能

    截屏2024-07-13 下午4.06.12

  9. 点击下一步 > 勾选向导完成后运行此容器 > 完成

    截屏2024-07-13 下午4.07.13

  10. 浏览器输入NAS地址加端口号来访问Calibre-Web客户端

    例如http://192.168.1.1:8083

  11. 使用默认的管理员账号密码登陆

    账号:admin

    密码:admin123

  12. 选择用户名

    image-20240713170635279

  13. Language下可以更改语言、密码等。

  14. 指定Calibre数据库位置

    选择管理权限(Admin) > 编辑Calibre数据库配置 > Calibre数据库路径,选择第7步中设置映射的metadata.db路径(即/books)。

  15. 开启书籍上传功能

    选择管理权限(Admin) > 编辑基本配置 > 功能配置下勾选启用上传

  16. 添加转换书籍插件(必须要在创建容器时添加环境变量DOCKER_MODS=linuxserver/mods:universal-calibre才可以使用!!!

    选择Admin

    image-20240713170825024

    Configuration > Edit Basic Configuration > External binaries下,添加转换书籍插件的路径

    Path to E-Book Converter:/usr/bin/ebook-convert

    更新:

    在Calibre-Web 0.6.22中Path to E-Book Converter地址由文件地址改为了ebook-convert所在文件夹的地址

    Calibre-Web 0.6.22版本这里需要更改为/usr/bin

    Path to Kepubify E-Book Converter: /usr/bin/kepubify

    Location of Unrar binary: /usr/bin/unrar



客户端阅读器

Calibre-Web支持opds协议。

OPDS全称是Open Publication Distribution System开放式出版发布系统,使用 Atom 格式,意在为电子书在线目录建立一个公开标准。

OPDS 将 RSS 信息源,替换为电子书目录,包括链接到书籍封面和简短摘要的可选链接。使用 OPDS,用户无需到处点击链接,通过电子书应用程序,只需订阅并搜索这些目录,然后就可以将电子书下载到 ebook 阅读器中,不需要再使用浏览器或其他应用程序。

OPDS 标准核心功能是支持 EPUB 标准和基于 Atom XML 的目录格式。

路径为Calibre-Web ip + 端口/opds

1
2
Eg.
192.168.1.1:8083/opds

输入Calibre-Web的登陆用户名和密码登录

截屏2024-07-27 下午2.56.13

截屏2024-07-27 下午2.57.04


其他部分OPDS阅读器

更多请参考calibre-web FAQ



后续更新

在Container Manager中选择映像 > linuxserver/calibre-web > 有可用更新 > 更新

截屏2024-08-02 下午2.23.37

镜像更新完成后强烈建议手动重新启动Calibre-Web容器来避免一些奇奇怪怪的报错。

截屏2024-07-27 下午4.33.07



记录

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
andy@DS218Plus:/volume1/docker/Calibre-Web/calibre$ sudo docker ps
Password:
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
21715e1c91dd linuxserver/calibre-web:latest "/init" 5 minutes ago Up 5 minutes 0.0.0.0:8083->8083/tcp, :::8083->8083/tcp linuxserver-calibre-web
andy@DS218Plus:/volume1/docker/Calibre-Web/calibre$ sudo docker exec -it linuxserver-calibre-web /bin/bash
root@linuxserver-calibre-web:/# ls
app books CALIBRE_RELEASE config dev etc init lib32 libx32 lsiopy mnt package root sbin sys usr
bin boot command defaults docker-mods home lib lib64 linuxserver.mods.universal-calibre media opt proc run srv tmp var
root@linuxserver-calibre-web:/# cd app
root@linuxserver-calibre-web:/app# ls
calibre calibre-web
root@linuxserver-calibre-web:/app# cd calibre-web/
root@linuxserver-calibre-web:/app/calibre-web# ls
babel.cfg CONTRIBUTING.md cps cps.py exclude.txt LICENSE MANIFEST.in messages.pot optional-requirements.txt README.md requirements.txt SECURITY.md setup.cfg setup.py
root@linuxserver-calibre-web:/app/calibre-web# cd cps
root@linuxserver-calibre-web:/app/calibre-web/cps# ls
about.py comic.py debug_info.py fs.py iso_language_names.py logger.py opds.py schedule.py static translations
admin.py config_sql.py dep_check.py gdrive.py isoLanguages.py main.py pagination.py search_metadata.py subproc_wrapper.py ub.py
babel.py constants.py editbooks.py gdriveutils.py jinjia.py metadata_provider redirect.py search.py tasks updater.py
cache converter.py epub.py gevent_wsgi.py kobo_auth.py MyLoginManager.py remotelogin.py server.py tasks_status.py uploader.py
cache_buster.py cover.py error_handler.py helper.py kobo.py oauth_bb.py render_template.py services templates usermanagement.py
cli.py db.py fb2.py __init__.py kobo_sync_status.py oauth.py reverseproxy.py shelf.py tornado_wsgi.py web.py
root@linuxserver-calibre-web:/app/calibre-web/cps# cd metadata_provider/
root@linuxserver-calibre-web:/app/calibre-web/cps/metadata_provider# ls
amazon.py comicvine.py douban.py google.py lubimyczytac.py NewDouban.py scholar.py
root@linuxserver-calibre-web:/app/calibre-web/cps/metadata_provider# cd ..
root@linuxserver-calibre-web:/app/calibre-web/cps# cd ..
root@linuxserver-calibre-web:/app/calibre-web# cd ..
root@linuxserver-calibre-web:/app# cd ..
root@linuxserver-calibre-web:/# ls
app books CALIBRE_RELEASE config dev etc init lib32 libx32 lsiopy mnt package root sbin sys usr
bin boot command defaults docker-mods home lib lib64 linuxserver.mods.universal-calibre media opt proc run srv tmp var
root@linuxserver-calibre-web:/# cd usr
root@linuxserver-calibre-web:/usr# ls
bin games include lib lib32 lib64 libexec libx32 local sbin share src
root@linuxserver-calibre-web:/usr# cd bin
root@linuxserver-calibre-web:/usr/bin# ls
'[' delpart gpgconf lspgpot ps2epsi s6-freeramdisk s6-svlisten taskset
addpart df gpg-connect-agent lzcat ps2pdf s6-ftrig-listen s6-svlisten1 tee
animate diff gpgparsemail lzcmp ps2pdf12 s6-ftrig-listen1 s6-svok tempfile
animate-im6 diff3 gpgsm lzdiff ps2pdf13 s6-ftrig-notify s6-svperms test
animate-im6.q16 dir gpgsplit lzegrep ps2pdf14 s6-ftrigrd s6-svscan tic
apt dircolors gpgtar lzfgrep ps2pdfwr s6-ftrig-wait s6-svscanctl timeout
apt-cache dirmngr gpgv lzgrep ps2ps s6-getservbyname s6-svstat tload
apt-cdrom dirmngr-client gpg-wks-server lzless ps2ps2 s6-grep s6-svunlink toe
apt-config dirname gpg-zip lzma ps2txt s6-head s6-svwait top
apt-extracttemplates display grep lzmainfo ptx s6-hiercopy s6-swapoff touch
apt-ftparchive display-im6 groups lzmore pwd s6-hostname s6-swapon tput
apt-get display-im6.q16 gs man pwdx s6-ident-client s6-sync tr
apt-key dmesg gsbj markdown-calibre py3clean s6-instance-control s6-tai64n trap
apt-mark dnsdomainname gsdj mawk py3compile s6-instance-create s6-tai64ndiff true
apt-sortpkgs dollarat gsdj500 mcookie py3versions s6-instance-delete s6-tai64nlocal truncate
arch domainname gslj md5sum pydoc3 s6-instance-list s6-taiclock tryexec
awk dpkg gslp md5sum.textutils pydoc3.10 s6-instance-maker s6-taiclockd tset
b2sum dpkg-deb gsnd mesg pygettext3 s6-instance-status s6-tail tsort
background dpkg-divert gunzip migrate-pubring-from-classic-gpg pygettext3.10 s6-ioconnect s6-tcpclient tty
backtick dpkg-maintscript-helper gzexe mkdir python3 s6-ipcclient s6-tcpserver tzselect
base32 dpkg-query gzip mkfifo python3.10 s6-ipcserver s6-tcpserver-access ucf
base64 dpkg-realpath hardlink mknod rbash s6-ipcserver-access s6-tcpserverd ucfq
basename dpkg-split head mktemp readlink s6-ipcserverd s6-tcpserver-socketbinder ucfr
basenc dpkg-statoverride heredoc mogrify realpath s6-ipcserver-socketbinder s6-tlsc uclampset
bash dpkg-trigger homeof mogrify-im6 redirfd s6-linkname s6-tlsc-io ucspilogd
bashbug du hostid mogrify-im6.q16 renice s6-linux-init s6-tlsclient umask
calibre dvipdf hostname montage reset s6-linux-init-echo s6-tlsd umount
calibre-customize ebook-convert i386 montage-im6 resizepart s6-linux-init-hpr s6-tlsd-io uname
calibredb ebook-device iconv montage-im6.q16 rev s6-linux-init-logouthookd s6-tlsserver uncompress
calibre-debug ebook-edit id more rgrep s6-linux-init-maker s6-touch unexpand
calibre-parallel ebook-meta identify mount rm s6-linux-init-nuke s6-true unexport
calibre-server ebook-polish identify-im6 mountpoint rmdir s6-linux-init-shutdown s6-ucspitlsc uniq
calibre-smtp ebook-viewer identify-im6.q16 multidefine rngseed s6-linux-init-shutdownd s6-ucspitlsd unlink
calibre-uninstall echo if multisubstitute runblock s6-linux-init-telinit s6-umount unlzma
captoinfo egrep ifelse mv runcon s6-linux-init-umountall s6-uniquename unrar
case elgetopt ifte namei run-parts s6-linux-utils s6-unquote unshare
cat elgetpositionals ifthenelse nawk s6-accessrules-cdb-from-fs s6-ln s6-unquote-filter unxz
catatonit elglob import nc s6-accessrules-fs-from-cdb s6-log s6-update-symlinks update-alternatives
cd eltest importas nc.openbsd s6-applyuidgid s6-logwatch s6-usertree-maker uptime
chage emptyenv import-im6 netcat s6-basename s6-ls savelog users
chattr env import-im6.q16 newgrp s6-cat s6-maximumtime script utmpdump
chcon envfile infocmp nice s6-chmod s6-mkdir scriptlive vdir
chfn eps2eps infotocap nisdomainname s6-chown s6-mkfifo scriptreplay vmstat
chgrp exec install nl s6-chroot s6-mkfifodir sdiff w
chmod execline ionice nohup s6-cleanfifodir s6-mount sed wait
choom execlineb ipcmk nproc s6-clock s6-nice seekablepipe wall
chown execline-cd ipcrm nsenter s6-clockadd s6-notifyoncheck select-editor watch
chrt execline-umask ipcs numfmt s6-clockview s6-nuke sensible-browser watchgnupg
chsh exit ischroot od s6-connlimit s6-overlay-suexec sensible-editor wc
cksum expand join openssl s6-cut s6-pause sensible-pager wdctl
clear expiry jq pager s6-dirname s6-permafailon seq web2disk
clear_console export kbxutil partx s6-dns-hosts-compile s6-pivotchroot setarch whereis
cmp expr kepubify passwd s6-dnsip s6-portable-utils setpriv which
comm factor kill paste s6-dnsip4 s6-printenv setsid which.debianutils
compare faillog last pathchk s6-dnsip4-filter s6-ps setterm who
compare-im6 fallocate lastb pdb3 s6-dnsip6 s6-quote sg whoami
compare-im6.q16 false lastlog pdb3.10 s6-dnsip6-filter s6-quote-filter sh with-contenv
composite fdblock lcf pdf2dsc s6-dnsmx s6-randomip sha1sum with-retries
composite-im6 fdclose ldd pdf2ps s6-dnsname s6-rc sha224sum withstdinas
composite-im6.q16 fdmove link perl s6-dnsname-filter s6-rc-bundle sha256sum X11
conjure fdreserve linux32 perl5.34.0 s6-dnsns s6-rc-compile sha384sum x86_64
conjure-im6 fdswap linux64 pf2afm s6-dnsq s6-rc-db sha512sum xargs
conjure-im6.q16 fetch-ebook-metadata ln pfbtopfa s6-dnsqr s6-rc-dryrun shift xz
convert fgrep locale pgrep s6-dnsqualify s6-rc-format-upgrade shred xzcat
convert-im6 fincore locale-check pidof s6-dnssoa s6-rc-init shuf xzcmp
convert-im6.q16 find localedef pidwait s6-dnssrv s6-rc-update skadnsd xzdiff
cp findmnt logger pinentry s6-dnstxt s6-rename skill xzegrep
c_rehash flock login pinentry-curses s6-dumpenv s6-rmrf slabtop xzfgrep
crontab fmt logname pinky s6-echo s6-seq sleep xzgrep
csplit fold logutil-newfifo pipeline s6-env s6-setlock snice xzless
curl forbacktickx logutil-service piperw s6-envdir s6-setsid sort xzmore
cut foreground loopwhilex pkill s6-envuidgid s6-setuidgid split yes
dash forstdin lrf2lrs pldd s6-expr s6-sleep stat ypdomainname
date forx lrfviewer pmap s6-false s6-sntpclock stdbuf zcat
dd free lrs2lrf posix-cd s6-fdholderd s6-socklog stream zcmp
debconf getconf ls posix-umask s6-fdholder-daemon s6-softlimit stream-im6 zdiff
debconf-apt-progress getcwd lsattr pphs s6-fdholder-delete s6-sort stream-im6.q16 zdump
debconf-communicate getent lsblk pr s6-fdholder-getdump s6-sudo stty zegrep
debconf-copydb getopt lscpu printafm s6-fdholder-list s6-sudoc su zfgrep
debconf-escape getpid lsiown printcontenv s6-fdholder-retrieve s6-sudod sum zforce
debconf-set-selections ghostscript lsipc printenv s6-fdholder-setdump s6-supervise sync zgrep
debconf-show gpasswd lslocks printf s6-fdholder-store s6-svc tabs zless
deb-systemd-helper gpg lslogins prlimit s6-fdholder-transferdump s6-svdt tac zmore
deb-systemd-invoke gpg-agent lsmem ps s6-fghack s6-svdt-clear tail znew
define gpgcompose lsns ps2ascii s6-format-filter s6-svlink tar
root@linuxserver-calibre-web:/usr/bin# cd ebook-convert
bash: cd: ebook-convert: Not a directory
root@linuxserver-calibre-web:/usr/bin# ls -ld ebook-convert
lrwxrwxrwx 1 root root 26 Jul 1 13:23 ebook-convert -> /app/calibre/ebook-convert
root@linuxserver-calibre-web:/usr/bin# cd /app/calibre/
root@linuxserver-calibre-web:/app/calibre# ls
bin calibre-complete calibredb calibre-parallel calibre-server ebook-convert ebook-edit ebook-polish fetch-ebook-metadata libexec lrfviewer markdown-calibre resources web2disk
calibre calibre-customize calibre-debug calibre_postinstall calibre-smtp ebook-device ebook-meta ebook-viewer lib lrf2lrs lrs2lrf plugins translations
root@linuxserver-calibre-web:/app/calibre# ls -ld ebook-convert
-rwxr-xr-x 1 1000 1000 14472 Jun 28 10:51 ebook-convert
root@linuxserver-calibre-web:/app/calibre# cd ..
root@linuxserver-calibre-web:/app# cd ..
root@linuxserver-calibre-web:/# ls
app books CALIBRE_RELEASE config dev etc init lib32 libx32 lsiopy mnt package root sbin sys usr
bin boot command defaults docker-mods home lib lib64 linuxserver.mods.universal-calibre media opt proc run srv tmp var
root@linuxserver-calibre-web:/# cd books
root@linuxserver-calibre-web:/books# ls
metadata.db
root@linuxserver-calibre-web:/books# cd ..
root@linuxserver-calibre-web:/# cd config
root@linuxserver-calibre-web:/config# ls
app.db calibre-web.log client_secrets.json gdrive.db


参考

About this Post

This post is written by Andy, licensed under CC BY-NC 4.0.

#Synology#Docker#Calibre-Web