Making eBooks using Calibre on Linux

Calibre is a sophisticated, but yet easy to use, eBook management application. It is great for organizing your eBooks but its real power is in its ability to create and convert eBooks. November is National Novel Writing Month (NaNoWriMo) and Calibre is the perfect tool for turning your latest creation into an eBook. If writing your own novel isn’t your thing, Calibre is also great for turning public domain texts into well formatted eBooks with all the relevant meta data and a table of contents.


Calibre is cross platform and runs on Windows, OS X and Linux. This tutorial will focus on Linux but much of it applies equally to the other two platforms. Calibre can be installed via your distributions package repository or directly from Calibre. For Ubuntu you can install it from the Ubuntu Software Center or from the command line using:

However the packages supplied by your distribution might be out-of-date, so you can also install it using this special command which will install the latest version directly from Calibre:

This will run an installation script. You need to specify the installation directory and accepting the default of /opt is fine. The script will then download the files needed for the installation and then perform the install. To run, either type “calibre” in a terminal window or see if it an icon has been created in your launcher (which it is for distributions like Ubuntu or Linux Mint).

Creating the text in OpenOffice

OpenOffice and LibreOffice are excellent tools for creating eBooks, not only are they fully featured open source word processors, but by default they save documents in the Open Document Format, a non proprietary file format that programs like Calibre can easily read.

If you have your text in another format other than .odt, start OpenOffice and see if it can be imported. This will work for formats like plain text, Rich Text Format (.rtf) and most Microsoft Word files. Once you have your text in OpenOffice, you need to format it for importing into Calibre. The key here is to keep the document as simple as possible and use “Heading 1” and “Heading 2” for the chapter titles and any major divisions in the text. So a simple book would use “Heading 1” for the Preface, Chapter 1, Chapter 2 and so on. Or you could use “Heading 1” for Preface, Part I, Part II etc and “Heading 2” for Chapter 1, Chapter 2 etc.

eBook generation with Calibre

Once you have you text formatted, ensure that it is saved in .odt format and start Calibre. To add a new book to Calibre, click “Add books” and select the .odt file that you want to import. The document will be imported and appear in the main list of books. The metadata (information like the author’s name and the description etc) needs to be corrected. Select the book in the main book list and click “Edit metadata”.


It is important to fill out at least the Title and the Author(s), but fields like the Comments and Languages are also important. If you change the Title or Author(s), it is important to press the blue arrow at the end of the field as this will generate the correct metadata for sorting, i.e. “The Great Adventure in Wimbledon” becomes “Great Adventure in Wimbledon, The”.

Calibre can create eBooks in several different formats including epub, mobi and PDF. These are the three main types. The first is for book readers like the Barnes and Noble Nook or the Kobo, the second is for Amazon’s Kindle and the third is the generic Acrobat format which is especially suited to PCs or large screen tablets.

To create an eBook, click on “Convert books” and select the desired file format in the “Output format” drop down list in the top right-hand corner. Click on “Structure Detection” and change the “Detect chapters at” field to //*[((name()='h1' or name()='h2'))]. The default rule is good but it tries to find keywords like “Chapter”. This is good for many situations but the simplest solution is just to make every level 1 or 2 heading a chapter. Next click on “Tablet of Contents” and ensure that “Force use of auto-generated Table of Contents” is checked. Now click on OK. The book conversion process will start and the job activity is shown in the bottom right-hand corner.


Once the conversion is completed, the new file format will appear in the list of formats for that book. Clicking on the format name will open the Calibre eBook previewer which will display the eBook as a reading device would see it. If you need to change the source OpenOffice file then click on ODF in the file formats list, this will open the version of the document that was imported into Calibre.

Gary Sims

Gary has been a technical writer, author and blogger since 2003. He is an expert in open source systems (including Linux), system administration, system security and networking protocols. He also knows several programming languages, as he was previously a software engineer for 10 years. He has a Bachelor of Science in business information systems from a UK University.


  1. sudo python -c “import sys; py3 = sys.version_info[0] > 2; u = __import__(‘urllib.request’ if py3 else ‘urllib’, fromlist=1); exec(u.urlopen(‘’).read()); main()”

    gets the following result:
    Traceback (most recent call last):
    File “”, line 1, in
    NameError: name ‘gt’ is not defined

    What am i doing incorrectly?

  2. Tom, sorry about that, there is a bit of a mix up with the HTML in article! Please replace > with >

    I will try to fix the HTML soon!


  3. Ah, this is maddening even the comment box doesn’ti understand….

    Please replace the & g t ; (but without the spaces) with > (greater than sign).


  4. sudo python -c “import sys; py3 = sys.version_info[0] > 2; u = __import__(‘urllib.request’ if py3 else ‘urllib’, fromlist=1); exec(u.urlopen(‘’).read()); main()”
    gets the following result:
    Traceback (most recent call last):
    File “”, line 1, in
    NameError: name ‘gt’ is not defined

    What am i doing incorrectly?

    i accidently posted this to the wrong page, sorry about that.
    i think i have it posted at the foot of the Calibre article now (well, i hope that i do).

Comments are closed.