How to Run a Calibre Server on FreeNAS

| Thu Nov 05 2020 | edited Thu Nov 05 2020

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


The first steps

To host a calibre server on your FreeNAS, you will need to create a jail. Click on the jails tab.

Main screen with jail tab at bottom left

Next, click the 'add' button:

jail management bar

Give the jail a name and select a release. When done, press 'Next'

Jail basic setup screen. Release chosen = 11.4-RELEASE. Jail type Default

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.

jail screen with jail options

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.

Mount points screen

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.


In this image, root is the folder selected, and I added "library" at the end, which will mount the library at /root/library

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.

Jail with restart,stop,and shell option

To start installing Calibre, enter the shell by pressing the "Shell" button. This will bring up a command line interface in the browser.

shell interfact

Installing the Calibre software

Packages in FreeBSD are installed using the pkg command.

When first running it, you need to run:

pkg update

It may ask you to install pkg. Enter "y" for yes.

Next, run:

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"

Installing a dependency

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 DEFAULT_VERSIONS+=ssl=openssl

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:

: ${calibre_user=calibre}

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        

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:

calibre landing page

Sources/Useful Links:


Add a comment