如何基于CentOS二进制部署Calibre?

Linux基础
8

1 基础知识

1.1 什么是Caliber

– Caliber是一款电子书管理软件
– Caliber完全开源免费
– Caliber主要使用Python编写并包含一些C/C++的代码

1.2 Caliber的功能

– 支持查看电子书(支持所有主要的电子书格式)
– 支持转换电子书(支持所有主要的电子书格式)
– 支持编辑电子书(支持所有主要的电子书格式)
– 支持分类电子书(支持所有主要的电子书格式)
– 支持与电子书阅读器设备对话
– 支持从互联网获取图书的元数据
– 支持报纸的下载并转换为电子书以便于阅读

1.3 安装须知

1.3.1 Caliber支持的系统平台

– Linux
– Widonws
– macOS

1.3.2 对Python的需求

– Caliber与Python 3不兼容
– Caliber需要不低于Python 2.7.9版本

2 最佳实践

2.1 环境信息

OS = CentOS 8.1 x86_64
ip address= 10.168.0.100
hostname = any.cmdschool.org

2.2 安装Caliber

2.2.1 下载软件包

cd ~
wget https://download.calibre-ebook.com/4.13.0/calibre-4.13.0-x86_64.txz

其他版本请从以下链接下载,
https://download.calibre-ebook.com/

2.2.2 部署软件包

