Calibre is a free, powerful ebook manager, which has many features and is used by many users to manage their ebooks.
My parents have a library of books that they use Calibre for and wanted me to get a Calibre Content Server running on their FreeNAS server to avoid the troubles with hosting it with their desktop application. The version of FreeNAS I am using in this tutorial is 11.4
- Good knowledge of the command line
- A command line text editor, such as
- Some basic programming knowledge if possible
The first steps
To host a calibre server on your FreeNAS, you will need to create a jail. Click on the jails tab.
Next, click the 'add' button:
Give the jail a name and select a release. When done, press 'Next'
The next step shuold be configuring the network. In this step, enable VNET. You may configure other options, such as an IPV4 address. This will be the address used to connect locally to your server from another device on the local network.
Once you have your network set up, press 'Next' and submit. FreeNAS should redirect you back to the jails screen. Find the newly created jail and press the small arrow on the right side of the jail.
Next, mount your books from your shared storage if needed. To do this, click "Mount Points" and click on the "Actions" dropdown and finally select "Add." A new screen should appear where you can choose a source and a destination.
Use the file explorer to choose a folder to mount a source and a destination. In the destination, you can type more characters to create a new folder for the mount.
Next, go back to your jail and press the "START" button and wait for a few seconds. The state should change from 'down' to 'up' and more options may appear.
To start installing Calibre, enter the shell by pressing the "Shell" button. This will bring up a command line interface in the browser.
Installing the Calibre software
Packages in FreeBSD are installed using the
When first running it, you need to run:
It may ask you to install pkg. Enter "y" for yes.
pkg install calibre
If successful, you can skip to the Hosting the Server section. In my case, I ran into the following error:
pkg: No packages available to install matching 'calibre' have been found in the repositories
If you are unable to install calibre through the above means, you may need to build calibre from the source.
Building Calibre from source
This step uses the command
portsnap which allows you to work with ports from the FreeBSD ports tree. To start, run:
portsnap fetch && portsnap extract
This will download and extract the tree into your file system at
/usr/ports/. This may take a few minutes.
Next, follow the steps listed in the calibre ports page and run the following command:
cd /usr/ports/deskutils/calibre/ && make install clean
Warning: This part may take a few hours
This will begin building calibre and its dependencies. Every once in a while, you will be prompted to install software. Choose options using your arrow keys and space and press enter to select "OK"
This will happen many times. If you need to quit the build halfway due to an error, use ctrl+c to terminate the program. You can run the above command again to resume the build.
Some issues during the build
During the build, the program failed a few times due to various issues. I will list some of the issues I encountered and the solution to fix it.
Upgrade to freebsd 12.x or add DEFAULT_VERSIONS+=ssl=[openssl|libressl*]
This may happen during the build of QT. When this happens, you should run what it suggests you to do:
echo 'DEFAULT_VERSIONS+=ssl=openssl' >> /etc/make.conf
You can also use a text editor to modify
/etc/make.conf and add
Once this is done, simply run the make command as listed earlier again to resume.
Use of undeclared identifier 'true'/'ok'
This error occured near the end of the build step. Luckily, the solution isn't too hard to fix. Simply get your text editor and modify the C files where the error happened, and add
#include <stdbool.h> to the top of the code and make again.
Hosting the Server
Now, with calibre installed, you can finish setting up the server. First, use your text editor to open
/usr/local/etc/rc.d/calibre. Scroll down until you see the following line:
Change the user to "root"
Next, customize the startup options for calibre. Open
/etc/rc.conf. At the bottom, add the following:
# Enable Calibre Server calibre_enable="YES" calibre_user="root" calibre_library="/root/library"
It is worth noting that it is not possible (at least, I couldn't figure out how to do that) to escape spaces in the
calibre_library option, so you may need to create a symbolic link to your library folder if it contains spaces. This may be a bug.
Once this is complete, simply restart the jail and calibre should be running. To test it, connect to the jail's ip address at port
8080. If successful, you should see a page like this: