Administrator
发布于 2020-03-08 / 6 阅读
0
0

使用 Calibre-web 搭建书库

本文使用Debian9进行搭建,其余系统未测试

安装

这里我把它放在home文件夹下

cd /home
git clone https://github.com/janeczku/calibre-web.git

进入目录

cd calibre-web

安装依赖

python2.7

pip install --target vendor -r requirements.txt

python3.x

pip3 install --target vendor -r requirements.txt

使用PM2守护

cat > /home/calibre-web/server.json <<EOF
{
    "name": "calibre-web",
    "cwd": "/home/calibre-web",
    "interpreter": "python3",
    "script": "cps.py"
}
EOF
pm2 start server.json
pm2 startup
pm2 save

此时 http://localhost:8083 or http://localhost:8083/opds 已可以访问

默认用户名:admin

默认密码:admin123

集成Google驾驶(Google Drive)

因为目前来看并不支持G suite子号进行相关操作,且使用驾驶需每周操作,故不作介绍

安装依赖

pip install --target vendor -r optional-requirements.txt

如果出现 Failed building wheel for python-ldap

apt-get install -y python-dev libldap2-dev libsasl2-dev libssl-dev

然后重试

具体请参考:https://github.com/janeczku/calibre-web/wiki/Configuration#using-google-drive-integration

配置域名访问

Nginx配置文件如下

server {
        listen 443 ssl;
        server_name book.huhuhu.in;
        client_max_body_size 20M;

        ssl_certificate /var/www/ssl/server.crt;
        ssl_certificate_key /var/www/ssl/server.key;

        location / {
            proxy_pass              http://127.0.0.1:8083;
            proxy_set_header        Host            $http_host;
            proxy_set_header        X-Forwarded-For $proxy_add_x_forwarded_for;
            proxy_set_header        X-Scheme        $scheme;
            proxy_set_header        X-Script-Name   /calibre;
        }

}

设置上传转换

apt install xdg-utils wget xz-utils libnss3

确保GLIBC≥2.18,GLIBC版本可通过getconf GNU_LIBC_VERSION进行查看

将calibre安装到/opt

wget -nv -O- https://download.calibre-ebook.com/linux-installer.sh | sudo sh /dev/stdin install_dir=/opt

可能会出现如下错误

xdg-desktop-menu: No writable system menu directory found.

解决方法很简单

mkdir /usr/share/desktop-directories/

项目地址:https://github.com/janeczku/calibre-web


评论