Making eBooks using Calibre on Linux

Spread the love

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:

sudo apt-get install calibre

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:

sudo python -c "import sys; py3 = sys.version_info[0] > 2; u = __import__('urllib.request' if py3 else 'urllib', fromlist=1); exec(u.urlopen('http://status.calibre-ebook.com/linux_installer').read()); main()"

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.

Subscribe to our newsletter!

Our latest tutorials delivered straight to your inbox

Sign up for all newsletters.
By signing up, you agree to our Privacy Policy and European users agree to the data transfer policy. We will not share your data and you can unsubscribe at any time. Subscribe


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.

Comments (4)