r/LazyLibrarian • • Nov 18 '20

LazyLibrarian, Calibre, Calibre-Web, Booksonic Installation Guide v1.0

56 Upvotes

Here's a guide to help you install a nice library suite on a Linux system. Not in a Docker. Not on Windows. Linux. Plain old Debian Linux. I know some of you want to run it in Docker, or on a Synology, or on Windows. I know nothing about any of that. Sorry. This is a more or less step by step guide to install.

If you follow this, please read through the whole thing first. There are some things that should come in a certain order to make life easier. I've tried to call out options where they are available and give some reasoning behind my choices.

I do NOT have all of the answers. And my choices are not always correct for me, let alone for you.

Hopefully coming soon will be some short guides for things you'll encounter after the installation (why won't my audiobooks import, why aren't calibre entries being written, etc.) As well as an inevitable edit of this guide once all of the flaws and shortcomings have been located.

To get started, you need a Linux installation. I'm assuming a plain vanilla install of Debian that you've booted into once, updated packages, and rebooted if necessary. Not sure if it matters, but I'm running it in a VM. Currently giving the system 4GB of RAM, 4 processors, and 70 GB of space, NOT counting space for the library. The RAM only rarely comes into play. The processors almost never come into play. At some point, I'll dial them both down by half or more. The disc space looks kinda ridiculous. In retrospect, 20-30 is probably more than enough, but I'm still figuring our the room for metadata.

(For comparison, I have 28GB of eBooks at the moment, as well as 164 GB of audiobooks. (Note to self: look into that. Database reporting in LazyLibrarian says I only have 624 books and 263 audio. That amount of disk space seems a bit much. Difference between du and df is interesting.))

Information and items to have before you start (* is mandatory, O is optional):

  • * -Location of helpers like SABNZB, qbittorrent, etc.

  • * -Intended Directory layout. More on this later

  • * -IP address and hostname of your library server (this should be statically set, or you may have issues later) (for this document, we are assuming 192.168.1.100 and hostname librarian)

  • O -Bot accounts on your favorite IRC servers if you like.

  • O -GoodReads account.

  • O -Kindle email to device address

Distribution Choice

I prefer Debian based distros due to simplicity. Usually I go for Ubuntu (because everyone does, it makes it trivial to specific directions). For my library, I went with vanilla Debian. There are some changes in how Ubuntu handles certificates that aren't well documented and that I didn't feel like figuring out. This guide will be based on Debian Buster.

I haven't gotten around yet to playing with Docker. Sometime in the next year, I hope to do that. If you need Docker help, gotta ask someone besides me. This is a guide to putting a library on (virtual) metal.

