Loading... 转自:https://zhiganglu.com/post/rpi-ebook-library-calibre/ # 安装和设置 Calibre ```shell sudo apt-get install calibre ``` 安装 ```shell sudo apt-get install xvfb sudo apt-get install imagemagick ``` Note that after installing xvfb, the system will boot with gnome manager (GUI). To disable GUI at boot use sudo systemctl set-default multi-user. (To use GUI sudo systemctl set-default graphical) Setup the Calibre library directory and another folder to holder resource books The library path can be under user’s directory (e.g., /home/ubuntu) **setup library path and permission** ```shell cd ~ mkdir calibreLib ``` Setup another folder for uploading books to the library, eg. books downloaded or from external drive ## create a new directory to mount the drive ```shell cd / sudo mkdir /exData #sudo chmod -R 777 /exData sudo chown ubuntu:ubuntu /exData/ sudo chmod ugo+rw /exData/ ``` We can download a book here: ```shell cd /exData wget https://www.gutenberg.org/ebooks/1342.kindle.noimages -O pride.mobi ``` Alternatively, we can mount an external USB drive to this directory check drives ```shell sudo fdisk -l ``` normally external usb is /dev/sda? mount external drive ```shell sudo mount /dev/sda1 /exData ``` ## adding books to calibre library ```shell (xvfb-run) calibredb add /exData/pride.mobi --library-path ~/calibreLib ``` or after mounting the usb ```shell calibredb add /exData/* --library-path ~/calibreLib ``` ## managing the library For the headless server, we need to define –with-library all the time, otherwise there will be an error about “unable to open database file”. **list all books** ```shell calibredb list --with-library ~/calibreLib/ ``` **remove book** ```shell calibredb remove [book id] --with-library ~/calibreLib/ ``` **search** ```shell calibredb search author:unknown title:astro --with-library ~/calibreLib/ ``` run calibre content server ```shell calibre-server ~/calibreLib ``` Now we can go to https://192.168.x.xx:8080/ on any device in the same network to browse and read books. # to start the server automatically on system boot Here is the manual to start the server automatically on system boot First we create a file ```shell sudo nano /etc/systemd/system/calibre-server.service ``` with the following content: ```shell [Unit] Description=calibre content server After=network.target [Service] Type=simple User=pi Group=pi ExecStart=/usr/bin/calibre-server "/home/ubuntu/calibreLib" [Install] WantedBy=multi-user.target Replace ExecStart location accordingly by checking the location of calibre-server ``` **start server** ```shell sudo systemctl start calibre-server ``` **check status** ```shell sudo systemctl status calibre-server ``` 最后修改:2021 年 02 月 08 日 © 允许规范转载 打赏 赞赏作者 如果觉得我的文章对你有用,请随意赞赏