![]() |
#1 |
Junior Member
![]() Posts: 8
Karma: 10
Join Date: Jul 2017
Device: kindle paperwhite
|
installing Calibre content server 3 on ubuntu server 16_04
The following guide is a result of my google search to install calibre 3 on a server running ubuntu:
the environment: a pc running ubuntu server 16_04 lts connected to the internet a sudo users a public ip to reach the server from the internet a port open on linux firewall and router a kindle paperwhite connected to the internet install calibre: Code:
sudo -v && wget -nv -O- https://download.calibre-ebook.com/linux-installer.py | sudo python -c "import sys; main=lambda x:sys.stderr.write('Download failed\n'); exec(sys.stdin.read()); main('/opt')" I used the /opt folder Ignore all the warnings Update your package lists: Code:
sudo apt-get update Code:
sudo apt-get install xvfb create calibre log file: Code:
sudo nano /opt/calibre/calibre.log Let suppose that the linux user is "myuser" create calibre users: I discovered that my calibre user database is in ~/.config/calibre/server-users.sqlite Code:
sudo calibre-server --userdb /home/myuser/.config/calibre/server-users.sqlite --manage-users I created two user: - one with write permissions - one with only read permissions create the calibre.service: Code:
sudo nano /lib/systemd/system/calibre.service [Unit] Description=Calibre Service After=network.target [Service] Type=simple User=mylinuxuser Group=mylinuxgroup ExecStart=/usr/bin/calibre-server\ --daemonize\ --max-opds-items=30\ --max-opds-ungrouped-items=100\ --port YOUR_PORT_NUMBER \ --log=/opt/calibre/calibre.log \ --enable-auth \ /PATH_TO_LIBRARY_1 \ /PATH_TO_LIBRARY_2 \ /PATH_TO_LIBRARY_3 \ /................. \ /PATH_TO_LIBRARY_n [Install] WantedBy=multi-user.target please notice that: - I use a path without spaces and I set an empty space before \ - there is no \ after the last path Check that it is correctly configured by executing Code:
sudo systemctl start calibre.service Code:
sudo systemctl status calibre.service Code:
sudo systemctl enable calibre.service to check that everythings are ok open your browser and navigate to \\your ip:your port insert user and pwd please consider to allow port in ufw and in your router... some tricks: after any changes in file: /lib/systemd/system/calibre.service please run: Code:
sudo systemctl daemon-reload Code:
sudo systemctl start calibre.service Code:
sudo systemctl stop calibre.service sudo systemctl start calibre.service I actually have 3 libraries, I don't know how many you can have... I have a kindle paperwhite so I created a book with a link (I created it in word, converted to AZW3 in Calibre and downloaded in my kindle) : http://caliberuser:calibrepassword@y...ourport/mobile I use the mobile version because kindle browser probably don't support java script or is extremely slow... sources: https://www.digitalocean.com/communi...n-ubuntu-14-04 https://manual.calibre-ebook.com/ser...mand-line-only https://manual.calibre-ebook.com/gen...re-server.html http://thanosk.net/content/running-c...-under-systemd https://manual.calibre-ebook.com/ser...n-linux-system please consider that I'm not a guru and all this stuff is a result of google search and some night lost... I hope this can help many thanks to Kovid and all the calibre guys , peace and love ![]() ![]() khyox Last edited by khyox; 07-13-2017 at 04:24 AM. |
![]() |
![]() |
![]() |
#2 |
creator of calibre
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 44,835
Karma: 26594666
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
|
You dont need to install either xvfb or imagemagick. Those were needed only for very old versions of calibre. You do need to have the X server libraries installed, however. So installing xvfb is probably a good way to do that
![]() You should also change the service file to run the server as a normal linux user rather than root. See the section on systemd integration at https://manual.calibre-ebook.com/server.html |
![]() |
![]() |
Advert | |
|
![]() |
#3 |
Junior Member
![]() Posts: 8
Karma: 10
Join Date: Jul 2017
Device: kindle paperwhite
|
ok I have edited the post
many thanks khyox |
![]() |
![]() |
![]() |
#4 |
Member
![]() Posts: 10
Karma: 10
Join Date: Sep 2013
Location: Australia
Device: Calibre; Galaxy SII
|
I have done the above process, modified for my username, port, etc. The calibre server runs (but only briefly, see below), and I can use a Web browser to access the library.
However, when I try to run calibre itself, I get: Code:
calibre, version 3.6.0 ERROR: Cannot start calibre: Another calibre program that can modify calibre libraries, such as, calibre-server or calibredb is already running. You must first shut it down, before starting the main calibre program. If you are sure no such program is running, try restarting your computer. Now I notice different behaviour... after: Code:
sudo systemctl start calibre-server Code:
sudo systemctl status calibre-server Code:
● calibre-server.service - calibre content server Loaded: loaded (/etc/systemd/system/calibre-server.service; disabled; vendor preset: enabled) Active: deactivating (stop-sigterm) since Sat 2017-08-26 12:18:34 AEST; 7s ago Process: 16588 ExecStart=/usr/bin/calibre-server --daemonize --max-opds-items=30 --max-opds-ungrouped-items=100 --port 8282 --log=/home/bob/.calibre-server-log --enable-auth /home/bob/Calibre Library (code=exited, status=0/SUCCESS) Main PID: 16588 (code=exited, status=0/SUCCESS) CGroup: /system.slice/calibre-server.service └─16596 /opt/calibre/bin/calibre-server --daemonize --max-opds-items=30 --max-opds-ungrouped-items=100 --port 8282 --log=/home/bob/.calibre-server-log --enable-auth /home/bob/Calibre Library Aug 26 12:18:33 bob-mint systemd[1]: Started calibre content server. Code:
● calibre-server.service - calibre content server Loaded: loaded (/etc/systemd/system/calibre-server.service; disabled; vendor preset: enabled) Active: failed (Result: timeout) since Sat 2017-08-26 12:20:04 AEST; 51s ago Process: 16588 ExecStart=/usr/bin/calibre-server --daemonize --max-opds-items=30 --max-opds-ungrouped-items=100 --port 8282 --log=/home/bob/.calibre-server-log --enable-auth /home/bob/Calibre Library (code=exited, status=0/SUCCESS) Main PID: 16588 (code=exited, status=0/SUCCESS) Aug 26 12:18:33 bob-mint systemd[1]: Started calibre content server. Aug 26 12:20:04 bob-mint systemd[1]: calibre-server.service: State 'stop-sigterm' timed out. Killing. Aug 26 12:20:04 bob-mint systemd[1]: calibre-server.service: Unit entered failed state. Aug 26 12:20:04 bob-mint systemd[1]: calibre-server.service: Failed with result 'timeout'. Code:
[Unit] Description=calibre content server After=network.target [Service] Type=simple User=bob Group=bob ExecStart=/usr/bin/calibre-server\ --daemonize\ --max-opds-items=30\ --max-opds-ungrouped-items=100\ --port 8282 \ --log="/home/bob/.calibre-server-log"\ --enable-auth \ "/home/bob/Calibre Library" [Install] WantedBy=multi-user.target What am I missing? |
![]() |
![]() |
![]() |
#5 |
creator of calibre
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 44,835
Karma: 26594666
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
|
You cannot run calibre and the server at the same time with the same user account. You also dont use --daemonize in your service file.
|
![]() |
![]() |
Advert | |
|
![]() |
#6 |
Member
![]() Posts: 10
Karma: 10
Join Date: Sep 2013
Location: Australia
Device: Calibre; Galaxy SII
|
Thanks for the quick reply.
The server now stays active after removing --daemonize. Not sure what you mean by, "You cannot run calibre and the server at the same time with the same user account." Is that the Linux "User" mentioned in calibre.service? Do you mean I have to create another Linux user to run the server, and put that new username into calibre.service file? You say not to use root there. I presume you are not referring to the username in calibre itself at Preferences|Sharing over the net|User accounts? |
![]() |
![]() |
![]() |
#7 | |
Poker of bits and books
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 70
Karma: 12662
Join Date: Sep 2013
Device: Kobo Glo HD, Tolino Shine 2, Tolino Vision 5, Tolino Vision color
|
A few suggestions to further improve the handling:
instead of sudo nano to create the log file: Code:
touch /opt/calibre/calibre.log systemd's systemctl provides the restart command to restart services. Instead of starting/stopping use Code:
systemctl restart <your unit name here> Quote:
"brackhaus" logs in to your system. The content-server is running. "brackhaus" tries to start calibres' GUI, but fails because the content server already runs with "brackhaus" credentials. Use a different user for the server. Last edited by Lofwyr23; 08-27-2017 at 09:53 AM. |
|
![]() |
![]() |
![]() |
#8 |
Member
![]() Posts: 10
Karma: 10
Join Date: Sep 2013
Location: Australia
Device: Calibre; Galaxy SII
|
Getting closer... I've created a new Linux username and modified /etc/systemd/system/calibre-server.service:
Code:
[Unit] Description=calibre content server After=network.target [Service] Type=simple User=calibreserver Group=calibreserver ExecStart=/usr/bin/calibre-server\ --max-opds-items=30\ --max-opds-ungrouped-items=100\ --port 8282 \ --log="/opt/calibre/calibre-server.log"\ --enable-auth \ --userdb="/home/bob/.config/calibre/server-users.sqlite"\ "/home/bob/Calibre Library" [Install] WantedBy=multi-user.target Server log: Code:
calibre server listening on 0.0.0.0:8282 OPDS feeds advertised via BonJour at: 192.168.0.2 port: 8282 When I click on the Web "Calibre Library" button the Web page responds: Code:
Failed to load books from calibre library, with error: Failed to communicate with "/interface-data/books-init?library_id=Calibre_Library&sort=author_sort.asc&1503879907902", with status: [500] Internal Server Error Code:
Unhandled exception in state: State: _job_done Client: 192.168.0.2:46202 Request: GET /interface-data/books-init?library_id=Calibre_Library&sort=author_sort.asc&1503879644611 HTTP/1.1 Traceback (most recent call last): File "site-packages/calibre/srv/loop.py", line 565, in tick File "site-packages/calibre/srv/loop.py", line 303, in _job_done File "site-packages/calibre/srv/pool.py", line 35, in run File "site-packages/calibre/srv/http_response.py", line 441, in run_request_handler File "site-packages/calibre/srv/routes.py", line 300, in dispatch File "site-packages/calibre/srv/auth.py", line 258, in __call__ File "site-packages/calibre/srv/auth.py", line 281, in do_http_auth File "site-packages/calibre/srv/users.py", line 132, in get File "site-packages/calibre/srv/users.py", line 79, in conn CantOpenError: CantOpenError: unable to open database file /home/bob/.config/calibre/server-users.sqlite has permissions 777. Which "database file" can't it open? What now? |
![]() |
![]() |
![]() |
#9 |
creator of calibre
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 44,835
Karma: 26594666
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
|
You misunderstand. You are not supposed to be able to run the calirbe GUI and server on the same library. Either run the server from within the GUI or create a script that stops the server when starting the GUI and restarts it after the GUI quits.
Your error comes from the permission on the userdb file being incorrect. Presumably you created it using the GUI with one linux user and are running the server with another. |
![]() |
![]() |
![]() |
#10 |
Member
![]() Posts: 10
Karma: 10
Join Date: Sep 2013
Location: Australia
Device: Calibre; Galaxy SII
|
I think my confusion comes from the fact that prior to 3.?, I could run the server at system startup, and then run the GUI without problems.
So, to confirm, for a single user with a single library, with the requirement to run the GUI on the machine that stores the library, and to view the library via the Web interface on other devices, is this the process:
The only problem remaining is that when I start calibre at system startup, it is not minimised. I'm using the command, in Linux Mint Startup Programs, Code:
calibre --start-in-tray |
![]() |
![]() |
![]() |
#11 |
creator of calibre
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 44,835
Karma: 26594666
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
|
Yes that is correct.
You need to also enable the system tray icon in Preferences->Look & feel first. Then --start-in-tray will work, assuming your desktop environment has a system tray that supports the status notifier spec (most modern ones do). Last edited by kovidgoyal; 08-28-2017 at 04:28 AM. |
![]() |
![]() |
![]() |
#12 |
Member
![]() Posts: 10
Karma: 10
Join Date: Sep 2013
Location: Australia
Device: Calibre; Galaxy SII
|
Ah, I missed that setting in Preferences. But unfortunately calibre still opens as a window.
|
![]() |
![]() |
![]() |
#13 |
creator of calibre
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 44,835
Karma: 26594666
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
|
Run calibre --start-in-tray in a terminal, and it will print out a message telling you why it could not create a system tray icon.
|
![]() |
![]() |
![]() |
#14 |
Member
![]() Posts: 10
Karma: 10
Join Date: Sep 2013
Location: Australia
Device: Calibre; Galaxy SII
|
Code:
$ calibre --start-in-tray Failed to create system tray icon, your desktop environment probably does not support the StatusNotifier spec |
![]() |
![]() |
![]() |
#15 |
Member
![]() Posts: 10
Karma: 10
Join Date: Sep 2013
Location: Australia
Device: Calibre; Galaxy SII
|
A partial answer... StatusNotifier is not enabled by default in MATE.
Install "dconf-editor", run it to set org>mate>panel>general>enable-sni-support calibre will then run in the background (with "calibre --start-in-tray") but in my case I then get an error popup saying, "Notification Area" has quit unexpectedly. If you reload a panel object, it will automatically be added back to the panel." The network connection/speaker etc. icons are then not showing. If I click "Reload" then they reappear. There is no indication there that calibre is running, but it is actually properly running in the background and works as server. More: https://github.com/mate-desktop/mate-desktop/issues/286 https://github.com/mate-desktop/mate-desktop/issues/288 If would be helpful if others could give their experience with this. |
![]() |
![]() |
![]() |
Tags |
calibre conten server, ubuntu server 16_04 lts |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Content server on ubuntu 12.04 headless server ImageMagick: libltdl.so.7 | Cool Javelin | Calibre | 5 | 04-08-2015 03:20 AM |
Calibre Content Server and Windows Home Server 2011 | HughMcC | Calibre | 8 | 10-01-2014 08:26 AM |
500 Internal Server Error accessing content server Calibre 0.8.8 | DaddyO57 | Calibre | 1 | 07-20-2012 07:08 PM |
Calibre Content Server error in Ubuntu 10.10 | Bodman456 | Calibre | 1 | 07-07-2010 04:26 PM |
Problems installing Version: 0.4.109 on Ubuntu Server 8.10 | machalla | Calibre | 0 | 12-03-2008 10:23 PM |