Required additional packages

  • git (For installing/updating.)

  • xvfb (Required to do a few things with calibre. Most importantly, this is required if you didn't install a gui on your system)

  • python3-pip (Not every python package is prepackaged.)

  • libnss, python3-openssl, python3-oauth (Agh, lost my notes as to why we need this.)

Optional packages

  • openssh-server (unless you are logging in locally or solely through VNC, which I don't recommend.)

  • cifs-utils (if you are using a Samba/SMB share. No, it's not recommended, we're doing it anyway.)

  • imagemagick, ghostscript, python3-pythonmagick, python3-wand (for generating covers and the like)

  • rename (helps manipulate filenames, because ebook and audiobook naming is awful)

  • id3v2 and id3tool (helps manipulate id3 tags because ebook and audiobook tagging is awful. Supposedly id3 v1 is sufficient, but you really need the v2 tool. If you are a super miser on space, skip id3tool)

  • unzip (another file/metadata helper)

Audiobook related packages

  • ffmpeg

To grab all of these:

apt install git xvfb python3-pip libnss python3-openssl python3-oauth openssh-server cifs-utils imagemagick rename id3v2 id3tool unzip ffmpeg

User creation

You need to set up a user just to run the services. On this setup and for this guide, our user is 'librarian'. I shouldn't have, but did set it up as a normal user, but with a couple of adjustments.

adduser librarian --system --group

Your screen should give you something like this:

Adding system user `librarian' (UID 109) ...
Adding new group `librarian' (GID 116) ...
Adding new user `librarian' (UID 109) with group `librarian' ...

Take note of the UID and GID numbers. We'll come back to that later.

Directory setup

You will need several directories to exist before you begin the installations.

/home/librarian should already exist. If not, make sure you have a 'librarian' user and group. Then create the directory and assign ownership to your librarian user:

mkdir /home/librarian

chown -R librarian:librarian /home/librarian

If you don't have the user/group, try creating them again.

Most of the server stuff I want in /srv. If it doesn't exist, /opt is another choice. And back in the day, /usr/local did the trick. This guide uses /srv.

Almost all of my data lies on network mounts. In my case, I use samba/SMB. Unfortunately, calibre does not deal with this very well due to samba/SMB not handling file locks well. So far it's mostly ok if you follow my steps and mounting options. The 'not mostly' part is that every so often you may need to reboot the system.

Filesystems are automounted. You'll have to edit your /etc/fstab file. This is a typical line for my mounts:

//fileserver/ebooks /mnt/ebooks cifs      uid=109,gid=116,credentials=/root/creds,vers=2.1,auto,x-systemd.automount,_netdev,mfsymlinks,nobrl   0       0

Fileserver is the smb name for the fileserver where the data resides.

/ebooks is the name of the share.

/mnt/ebooks is the location that our librarian system goes to in order to find those files.

cifs merely specifies the kind of fileshare we are using

uid and gid must match the numbers from your 'librarian' user and group. This will make that user and group own the mount and be able to do just about anything with the files.

credentials=/root/creds specifies the location of your smb username and password. You could put the info here, but this provides a little extra security. The /root/creds file should look like this:

Username=BigBadLibrarian
Password=s00p3rsekr1+

Or whatever your credentials are.

vers=2.1 may be unneccessary or may need changing depending on your client and server to get the compatibility right.

The next two sections make the mount happen automatically at startup, after the network comes up.

The last two sections "mfsymlinks,nobrl" are two options that minimize the locking problem earlier. It's not perfect, but it's the best that can be done.

What directories do you need?

  • /mnt/ebooks/ebooks is where we will put our ebooks (naturally)

  • /mnt/ebooks/audiobooks is for audiobooks

  • /mnt/ebooks/comics is for comics (which are beyond the scope of this document)

  • /mnt/downloads is where our torrent and nzb downloader will place completed downloads. I strongly suggest you place them all here. You can separate them if you wish, but at some point, it's not worth the extra effort of defining things out too finely.

  • /mnt/manual_import is where we will place files that we want to bring in manually. Suppose you copy some files from your ereader or a thumb drive. You drop them into this folder. (In my case, the data is on the file server. I mount it as drive N: on my desktop and as /mnt/manual_import on my librarian. Drop it on the desktop, it appears on the server.)

  • /home/librarian/logs is where we will keep our logs. This isn't the best location (should be /var/log/librarian or similar) but this will do for now.

  • /home/librarian/.config/calibre/ is where we will keep some configuration bits, including the user database.

Install calibre-server

Long story short: follow the directions here: https://calibre-ebook.com/download_linux

More info:

A stock install should have the correct tools and dependencies already installed.

Run this on the command line: "sudo -v && wget -nv -O- https://download.calibre-ebook.com/linux-installer.sh | sudo sh /dev/stdin"

This will fetch the calibre installer and run it, placing items in stock locations (/opt/calibre). This is perfectly acceptable.

Now we need a sample file to use to force calibre to create its database. This command will grab the freely available "Hearts of Darkness" from Project Gutenberg. Feel free to grab whatever you like:

sudo wget http://www.gutenberg.org/ebooks/219.epub.noimages -O heart.epub

Take note of where the file 'heart.pub' is located. I will assume it is in /mnt/manual_import. Whatever directory you choose, life is simpler if you have only one sample epub in there. Next, issue the following command:

sudo xvfb-run calibredb add /mnt/manual_import/* --library-path /mnt/ebooks/ebooks

Change the two directories that start with "/mnt" to your location of heart.epub that you just downloaded and the location where you want your calibre database.

Calibre will run just enough to create a database. The computer should take a few seconds and then come back with "Added book ids: 1". If you look in your library folder, there should be a folder labelled 'Joseph Conrad' (or the author of the book you downloaded) as well as a file named metadata.db.

So now we have our basic database. Some people are leaving us now, as that's a key sticking point. Next step is to verify that the server works. Enter the following command: "sudo calibre-server --port=8180 --enable-local-write /mnt/ebooks/ebooks" Then open up a browser and go to "http://192.168.1.100:8180". You should be able to 'browse' around a bit, seeing your massive one author and single book. That's enough. Go back to the screen where you last were at the command prompt, and press control-c to end the task.

We are going to have some logging in our install. Create the log file and set permissions with these commands: "sudo touch /home/librarian/logs/calibre.log && sudo chown -R librarian:librarian /home/librarian/logs/calibre.log"

We will have separate users for our install. It's not strictly necessary now, but might be down the road.

Create the user database and enter your first user by entering this: "sudo calibre-server --userdb /home/librarian/.config/calibre/server-users.sqlite --manage-users"

Create a library user. We assume username "librarian" and password "password" for this example. Don't type the quotation marks. In addition, give this user rights to all libraries in case you added another. Add another user if you like and provide credentials as well as what library you want that user to have access to.

Next we will need a service file to get calibre-server running at every boot. Using your favorite text editor, edit /etc/systemd/system/calibre-server.service.

Mine looks like this (lines that are comments start with an octothorpe '#'. You can leave them or delete the entire line):

[Unit]
Description=calibre content server
#this can be anything you want
After=remote-fs.target
#this prevents calibre from starting until after network shares are mounted. If you are storing everything locally, change remote to local


[Service]
Type=simple
User=librarian
Group=librarian
#previous two lines should reflect the name of the user and group you set above
ExecStart=/usr/bin/calibre-server \
#this should be your calibre executable. You can display it by typing "which calibre-server" at the command prompt.
        /mnt/ebooks/ebooks/ \
#your library location
        --enable-auth \
#if you set up authentication as we did. If you REALLY don't want it, delete previous line or comment it out
        --userdb="/home/librarian/.config/calibre/server-users.sqlite" \
#location of the database we set above
        --log="/home/librarian/logs/calibre.log" \
#location of the log file we set above
        --max-log-size=2
#maximum size of the log in megabytes
		
Restart=on-failure
#If it crashes or has certain problems, it will try to restart
RestartSec=30
#Tunes restarting of the service

[Install]
WantedBy=multi-user.target
#We only want this if we are running services. Not in a single user mode for system. Even if you are the only user, it has nothing to do with this line. Don't touch unless you know what you're doing.

Reload your services configuration with "systemctl daemon-reload" and attempt to start the server with "systemctl start calibre-server"

Wait 10-30 seconds (it take a bit to get going) and investigate with "systemctl status calibre-server" or "ps ax | grep calibre" or both. The systemctl method is preferred. The beginning of roughly the third line of output should look like:

Active: active (running) 

Stop the service with "systemctl stop calibre-server". Check status. It should no longer say 'Running'. Start the service again. Wait a minute or two. At least as much time as it takes to type the next two commands. Check status. At the end of roughly the third line, there should be a time. It should display a time roughly equal to the last time you issued the command with start. A minute or two.

Now restart the service with "systemctl restart calibre-server" and after no more than about five seconds, issue the status command. The time at the end should be roughly five seconds. If it still says a minute or more, wait 10 seconds and try again. If it still shows an odd time, try the stop command, see if it stops, like it did before. Something isn't right.

And now to make it start on every boot, use the command "systemctl enable calibre-server". You can reboot, wait a minute or so, and then issue the status command to see if it started up ok. (I know there's an easier way than a reboot, but I rarely use it with VMs, so I'm not looking it up now.)

You can go read your copy of Hearts of Darkness (a solid book, btw), take a rest, or forge on.

Install calibre-web (optional but recommended)

This is completely optional but oh so desireable. As good as what calibre does, the author is not as good at UX as he is at other things. The marketplace of ideas stepped in and provided us with calibre-web. It is simply a different front end to calibre. If you like the basic server, you can skip this section.

Download a copy of the software. Currently located at https://github.com/janeczku/calibre-web/archive/master.zip. easiest way is to change to the /srv/ directory and type "wget https://github.com/janeczku/calibre-web/archive/master.zip" and hit enter. Then 'unzip master.zip'. There is now a directory named "calibre-web-master". Change it to "calibre-web" with "mv calibre-web-master calibre-web". Then assign ownership of this folder to your librarian with "chown -R librarian:librarian calibre-web"

Change into that directory. At this point you can largely follow the instructions here, beginning at step 3: https://github.com/janeczku/calibre-web/wiki/How-To:Install-Calibre-web-(-Python3-)-in-Linux-Mint-20---Linux-Mint-19.

  1. 1Install requirements with "sudo python3 -m pip install --system --target vendor -r requirements.txt"

  2. Run calibre-web with "sudo -u librarian python3 /srv/calibre-web/cps.py"

  3. Leave it running and do not close the terminal.

  4. Go to "http://192.168.1.100:8083" in your browser. You login username is admin and password is admin123

After logging in, you'll be presented with a wizard to help you setup your server. A screenshot of some of that is here: https://github.com/janeczku/calibre-web/wiki

At this point you can setup the startup script or you can keep setting up calibre-web. The startup script will be used even if you have to wipe this out and reinstall what you have so far. OTOH, you won't have to bother with the startup script if you decide you hate the interface and don't want it.

Walk through the setup wizard, filling in as much information as you can. If you collected the right information regarding paths and filenames you should have it all above.

A few suggestions:

  1. Assign at least one other admin user in case you forget the password after changing it from 'admin123'.

  2. Decide which software is going to take 'lead' for importing books, especially manual imports. I chose LazyLibrarian because it pings calibre which backfills calibre-web. The other options would require more manual intervention from time to time. Not to say that this is free of it. Oh no, the metadata is too bad for that to be possible.

  3. If you have a Kindle, set up email to Kindle. You'll need to look up the address on Amazon's site. You'll need an email sender. (I use Google, which will require you to setup an application password. Searching "gmail application specific password" should get you to directions for that.

You should once again have access to your one beautiful copyright free eBook, Hearts of Darkness, by Joseph Conrad.

Next we will need a service file to get calibre-web running at every boot. Using your favorite text editor, edit /etc/systemd/system/calibre-web.service.

Mine looks like this (lines that are comments start with an octothorpe '#'. You can leave them or delete the entire line):

[Unit]
Description=Calibre-Web
#any descriptive name you like
After=remote-fs.target
#this prevents calibre from starting until after network shares are mounted. If you are storing everything locally, change remote to local 

[Service]
Type=simple
User=librarian
Group=librarian
#previous two lines should reflect the name of the user and group you set above
ExecStart=/usr/bin/python3 /srv/calibre-web/cps.py
#determine the 'python' part by typing "which python3" at the command line. The cps.py part will be in the directory where everything is installed for calibre-web
WorkingDirectory=/srv/calibre-web/
#can be changed to /home/librarian/calibre-web after creating the directory, but specifying this one makes installation and cleanup very tidy.

[Install]
WantedBy=multi-user.target
#We only want this if we are running services. Not in a single user mode for system. Even if you are the only user, it has nothing to do with this line. Don't touch unless you know what you're doing.

One other item of note. If you are keeping calibre-web, you should change your /etc/systemd/system/calibre-server.service file. The line saying "After" should be edited to read "After=calibre-web.service remote-fs.target" for network shares or "After=calibre-web.service local-fs.target" for local data. This makes sure that calibre-web starts firsts, calibre-server second. If it happens the other way around, calibre-web will not be able to access the database.

Reload your services configuration with "systemctl daemon-reload" and attempt to start the server with "systemctl start calibre-web"

Wait 10-30 seconds (it take a bit to get going) and investigate with "systemctl status calibre-web" or "ps ax | grep calibre-web" or both. The systemctl method is preferred. The beginning of roughly the third line of output should look like "Active: active (running)".

Stop the service with "systemctl stop calibre-web". Check status. It should no longer say 'Running'. Start the service again. Wait a minute or two. At least as much time as it takes to type the next two commands. Check status. At the end of roughly the third line, there should be a time. It should display a time roughly equal to the last time you issued the command with start. A minute or two.

Now restart the service with "systemctl restart calibre-web" and after no more than about five seconds, issue the status command. The time at the end should be roughly five seconds. If it still says a minute or more, wait 10 seconds and try again. If it still shows an odd time, try the stop command, see if it stops, like it did before. Something isn't right.

And now to make it start on every boot, use the command "systemctl enable calibre-web". You can reboot, wait a minute or so, and then issue the status command to see if it started up ok. (I know there's an easier way than a reboot, but I rarely use it with VMs, so I'm not looking it up now.)

Again, if you prefer the other interface, this one is optional. You can 'uninstall' it at this point by deleting /srv/calibre-web/ and going on about your life.

You can go read your copy of Hearts of Darkness (a solid book, btw), take a rest, or forge on.

Install lazylibrarian

Switch to /srv or wherever you want your installation executables and configs to go. Get the current source by entering the command: "git clone https://gitlab.com/LazyLibrarian/LazyLibrarian.git". This should create a directory named LazyLibrarian in the /srv directory. Start the program by running "python LazyLibrarian.py -d". If it crashes or provides errors, you probably are missing some required libraries. Double check the list above.

Cancel the program with control-c. Set ownership of the directory with "chown -R librarian:librarian /srv/LazyLibrarian". Start the program again, this time by running "sudo -u librarian python LazyLibrarian.py -d". Open a browser window and go to http://192.168.1.100:5299. Cancel the program with control-c. If you saw something, we need to make it start up automatically. If it didn't start or you have errors, now is the time to fix them.

We will need a service file to get lazylibrarian running at every boot. Using your favorite text editor, edit /etc/systemd/system/lazylibrarian.service.

Mine looks like this (lines that are comments start with an octothorpe '#'. You can leave them or delete the entire line):

[Unit]
Description=LazyLibrarian
After=network.target

[Service]
ExecStart=/usr/bin/python3 /srv/LazyLibrarian/LazyLibrarian.py
Type=simple
User=librarian
Group=librarian
Restart=on-failure

[Install]
WantedBy=multi-user.target

Reload your services configuration with "systemctl daemon-reload" and attempt to start the server with "systemctl start lazylibrarian"

Wait 10-30 seconds (it take a bit to get going) and investigate with "systemctl status lazylibrarian" or "ps ax | grep lazylibrarian" or both. The systemctl method is preferred. The beginning of roughly the third line of output should look like "Active: active (running)".

Stop the service with "systemctl stop lazylibrarian". Check status. It should no longer say 'Running'. Start the service again. Wait a minute or two. At least as much time as it takes to type the next two commands. Check status. At the end of roughly the third line, there should be a time. It should display a time roughly equal to the last time you issued the command with start. A minute or two.

Now restart the service with "systemctl restart lazylibrarian" and after no more than about five seconds, issue the status command. The time at the end should be roughly five seconds. If it still says a minute or more, wait 10 seconds and try again. If it still shows an odd time, try the stop command, see if it stops, like it did before. Something isn't right.

And now to make it start on every boot, use the command "systemctl enable lazylibrarian". You can reboot, wait a minute or so, and then issue the status command to see if it started up ok. (I know there's an easier way than a reboot, but I rarely use it with VMs, so I'm not looking it up now.)

Now it's time to configure LazyLibrarian.

Between each tab and subtab on the setup, hit save. It's easy to get lost and forget what you've done, so save often. All that will happen is some errors will get thrown because we won't really have this configured enough to work until 75% done. Similarly, if there's a 'test' button near data you enter, try it. If it throws an error at this stage, it almost certainly won't work for real. Better to fix now than hunt bugs later.

Switch to the config tab in the browser. It's the one with the gear icon. The first subtab is interface. Server details should be blank. Under logs, enter a location for a log file. "/srv/LazyLibrarian/Logs" works well if not already selected. Screenlog should be 500, files set to 10. 99% of people use the bootstrap skin (madeup statistic, but most screenshots online use it.) In the bottom right, untick magazines and comics if you aren't using those features. I'll discuss only ebooks and audiobooks. Most of these settings are personal preference. Set the proxy if your system needs one to reach the internet.

The next subtab is 'Importing'. First column, 'Information Sources'. Easiest source is a GoodReads API key. Go to that site, set it up, and copy the key. (If you don't have one, go to this link https://www.goodreads.com/api/keys provide the required information only, and it will provide the key). Do not enable 'GoodReads Sync' at this time. It's going to require reading and planning. I don't use it because I don't care if GoodReads tracks what I've read. I do care about getting want lists out of GoodReads and we'll do that elsewhere.)

Next is file formats. For each of the three boxes, enter a comma separated list of the file formats you want for a given category. "epub, mobi, pdf" is good for ebooks. The converters and process is most mature. I haven't gotten anything else to work. Maybe some day. Audiobooks works with mp3. I'm trying m4b, but haven't completed my testing with my stack. For now, stick with mp3. Magazines I have no opinion on except that pdfs are common. All of the checkboxes below should be blank for now. After your testing and you are satsified, I suggest adding the checkmarks for the two blacklist options. It will cut down on reloading the same bad files over and over.

Finally, language. Set this for your country. I'm an American English speaker, so I use "en, eng, en-US, en-GB, Unknown". You may not want Unknown unless you are having trouble getting books that should be available in your selected languages. The date display options are personal preference. "$m-$d-$Y" would be typical American date nomenclature. "$Y-$m-$d" probably more popular among Europeans.

Next tab is Downloaders. In this, I'm using SABnzbd+ and qBitTorrent.

For SABnzbd+, setup is straightforward. Enter your SABnzbd+ host's location and port. Credentials for the SABnzbd+ server (not your Usenet provider) and the api key. The API key can be found by clicking the gear icon in SABnzbd+ and then the 'General' tab. Get the api key, not the NZB key. SABnzbd+ should be setup with categories. ebooks should have their own category with a particular location for completed downloads. I have this setup, and the category is 'ebooks' which you enter here. 'Delete from sabnzbd history' is the only ticked box in this column.

For qBitTorrent, setup is pretty similar. Enter your qBitTorrent host's location and port. Enter credentials if needed. Provide category name. The download directory is where the torrent client saves files, but as seen by the lazylibrarian host. If you followed along, this should be '/mnt/downloads'. 'Use Torrent Blackhole' is the only UNticked box in this column.

Providers is the next tab. The content will depend on where you are looking for ebooks.

Priority doesn't have to be set. Use it to favor some providers (they have higher quality books for example) and disfavor others. A provider with a higher score/rating will be used over a lower scored one if the search results are scored at the same value.

Newznab generally provides Usenet searches. Your provider can provide the URL and the key.

Torznab is a way to interface to various torrent search engines using Jackett. Setting that up is beyond the scope of this document. If you've set it up, you should know how to get the data that LazyLibrarian needs here.

RSS/Wishlist feeds are, honestly, an odd little beast. They perform two functions. One is to periodically update a list of torrents available from certain trackers. If you know you need this, enter the rss feed for the url here. Of more interest is the ability to use these as sources for wanted books. If the rss feed is from GoodReads, Amazon, New York Times or Listopia, it will grab that list of books, begin searching, and then download them. I use this for my GoodReads want sync. Find/create a bookshelf on GoodReads. Populate that shelf. Then click on the shelf to show the list. At the bottom of the page, there is a small link labelled 'RSS'. Copy that link. It will be something like: "https://www.goodreads.com/review/list_rss/ANIDENTIFIER?key=AWHOLEBUNCHOFSTUFFTHATCOULDBEUSEDTOIDENTIFYME&shelf=to-read" except the all caps parts will be some identifying code. Paste that link into the RSS URL field in LazyLibrarian. Now, shortly after you add an item to this list in GoodReads, LazyLibrarian will notice and look for the book.

Torrent providers are built in torrent searches. These aren't all always working and or available. Use as needed.

IRC is probably the easiest provider to configure. Most of the time. 'Name' is a simple description. 'Server' is the server hostname, such as 'irc.irchighway.net' or 'irc.undernet.org'. Channel is just that: the name of the channel, including the octothorpe, such as '#ebooks'. The botnick and botpass are fields for servers where you can reserve a bot name. You'll have to look at your irc server and see if this is the case. If so, register the name and password, and enter the credentials here. This isn't universally allowed.

At the bottom of the page is a button marked 'Blocked Providers' There probably are not any right now. As you use LazyLibrarian, if the software encounters issues with a provider, it uses the list here to throttle that connection. If you've fixed something that is paused/throttled/blocked, just come here, open the list, and turn it off. It automatically turns back on if needed.

Install booksonic (optional. Recommended for audiobooks)

Booksonic is a fork of airsonic and runs under java. It serves audiobooks. If not interested, skip it. There are a couple of dependencies, a java runtime and ffmpeg. If installing from scratch, the following command will install them: 'apt install openjdk-8-jre ffmpeg'. There have been a few changes to the development of booksonic since inception. At the time of this writing, download links can be found at: https://booksonic.org/download.

Switch to /srv or wherever you want your installation executables and configs to go. Create a directory named 'booksonic'. Set ownership of the directory with "chown -R librarian:librarian /srv/booksonic". Change into that directory. Download the .war file from the link above. Do not get the 'legacy' link. At the time of this writing, the command to do that is "wget https://github.com/popeen/Booksonic-Air/releases/download/v2009.1.0/booksonic.war" You can quickly test your install by running " java -jar booksonic.war -Dserver.port=4040" and visiting "http://192.168.1.100:4040". If it crashes or provides errors, you probably are missing some required libraries. Double check the list above. If everything looks ok, cancel the program with control-c. delete everything in the /srv/booksonic direct except the .war file. If you accidentally deleted everything, just download a new copy.

Next we will need a service file to get calibre-web running at every boot. Using your favorite text editor, edit /etc/systemd/system/booksonic.service.

Mine looks like this (lines that are comments start with an octothorpe '#'. You can leave them or delete the entire line):

[Unit]
Description=Booksonic service

[Service]
WorkingDirectory=/srv/booksonic
ExecStart=/usr/bin/java -jar /srv/booksonic/booksonic.war
#There are a multitude of options here for setting memory usage, ports, etc. Using #this, the url you will visit is http://192.168.1.100:8080.
User=librarian
Group=librarian
Type=simple
Restart=on-failure
RestartSec=10

[Install]
WantedBy=multi-user.target

Reload your services configuration with "systemctl daemon-reload" and attempt to start the server with "systemctl start booksonic"

Wait 10-30 seconds (it take a bit to get going) and investigate with "systemctl status booksonic" or "ps ax | grep booksonic" or both. The systemctl method is preferred. The beginning of roughly the third line of output should look like "Active: active (running)".

Stop the service with "systemctl stop booksonic". Check status. It should no longer say 'Running'. Start the service again. Wait a minute or two. At least as much time as it takes to type the next two commands. Check status. At the end of roughly the third line, there should be a time. It should display a time roughly equal to the last time you issued the command with start. A minute or two.

Now restart the service with "systemctl restart booksonic" and after no more than about five seconds, issue the status command. The time at the end should be roughly five seconds. If it still says a minute or more, wait 10 seconds and try again. If it still shows an odd time, try the stop command, see if it stops, like it did before. Something isn't right.

And now to make it start on every boot, use the command "systemctl enable booksonic". You can reboot, wait a minute or so, and then issue the status command to see if it started up ok. (I know there's an easier way than a reboot, but I rarely use it with VMs, so I'm not looking it up now.)

Conclusion

Now you should have a working install of calibre, calibre-web, lazylibrarian, and booksonic. Go into booksonic, add an author, and add a book. I've found searching for a book using ISBN is the fastest. When you add that book, if the net gods are smiling on you, your system will locate them, download them, and transfer them to calibre. If you chose an audiobook, the same thing should happen except that your book will be available in booksonic.

You will have to determine the legalities moralities of any of this for yourself and your country.

One problem you will encounter is horrible file naming and metadata. Everyone has their own idea about what cataloguing is best, and the files you download may not work well with the programs we've installed. Honestly, their authors have done fantastic work dealing with a very tricky problem. If you find value in this guide and there is interest, I will try to write some shorter guides about how to deal with metadata and other common problem areas encountered with this tool stack.


r/LazyLibrarian • • Nov 04 '22

was b-ok taken down?

40 Upvotes

Or is it a temporary glitch? If it's down, does anyone know about an alternative? Thanks


r/LazyLibrarian • • May 16 '20

LazyLibrarian frontend rewrite to be similar to Lidarr/Sonarr/Radarr?

25 Upvotes

Hey,

As the title suggests, I would like to undertake a project to convert the LL frontend to something more intuitive. When I started using LL for the first time, everything seemed new and difficult to understand, specifically for someone coming from the ()arr world. I see that it has been improved significantly since then with documentation explaining what to do. However, I do think it could do with some improvements (no disrespect to any devs working on the project). I think the Lidarr frontend would suit the LL world, specifically modifying the books such that you can look at it per author, eliminating series all together and having magazines/comics in a different section.

I am a software developer and have some experience using React and Python. With some guidance I should be able to come up with a proof-of-concept in a week. Just posted here to gain some insight into whether people here would be interested in something like this.


r/LazyLibrarian • • May 13 '23

Compare LazyLibrarian vs. Readarr for me

18 Upvotes

I started using Readarr about a month a go and just found out about LazyLibrarian bu unsure about its strengths and weaknesses.

Looking for someone willing to compare these two for me in a simple way.

Thanks!


r/LazyLibrarian • • Dec 24 '22

Are there any non-onion b-ok.cc alternatives?

18 Upvotes

r/LazyLibrarian • • Aug 18 '20

Beginners Guide to using LL

12 Upvotes

Hey Team,

I'm a newbie with LL and I was hoping someone could point me to a blog or video that breaks down

  • how to setup LL

  • how to run a search

  • etc


r/LazyLibrarian • • Jul 31 '21

How to add b-ok.cc account (to bypass 5 downloads limitation)

11 Upvotes

Hello,

Is there any way to add your personal b-ok.cc account if you decided to make a donation ?

And if it is not possible yet, would you maybe consider adding in the direct download config page the possibility to add user/password ?

Thanks for your feedbacj


r/LazyLibrarian • • Aug 25 '25

Can someone point me at a "LazyLibrarian for Dummies" guide and/or help me with basic initial set up and configuration?

10 Upvotes

I'm new to *arr, am trying to set up LazyLibrarian as a starting point. Many of the guides and documentation that I've seen seems to assume preexisting knowledge or understanding, so I've struggled to get off the ground.

I'm using TrueNAS (SCALE / Community Edition) 25.04. I installed LazyLibrarian via the App catalog with the default settings. I can switch to raw Docker if need be.

I tried to follow some guides for setting up some initial configuration:

Some issues I've encountered:

  1. I cannot seem to register for a "developer key" on GoodReads. This appears to be discontinued / no longer supported by GoodReads. (This was a step noted in one of the guides.)

  2. I'm not able to see any books listed in the LazyLibrarian web UI. My understanding was that LazyLibrarian UI would provide a way to search for books (leveraging sources like GoodReads) and mark them within as "wanted". I don't see any books / audiobooks in the UI, and when searching I always get 0 results. This is the only error I see in the logs.

2025-08-25 07:21:16.023565+00:002025-08-25 00:21:16,023 ERROR: FileNotFoundError finding gr results: [Errno 2] No such file or directory: '/config/cache/XMLCache/8/9/89fecd9b06d66507cb6026505aaa4fe7.xml' [gr.py:71 (GR-RESULTS)]

I feel like I'm missing something basic and am doing something wrong, and hence not seeing any books show up in the UI. Any help would be much appreciated, especially if anyone has gotten LazyLibrarian to work through the TrueNAS App catalog. Any general TLDR explanation of key steps when setting up LazyLibrarian would be much appreciated. Like are there any key prerequisites for setting up LazyLibrarian? I saw one guide that mentioned setting up Jackett was a prereq.


r/LazyLibrarian • • May 07 '21

Goodreads alternative?

9 Upvotes

Apparently the goodreads api isn't going to be supported anymore (or isn't supported anymore because I can get it to work). Is there anything else I can use? I'm not sure how to get a Google api either.


r/LazyLibrarian • • Jan 01 '21

Beginner guide please

9 Upvotes

I am completely at lost on how to use this install and setup LazyLibrarian for Windows as there seems to be no support whatsoever by the developers or the community to make it understable. Has anyone done a step by step comprehensive guide so that I can refer to it?


r/LazyLibrarian • • Sep 15 '17

If any of you guys ever fork sonarr for books, please call it binocularr

9 Upvotes

... also please fork sonarr for books :)


r/LazyLibrarian • • Nov 24 '25

LL Hates Bill Gates

8 Upvotes

So... Choosing beggers, and all that irony ya ya, i get it.

Who runs the https://lazylibrarian.gitlab.io/install/#tutorials

Can we add some directions for windows, or is this only a linux journey? I say that in jest, I understand it might be able to run on windows.

I am going to be honest, I don't want help right now, trying to find out how to get my geriatric ass to understand the given resources has been frustrating.

If the people devoting their hard time to a free project want it to be successful, at least an ikea level windows guide would be helpful.

A sarcastic reply of why don't you create one would be golden...


r/LazyLibrarian • • Sep 13 '22

How do I get a personal goodreads API to sync with goodreads since API keys are retired?

8 Upvotes

Is there a way around this?


r/LazyLibrarian • • Feb 10 '21

LL Docker errors

8 Upvotes

I had a whole thing written about my issue and while testing things to add, i discovered something altogether different.

So I am trying to set up a docker container for lazylibrarian. i am using portainer and i have tried both the thraxis and the linuxserver images.

If I use the thraxis image and do NOT update, it appears that everything works fine. However, if I update (current image is 685 commits behind) then LL breaks. I get two sets of errors. the first shows up when trying to save changes to the config:

Traceback (most recent call last):
  File "/app/lazylibrarian/cherrypy/_cprequest.py", line 670, in respond
    response.body = self.handler()
  File "/app/lazylibrarian/cherrypy/lib/encoding.py", line 217, in __call__
    self.body = self.oldhandler(*args, **kwargs)
  File "/app/lazylibrarian/cherrypy/_cpdispatch.py", line 61, in __call__
    return self.callable(*self.args, **self.kwargs)
  File "/app/lazylibrarian/lazylibrarian/webServe.py", line 1701, in configUpdate
    lazylibrarian.config_write()
  File "/app/lazylibrarian/lazylibrarian/__init__.py", line 1553, in config_write
    myDB.close()
NameError: global name 'myDB' is not defined

when trying to search for an author or title:

UnboundLocalError: local variable 'but_class2' referenced before assignment

there's a lot more but I think that's the gist of the issue.

Again, both of these worked prior to updating.

With the linuxserver version, it tells me I am 3 commits behind, it doesn't update and it gives those errors from the start.

Edit: the discovery referenced in the first sentence was the fact that the thraxis image worked prior to updating.


r/LazyLibrarian • • Feb 01 '21

Trying to understanding all the players in an LL, calibredb, calibre-web, calibre-desktop (windows) environment

8 Upvotes

I've been trying to research and read about LL, calibredb, calibre-web, and calibre desktop client. What should I be using the various apps for and for what? Is it possible to have LL download content, import it into calibre (calibredb), have the content viewable, searchable online (calibre-web), but still connect to the library to convert, share, update metadata (Calibre desktop client - Windows)?

I currently have a pretty big ebook library 150K+ titles. It is currently hosted on a Windows Server NAS. I've been using the UI of Calibre Windows install for managing, converting, upgrading metadata, collections, etc. I currently leave Calibre desktop app running 24/7. Calibre desktop app has a built-in web server that I use to access my library online while on my network. I also use Calibre-Companion on my android devices while I'm outside my network to connect to my calibre-library and download titles.

I'm using LL in a docker container (ubuntu1804 environment) to download to a CIFS share that Calibre Desktop is set to auto-add from. I'm getting duplicates of stuff re-downloading or not being moved into calibre. So I probably have something misconfigured. I've turned off the docker container (linuxserver/LazyLibrarian) and am going back to the drawing board to learn some more.

Hopefully you guys can point me in the right direction.


r/LazyLibrarian • • Dec 05 '20

LL + Calibre

8 Upvotes

Has anyone got a working setup? I see all these reddit threads about it not working and I can't get it to work either. I have LL putting imported books into /mnt/local/books, but nothing works after that step. I'm using thraxis/lazylibrarian-calibre.

I was looking at some posts thraxis made and trying to replicate their setup. I have Calibre on a local machine with a network drive to /mnt/local/books. Calibre library is located at /mnt/local/books.

When I add new books, it doesn't show in Calibre. I think it's something with permissions and LL not being able to successfully update calibredb or calibredb not being able to read stuff LL has touched - but I have no idea.

If it's working for you - can you post a screenshot of your LL processing settings?

In Calibre, do you use automatic adding? What folder do you point it to?

EDIT: Okay, so now I'm running two instances of calibre. I'm running linuxserver/calibre on the server with the library at /mnt/local/books and running normal calibre on my location machine with the library also at /mnt/local/books. When I download a book through LL, it updates the server calibre but not the local calibre.

  1. What's the issue? How do I make it so the local calibre updates?

  2. If the local calibre can't update (even though thraxis makes it seem like that's what it's intended for), then how can I "plug in" my kindle to the server and sync with send to device? I CAN'T email.


r/LazyLibrarian • • Aug 19 '20

Best LL providers

8 Upvotes

I've been using Libgen, Z-library, NZBGeek and a few public trackers but quite a few non-fiction books aren't found.

Any suggestions for what trackers, proivders, etc to use? A lot of the recommendations on reddit are direct download sites which I don't think will work with LL.

Thanks


r/LazyLibrarian • • Sep 11 '19

Is there anything other than Calibre?

8 Upvotes

Looking for a way to host my ebooks so that I can grab them from home and put them on my phone or tablet as needed.

I find Calibre to be SO VERY CLUNKY and difficult to use.

Has anyone managed to come up with something better?


r/LazyLibrarian • • Aug 01 '19

is libgen working now for any of you guys?

8 Upvotes

[solved]

Just did a fresh install and cant seem to get any result but FAILED when I test settings. Does anyone have workng libgen on their copy?

(Edit) this pertains specifically to LL being able to access the site through its API (or whatever it uses) not web access to the site through a browser. Thanks.

[edit2] thanks to /u/philborman who posted this fix

gen.lib.rus.ec - working after changing lazylibrarian user_agent, in config.ini :

user_agent = Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/52.0.2743.116 Safari/537.36


r/LazyLibrarian • • 2d ago

LazyLibrarian has a new web interface (beta), feedback welcome

Thumbnail
gallery
7 Upvotes

Hi all,

I’ve been working on a new web UI for LazyLibrarian. It’s in beta, but already usable day to day, so I’d love some feedback.

What’s new

  • Modern layout: cards and a grid for books and authors, filters, a dark theme, and a “go to top” button on long pages. (screenshot)

  • Works on a phone: reachable menus and a language list that fits on screen. (screenshot)

  • Setup wizard: a first-run walkthrough that sets language, country, book databases and dates, and suggests search providers. (screenshot)

  • What’s new page and links to the docs, Reddit and the issue tracker in the Help menu.

  • Faster page loads, thanks to precompiled templates.

  • It’s translated through Weblate, and more translations are welcome.

Beta caveats

  • Pages the new interface doesn’t have yet open in the classic one.

  • You can go back to the classic interface any time from the menu, and your existing setup isn’t touched.

If you try it, tell me what’s broken, confusing or missing, ideally with a screenshot and your browser or device. Bugs go on the issue tracker, and general feedback can go in the comments.

Thanks!

Miso


r/LazyLibrarian • • Sep 19 '25

New install, can't add any authors? Can't scan existing books either?

7 Upvotes

Hi all! I'm new user trying to get this set up. I'm running the latest docker image, and I _think_ I've got the basics set up. I've got Hardcover enabled as a source, as well as a GoogleBooks API key, and the default GoodReads API key. I have a user set up with a Hardcover bearer token.

I try to add my first author: go to the authors page, search, find a result, click "add author". That just takes me back to the authors page, with no authors. I don't see anything helpful in the log. It doesn't seem to matter what I have selected as a primary info source, or whether or not "use multiple sources" is selected.

I've also got a few existing eBooks, so I try scanning those in: eBooks -> Library Scan. That does nothing in the UI but shows this in the console log:

Sep 18 19:16:34 c1-2 docker-lazylibrarian-start[720063]: 2025-09-18 19:16:34,393 ERROR: Unhandled exception in library_scan: Traceback (most recent call last):
Sep 18 19:16:34 c1-2 docker-lazylibrarian-start[720063]:   File "/app/lazylibrarian/lazylibrarian/librarysync.py", line 901, in library_scan
Sep 18 19:16:34 c1-2 docker-lazylibrarian-start[720063]:     bookid = eval(lazylibrarian.INFOSOURCES[CONFIG['BOOK_API']]['book_key'])
Sep 18 19:16:34 c1-2 docker-lazylibrarian-start[720063]:              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Sep 18 19:16:34 c1-2 docker-lazylibrarian-start[720063]:   File "<string>", line 1, in <module>
Sep 18 19:16:34 c1-2 docker-lazylibrarian-start[720063]: NameError: name 'gr_id' is not defined
Sep 18 19:16:34 c1-2 docker-lazylibrarian-start[720063]:  [librarysync.py:1359 (EBOOK_SCAN)]

The 'gr_id' changes to 'gb_id' or 'hc_id' depending on which primary source I have selected, but it's otherwise the same error.

Any suggestions?


r/LazyLibrarian • • Dec 19 '22

Adding annas-archive as a provider

7 Upvotes

Just wondering if anyone has any ideas about how to add annas-archive.org as a direct search provider. As this is the new zlib mirror it would be great to be able to search this. I’m currently using prowlarr in addition to LL, so I wonder if there’s a way to add it through there?


r/LazyLibrarian • • May 16 '21

Whats the Best Irc server for Lazylibrarian

7 Upvotes

I am using IRC to obtain books for LL

I keep on getting Banned or kicked on undernet.org

any one know of any decent settings/ irc servers / channels that i can use


r/LazyLibrarian • • Oct 13 '19

Zlibrary integration

7 Upvotes

mourn apparatus crowd spoon overconfident punch lock agonizing familiar upbeat

This post was mass deleted and anonymized with Redact