How To Install Calibre Server On Ubuntu 14.04/16.04/18.04


Calibre is a free, open source and easy to use e-book manager. Calibre supports organizing existing e-books into virtual libraries, displaying, editing, creating and converting e-books, as well as syncing e-books with a variety of e-readers. Editing books is supported for EPUB and AZW3 formats.

1. Install Python and dependencies

$ sudo apt update
$ sudo apt upgrade
$ sudo apt install python python3
$ sudo apt install xvfb
$ sudo apt update
$ sudo apt install imagemagick

2. Download and install Calibre-server

$ sudo -v && wget -nv -O- | sudo sh /dev/stdin

You may notice some warnings about failed desktop integration, but these are safe to ignore, since you are installing Calibre on a remote server.

3. Create a new Calibre user

Create a new user for Calibre and give it superuser privileges:

$ sudo adduser calibre
$ sudo usermod -aG sudo calibre

4. Create Calibre library directories

Log out and log back in with the new user you just added. Then make a directory for the Calibre library and uploads.

$ sudo mkdir calibre-library
$ sudo mkdir calibre-upload

Change ownership permissions of the directories:

$ sudo chown -R calibre:calibre calibre-library
$ sudo chown -R calibre:calibre calibre-upload
$ sudo chown -R calibre:calibre .config
$ sudo chmod ugo+rw /media/calibre-upload
$ cd ~

5. Add a sample e-book

Download a sample e-book to load into the upload directory:

$ cd calibre-upload
$ sudo wget -O heart.epub

Then add the e-book to the library:

$ sudo xvfb-run calibredb add ~/calibre-upload/* --library-path ~/calibre-library

6. Test the server

To test the server, launch with the following command (you can substitute the port 8180 with something else):

$ sudo calibre-server --port=8180 --enable-local-write ~/calibre-library

Then open your web browser and go to: or if using a local LAN, http://192.168.0.XX:8180(replace ‘XX’ with the coorect IP Address)

When you are satisfied everything works, go back to the command line and Ctrl+C to exit.

7. Add a log file

Add a log file and change its ownership permissions:

$ sudo touch ~/calibre.log
$ sudo chown -R calibre:calibre ~/calibre.log

8. Add / Manage Calibre Users

$ sudo calibre-server --userdb /home/calibre/.config/calibre/server-users.sqlite --manage-users

Then follow the prompts. Repeat to add, edit or remove users.

9. Starting Calibre server at boot

$ sudo nano /etc/systemd/system/calibre-server.service

Add the code below changing User, Group, port and the location to the calibre-library directory (in this case /hoe/calibre/calibre-library):

Description=calibre content server


--port 8180 \
--enable-auth \


Ctrl+X to Save and Exit.

Then start the server with:

$ sudo systemctl start calibre-server.service

Check the status with:

$ sudo systemctl status calibre-server.service

Then to start at boot:

$ sudo systemctl enable calibre-server.service


If you have make any changes to calibre-server.service, reload:

$ sudo systemctl daemon-reload

To stop calibre-server:

$ sudo systemctl stop calibre-server.service

You can uninstall Calibre by running:

$ sudo calibre-uninstall

10. Install Calibre-Web (Optional but recommended)

Calibre-Web is a web app providing a clean interface for browsing, reading and downloading eBooks using an existing Calibre database.

Make sure you are logged in as the user calibre. Make sure that we have a python version greather than python2.7 installed. Check your python version:

$ python --version

If it outputs Python 2.7.x.x then we need to change the default to python3. To do this:

Update pip if necessary like this:

$ sudo -H pip install --upgrade pip

Open your .bashrc file:

$ sudo nano ~/.bashrc

Type alias python=python3 on to a new line at the top of the file then save the file with ctrl+o and close the file with ctrl+x.

Then, back at your command line type:

$ source ~/.bashrc

Now your alias should be permanent. To verify the change:

$ python --version

11. Download the lastest Calibre-Web:

Download, unzip and rename the calibre-web directory:

$ cd ~
$ wget
$ unzip
$ sudo mv calibre-web-master calibre-web
$ cd calibre-web

12. Install Calibre-Web:

$ sudo pip3 install --target vendor -r requirements.txt

While still in the calibre-web directory, using python3+ run (for python2.7 run python

$ python3

or preferrably, if you want to exit the terminal window (which you will want to do) (for python2.7 run nohup python

$ nohup python3


In your browser, go to or http://localhost:8083 (or or http://localhost:8083/opds for the OPDS catalog). You can change the port number later in the GUI if you want.

13. Set the location of the Calibre database

This is where the metadata.db is. In this case, /home/calibre/calibre-library. Click submit. The default admin login is:

Username: admin
Password: admin123

14. Enable on-the-fly conversion (Optional)

Optionally, to enable on-the-fly conversion from one ebook format to another when using the send-to-kindle feature, or during editing of ebooks metadata:

Download Amazon’s KindleGen tool for your platform and place the binary named kindlegen in the vendor folder:

$ sudo mkdir /home/calibre/kindle

Upload the .tar.gz (v2.9 as of this writing) file to the new kindle directory you just created. Then untar the file and move it to the vendor directory inside calibre-web:

$ cd kindle
$ sudo tar vxfz kindlegen_linux_2.6_i386_v2_9.tar.gz
$ sudo mv kindlegen /home/calibre/calibre-web/vendor/

The tar.gz file includes KindleGen Legal Notices and documentation. If you would like to delete the folder:

$ cd ~
$ sudo rm -R /home/calibre/kindle

15. Start Calibre-Web on boot

Start Calibre-Web as service under Linux with systemd:

$ sudo nano /etc/systemd/system/cps.service

Add this and replace the elements in {} like User, ExecStart and WorkingDirectorywith your username, file and foldernames:


ExecStart={path to python} {/PATH/TO/ including}
WorkingDirectory={/PATH/OF/CPS.PY without}




ExecStart=/usr/bin/python /home/calibre/calibre-web/


Enable the service:

$ sudo systemctl enable cps.service


1. You can add the path to your SSL certifile (for https) in Calibre Web at Admin settings > Basic Configuration > Server Configuration.

2. To extract cover pictures from PDF files

If you see an error message in Calibre-Web logs like:

WARNING - PDF extraction forbidden by ImageMagick policy: not authorized '/tmp/calibre_web/xxxxxxxxxxxxxxxxxx' @ error/constitute.c/ReadImage/412 during upload of PDF files.

ImageMagick recently changed their security policy, they now deny per default PDF operations, so covers can’t be extracted anymore, you have to allow it in the policy.xml file. Do this:

$ sudo nano /etc/ImageMagick-6/policy.xml

change the line:

<policy domain="coder" rights="none" pattern="PDF" />


<policy domain="coder" rights="read" pattern="PDF" />

Ctrl+x and ‘Y’ to save and exit. Finally, restart Calibre-Web. You can do this from the web GUI in Admin Settings > Restart (near the bottom of the screen).



For info on Calibre performance, see:


This web app has been tested on DigitalOcean. This app can also be installed using other hosts such as Amazon AWS, Google Cloud, Microsoft Azure, Vultr and others.

Minimal Server Requirements

This installation should use at least 1GB of RAM.

Installation & Maintenance

If you would like to get this app installed, maintained or need training, Contact Me to get current rates.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.