mkdir -p /opt/calibre
rm -rf /opt/calibre/*
cd ~
tar -xf calibre-4.13.0-x86_64.txz -C /opt/calibre/

2.2.3 安装软件包

/opt/calibre/calibre_postinstall

可见如下提示,

Using python executable: /usr/bin/python3
2020-03-30 11:37:31 URL:https://download.calibre-ebook.com/linux-installer.sh [31887/31887] -> "-" [1]
Installing to /opt/calibre
Downloading tarball signature securely...
Using previously downloaded calibre-4.13.0-x86_64.txz
Extracting files to /opt/calibre ...
Extracting application files...
Creating symlinks...
        Symlinking /opt/calibre/fetch-ebook-metadata to /usr/bin/fetch-ebook-metadata
        Symlinking /opt/calibre/lrf2lrs to /usr/bin/lrf2lrs
        Symlinking /opt/calibre/markdown-calibre to /usr/bin/markdown-calibre
        Symlinking /opt/calibre/ebook-edit to /usr/bin/ebook-edit
        Symlinking /opt/calibre/lrfviewer to /usr/bin/lrfviewer
        Symlinking /opt/calibre/ebook-viewer to /usr/bin/ebook-viewer
        Symlinking /opt/calibre/web2disk to /usr/bin/web2disk
        Symlinking /opt/calibre/calibre-customize to /usr/bin/calibre-customize
        Symlinking /opt/calibre/ebook-device to /usr/bin/ebook-device
        Symlinking /opt/calibre/calibre to /usr/bin/calibre
        Symlinking /opt/calibre/ebook-meta to /usr/bin/ebook-meta
        Symlinking /opt/calibre/calibre-server to /usr/bin/calibre-server
        Symlinking /opt/calibre/calibre-smtp to /usr/bin/calibre-smtp
        Symlinking /opt/calibre/lrs2lrf to /usr/bin/lrs2lrf
        Symlinking /opt/calibre/calibredb to /usr/bin/calibredb
        Symlinking /opt/calibre/ebook-polish to /usr/bin/ebook-polish
        Symlinking /opt/calibre/ebook-convert to /usr/bin/ebook-convert
        Symlinking /opt/calibre/calibre-debug to /usr/bin/calibre-debug
        Symlinking /opt/calibre/calibre-parallel to /usr/bin/calibre-parallel
Setting up command-line completion...
Installing zsh completion to: /usr/share/zsh/vendor-completions/_calibre
Installing bash completion to: /usr/share/bash-completion/completions/
Setting up desktop integration...
Creating un-installer: /usr/bin/calibre-uninstall
Run "calibre" to start calibre

2.2.4 测试运行

calibre

如果遇到如下提示,

qt.qpa.xcb: could not connect to display
qt.qpa.plugin: Could not load the Qt platform plugin "xcb" in "" even though it was found.
This application failed to start because no Qt platform plugin could be initialized. Reinstalling the application may fix this problem.

Available platform plugins are: eglfs, linuxfb, minimal, minimalegl, offscreen, vnc, wayland-egl, wayland, wayland-xcomposite-egl, wayland-xcomposite-glx, xcb.

Aborted (core dumped)

请使用如下设置解决,

echo "export QT_QPA_PLATFORM='offscreen'" | tee /etc/profile.d/QT_QPA.sh
source /etc/profile

再次尝试运行,

calibre

注:按下【Ctrl+Z】结束程序

参阅文档
=================

官方首页
—————-
https://calibre-ebook.com/

软件下载
—————-
https://calibre-ebook.com/download

gihub
—————-
https://github.com/kovidgoyal/calibre

二进制安装
————
https://calibre-ebook.com/download_linux
https://manual.calibre-ebook.com/develop.html#binary-install-of-calibre

编译安装
—————-
https://github.com/kovidgoyal/calibre/blob/master/bypy/README.rst
https://manual.calibre-ebook.com/develop.html#source-install-on-linux

sudo -v && wget -nv -O- https://download.calibre-ebook.com/linux-installer.sh | sudo sh /dev/stdin
Using python executable: /bin/python2
2020-07-04 15:34:41 URL:https://download.calibre-ebook.com/linux-installer.sh [31922/31922] -> “-” [1]
Installing to /opt/calibre
Downloading tarball signature securely…
Using previously downloaded calibre-4.20.0-x86_64.txz
Extracting files to /opt/calibre …
Extracting application files…
Creating symlinks…
Symlinking /opt/calibre/lrs2lrf to /usr/bin/lrs2lrf
Symlinking /opt/calibre/calibre-server to /usr/bin/calibre-server
Symlinking /opt/calibre/ebook-polish to /usr/bin/ebook-polish
Symlinking /opt/calibre/lrfviewer to /usr/bin/lrfviewer
Symlinking /opt/calibre/lrf2lrs to /usr/bin/lrf2lrs
Symlinking /opt/calibre/calibre-customize to /usr/bin/calibre-customize
Symlinking /opt/calibre/calibre-smtp to /usr/bin/calibre-smtp
Symlinking /opt/calibre/fetch-ebook-metadata to /usr/bin/fetch-ebook-metadata
Symlinking /opt/calibre/calibre-parallel to /usr/bin/calibre-parallel
Symlinking /opt/calibre/ebook-edit to /usr/bin/ebook-edit
Symlinking /opt/calibre/calibre to /usr/bin/calibre
Symlinking /opt/calibre/markdown-calibre to /usr/bin/markdown-calibre
Symlinking /opt/calibre/ebook-device to /usr/bin/ebook-device
Symlinking /opt/calibre/ebook-viewer to /usr/bin/ebook-viewer
Symlinking /opt/calibre/calibredb to /usr/bin/calibredb
Symlinking /opt/calibre/ebook-convert to /usr/bin/ebook-convert
Symlinking /opt/calibre/ebook-meta to /usr/bin/ebook-meta
Symlinking /opt/calibre/calibre-debug to /usr/bin/calibre-debug
Symlinking /opt/calibre/web2disk to /usr/bin/web2disk
Setting up command-line completion…
Installing zsh completion to: /usr/share/zsh/site-functions/_calibre
Failed to find directory to install bash completions, using default.
Installing bash completion to: /usr/share/bash-completion/completions/

____________________ WARNING ____________________
Setting up completion failed with error:
__________________________________________________

Traceback (most recent call last):
File “site-packages/calibre/linux.py”, line 834, in setup_completion
File “site-packages/calibre/linux.py”, line 577, in write_completion
File “site-packages/calibre/gui2/viewer/main.py”, line 12, in
ImportError: libXcomposite.so.1: 无法打开共享对象文件: 没有那个文件或目录

Setting up desktop integration…
Creating un-installer: /usr/bin/calibre-uninstall

There were 1 warnings

* Setting up completion failed with error:

Run “calibre” to start calibre
————————————————————————-
报错死活过不去了

从错误提示可知是缺少“libXcomposite”,如果系统是CentOS 8.x,可以使用如下命令解决依赖关系,

# yum install -y libXcomposite

另外,CentOS 6.x中该包的名称为“libXcomposite-devel” ,所以安装命令也有所差异,

# yum install -y libXcomposite-devel

如果该包已经安装,我在系统层面通过以下命令查询可以匹配你提示的文件,

# rpm -ql libXcomposite

可见如下提示,
————————————————–
/usr/lib/.build-id
/usr/lib/.build-id/e0
/usr/lib/.build-id/e0/61f3cdf45f50d2ec6e33df01587f3a59ac9f66
/usr/lib64/libXcomposite.so.1
/usr/lib64/libXcomposite.so.1.0.0
/usr/share/doc/libXcomposite
/usr/share/doc/libXcomposite/AUTHORS
/usr/share/doc/libXcomposite/COPYING
/usr/share/doc/libXcomposite/ChangeLog
/usr/share/doc/libXcomposite/README
————————————————–
如果是其他版本的系统,可以尝试使用如下命令查找该安装包,

# yum search libXcomposite

另外,如果系统的官方源没有找到该包,可尝试增加epel的安装源,详细命令如下,

# yum install -y epel-release

您好,我想向您请教一下,遇到这个提示该怎么办呀。

WARNING ____________________
Setting up desktop integration failed with error:
__________________________________________________

Traceback (most recent call last):
File “site-packages/calibre/linux.py”, line 854, in setup_desktop_integration
File “site-packages/calibre/linux.py”, line 839, in install_icons
File “site-packages/calibre/linux.py”, line 833, in install_single_icon
File “subprocess.py”, line 185, in check_call
File “subprocess.py”, line 172, in call
File “subprocess.py”, line 394, in __init__
File “subprocess.py”, line 1047, in _execute_child
OSError: [Errno 2] No such file or directory

Creating un-installer: /usr/bin/calibre-uninstall

There were 1 warnings

* Setting up desktop integration failed with error:

[root@VM-0-15-centos wwwroot]#

出现以下情况,怎么办呀,求指教呀

[root@VM-0-15-centos wwwroot]# /opt/calibre/calibre_postinstall
Creating symlinks…
Symlinking /opt/calibre/fetch-ebook-metadata to /usr/bin/fetch-ebook-metadata
Symlinking /opt/calibre/ebook-meta to /usr/bin/ebook-meta
Symlinking /opt/calibre/lrfviewer to /usr/bin/lrfviewer
Symlinking /opt/calibre/lrf2lrs to /usr/bin/lrf2lrs
Symlinking /opt/calibre/calibre-customize to /usr/bin/calibre-customize
Symlinking /opt/calibre/ebook-edit to /usr/bin/ebook-edit
Symlinking /opt/calibre/ebook-polish to /usr/bin/ebook-polish
Symlinking /opt/calibre/calibre-smtp to /usr/bin/calibre-smtp
Symlinking /opt/calibre/lrs2lrf to /usr/bin/lrs2lrf
Symlinking /opt/calibre/calibre-parallel to /usr/bin/calibre-parallel
Symlinking /opt/calibre/ebook-device to /usr/bin/ebook-device
Symlinking /opt/calibre/calibre-debug to /usr/bin/calibre-debug
Symlinking /opt/calibre/web2disk to /usr/bin/web2disk
Symlinking /opt/calibre/calibredb to /usr/bin/calibredb
Symlinking /opt/calibre/ebook-viewer to /usr/bin/ebook-viewer
Symlinking /opt/calibre/calibre-server to /usr/bin/calibre-server
Symlinking /opt/calibre/calibre to /usr/bin/calibre
Symlinking /opt/calibre/markdown-calibre to /usr/bin/markdown-calibre
Symlinking /opt/calibre/ebook-convert to /usr/bin/ebook-convert
Setting up command-line completion…
Installing zsh completion to: /usr/share/zsh/vendor-completions/_calibre
Installing bash completion to: /usr/share/bash-completion/completions/
Setting up desktop integration…

____________________ WARNING ____________________
Setting up desktop integration failed with error:
__________________________________________________

Traceback (most recent call last):
File “site-packages/calibre/linux.py”, line 854, in setup_desktop_integration
File “site-packages/calibre/linux.py”, line 839, in install_icons
File “site-packages/calibre/linux.py”, line 833, in install_single_icon
File “subprocess.py”, line 185, in check_call
File “subprocess.py”, line 172, in call
File “subprocess.py”, line 394, in __init__
File “subprocess.py”, line 1047, in _execute_child
OSError: [Errno 2] No such file or directory

Creating un-installer: /usr/bin/calibre-uninstall

There were 1 warnings

* Setting up desktop integration failed with error:

[root@VM-0-15-centos wwwroot]#

换了ubuntu系统,安装提示以下内容,啊愁死我了,怎么办呀,求指教呀

Extracting files to /opt/calibre …
Extracting application files…
Creating symlinks…
Symlinking /opt/calibre/ebook-device to /usr/bin/ebook-device
Symlinking /opt/calibre/ebook-meta to /usr/bin/ebook-meta
Symlinking /opt/calibre/ebook-convert to /usr/bin/ebook-convert
Symlinking /opt/calibre/ebook-polish to /usr/bin/ebook-polish
Symlinking /opt/calibre/markdown-calibre to /usr/bin/markdown-calibre
Symlinking /opt/calibre/web2disk to /usr/bin/web2disk
Symlinking /opt/calibre/calibre-server to /usr/bin/calibre-server
Symlinking /opt/calibre/lrf2lrs to /usr/bin/lrf2lrs
Symlinking /opt/calibre/lrs2lrf to /usr/bin/lrs2lrf
Symlinking /opt/calibre/calibre-debug to /usr/bin/calibre-debug
Symlinking /opt/calibre/calibredb to /usr/bin/calibredb
Symlinking /opt/calibre/calibre-parallel to /usr/bin/calibre-parallel
Symlinking /opt/calibre/calibre-customize to /usr/bin/calibre-customize
Symlinking /opt/calibre/fetch-ebook-metadata to /usr/bin/fetch-ebook-metadata
Symlinking /opt/calibre/calibre-smtp to /usr/bin/calibre-smtp
Symlinking /opt/calibre/calibre to /usr/bin/calibre
Symlinking /opt/calibre/lrfviewer to /usr/bin/lrfviewer
Symlinking /opt/calibre/ebook-viewer to /usr/bin/ebook-viewer
Symlinking /opt/calibre/ebook-edit to /usr/bin/ebook-edit
Setting up command-line completion…
Installing zsh completion to: /usr/share/zsh/vendor-completions/_calibre
Installing bash completion to: /usr/share/bash-completion/completions/
Setting up desktop integration…
xdg-desktop-menu: No writable system menu directory found.

____________________ WARNING ____________________
Setting up desktop integration failed with error:
__________________________________________________

Traceback (most recent call last):
File “calibre/linux.py”, line 853, in setup_desktop_integration
File “calibre/linux.py”, line 875, in do_setup_desktop_integration
File “calibre/linux.py”, line 953, in install_xdg_junk
File “subprocess.py”, line 364, in check_call
subprocess.CalledProcessError: Command ‘xdg-desktop-menu install –noupdate ./calibre-gui.desktop’ returned non-zero exit status 3.
Creating un-installer: /usr/bin/calibre-uninstall

There were 1 warnings

* Setting up desktop integration failed with error:

Run “calibre” to start calibre

还是建议你检查python版本,无论你是什么系统,你都要注意依赖关系。

8条评论

发表评论

Linux基础
如何配置WSL的SSH服务?

1 前言 一个问题,一篇文章,一出故事。 笔者系统使用WSL的SSH服务直接登录Windows系统, …

Linux基础
如何创建TLS/SSL自签名证书?

1 基础知识 1.1 SSL 基础知识请查阅以下章节, 如何熟悉SSL证书的基础知识? 1.2 TL …

Linux基础
如何用Linux命令测端口连通性?

1 前言 一个问题,一篇文章,一出故事。 今天老板提出一个需求,需要证明某个服务的端口联通性正常,于 …