ebook-convert turns an EPUB into a clean PDF in one line, and it runs fine on a headless server with no desktop installed. The command ships inside Calibre, which nearly every distro packages, and it handles the things naive converters break: chapter structure, embedded fonts, images, and internal links. This guide covers how to convert EPUB to PDF on Linux from the terminal: installing Calibre on each distro family, the ebook-convert flags that actually change the output, batch conversion, and pandoc as a lighter alternative with one nasty gotcha. Everything below was run in August 2026 on Ubuntu 26.04, with Debian 13 and 12, Fedora, Arch and Rocky Linux 10 verified in containers.
Install Calibre on Ubuntu, Debian, Fedora and Arch
Calibre sits in the default repositories of every mainstream distro outside the RHEL family, so there is nothing to add. On Ubuntu and Debian, one command pulls it in. Fair warning: the package tree is large because Calibre bundles a Qt GUI, a content server and format libraries. On a fresh Ubuntu server it pulled 413 packages and used 1.3 GB of disk. If apt, snap and flatpak coexistence on the current LTS confuses you, the packaging guide for Ubuntu sorts out which format wins for which job.
sudo apt update
sudo apt install calibre
On Fedora the package lives in the default repos as well. The dnf5 cheat sheet has the flags if you want to inspect the dependency tree before committing:
sudo dnf install calibre
Arch users install from the official extra repository. Full syntax lives in the pacman cheat sheet:
sudo pacman -S calibre
The version you get differs a lot by distro. This is what the repositories carried when we checked each one in a container:
| Distro | Install source | Calibre version (August 2026) |
|---|---|---|
| Ubuntu 26.04 | apt, default repos | 9.2.1 |
| Ubuntu 24.04 | apt, default repos | 7.6.0 |
| Debian 13 | apt, default repos | 8.5.0 |
| Debian 12 | apt, default repos | 6.13.0 |
| Fedora | dnf, default repos | 9.11.0 |
| Arch Linux | pacman, extra repo | 9.12.0 |
| RHEL / Rocky / Alma 10 | official binary installer | 9.13.0 (upstream latest) |
Every version in that table converts EPUB to PDF without drama. The distro version only matters if you need a recent conversion engine fix, in which case the binary installer in the next section works on any distro, not just RHEL.
Install Calibre on RHEL, Rocky and AlmaLinux
Enterprise Linux does not package Calibre at all. It is not in the default repos and it is not in EPEL either, which we confirmed on Rocky Linux with EPEL enabled. The supported route is the official binary installer from upstream, which drops a self-contained build into /opt/calibre.
On a minimal server install, put the runtime libraries in place first. The installer and the PDF engine need X client libraries, NSS and ALSA even on a headless box, because the PDF renderer is Chromium-based:
sudo dnf install wget xz python3 mesa-libEGL libglvnd-opengl libglvnd-glx \
xcb-util-cursor freetype fontconfig libX11 alsa-lib nspr nss libxkbcommon
Then run the installer:
sudo -v && wget -nv -O- https://download.calibre-ebook.com/linux-installer.sh | sudo sh /dev/stdin
A successful run ends by telling you the launch command:
Installing to /opt/calibre
Downloading tarball signature securely...
Extracting files to /opt/calibre ...
Run "calibre" to start calibre
The binaries land in /opt/calibre, and the installer symlinks them into /usr/bin, so ebook-convert resolves from anywhere. The same installer works on Ubuntu or Debian when you want a newer build than the repos carry; the official download page documents the isolated-install variant too.
Error: “You are missing the system library libEGL.so.1”
If you skip the dependency step on a minimal install, the installer aborts before downloading anything:
You are missing the system library libEGL.so.1. Try installing packages such as libegl1 and libopengl0
The suggested package names are Debian names, which will not resolve on dnf. On RHEL-family systems the equivalents are mesa-libEGL and libglvnd-opengl. The installer checks one library at a time, so it will stop again on libxcb-cursor.so.0 (package xcb-util-cursor) and libfreetype.so (package freetype) if those are absent. The single dnf line above clears all of them in one pass.
Error: “Running as root without –no-sandbox is not supported”
Converting to PDF as the root user fails with a Chromium sandbox error, because the PDF renderer refuses to run its zygote process as UID 0:
[2:2:0814/020733.522030:ERROR:zygote_host_impl_linux.cc(105)] Running as root without --no-sandbox is not supported. See https://crbug.com/638180.
The fix is to run ebook-convert as a regular user. Only the install needs root. This mostly bites people converting inside containers or on throwaway cloud boxes where everything runs as root by habit.
Convert EPUB to PDF with ebook-convert
The syntax is input file first, output file second, and the output extension picks the format. No flags are required for a first pass:
ebook-convert book.epub book.pdf
Conversion prints progress as it walks the pipeline. A 348 KB novel took 17 seconds on a 2-core VM:
1% Converting input to HTML...
34% Running transforms on e-book...
67% Running PDF Output plugin
90% Rendered all HTML as PDF
100% Updated metadata in PDF
PDF output written to /home/jmutai/ebooks/book.pdf
On a server without a GPU you will also see QRhiGles2: Failed to create context and a Vulkan warning before the progress lines. Both are noise from the Qt renderer probing for hardware acceleration; the conversion completes normally without it.

Check what came out the other end with file:
file book.pdf
The page count confirms it rendered the whole book, not just the first chapter:
book.pdf: PDF document, version 1.4, 206 page(s)
Image-heavy books are no problem. We fed it a 24 MB illustrated EPUB and got a 26 MB PDF with all 174 images preserved, converted in under 10 seconds. If the result needs to travel by email, you can compress the PDF afterwards rather than degrading images during conversion.
Control Page Size, Fonts and Page Numbers
The defaults are wrong for most people outside the US. ebook-convert renders US letter pages with a large default font, which inflates the page count badly. These are the four flags worth knowing:
ebook-convert book.epub book.pdf \
--paper-size a4 \
--pdf-default-font-size 12 \
--pdf-page-numbers \
--pdf-add-toc
The effect is not subtle. The same novel that rendered to 206 letter pages at the default font size came out at 91 A4 pages with the font size set to 12 (the value is in pixels, not points). --pdf-page-numbers stamps page numbers in the footer, and --pdf-add-toc appends a table of contents with page references at the end of the PDF, which matters if the copy is headed for a printer.
Two more flags earn their keep in practice. --enable-heuristics cleans up badly produced EPUBs (forced line breaks mid-paragraph, scene breaks lost). And --pdf-serif-family sets the body typeface if you dislike the default. The full flag list is long; the ebook-convert manual documents every PDF output option.
Batch Convert a Folder of EPUBs
ebook-convert takes one file at a time, so batch work is a shell loop. This converts every EPUB in the current directory, keeping each book’s name:
for f in *.epub; do ebook-convert "$f" "${f%.epub}.pdf" --paper-size a4 >/dev/null; done
List the results when the loop finishes:
ls -lh *.pdf
Each PDF lands next to its source EPUB:
-rw-rw-r-- 1 jmutai jmutai 1.3M Aug 14 01:59 frankenstein.pdf
-rw-rw-r-- 1 jmutai jmutai 3.4M Aug 14 01:59 moby-dick.pdf
-rw-rw-r-- 1 jmutai jmutai 26M Aug 14 01:59 pride-and-prejudice.pdf
This is the loop and its result on our test box, three novels converted in one pass:

The quoting matters. "$f" and "${f%.epub}.pdf" keep filenames with spaces intact, which ebook collections are full of. The >/dev/null silences the per-book progress output so the loop runs quietly; drop it if you want to watch each conversion.
Convert with pandoc Instead
If 1.3 GB of Calibre feels like too much for occasional conversions, pandoc does the same job with about half the footprint. It needs a PDF engine alongside it, and the smallest workable one is WeasyPrint. Together they used 747 MB on a fresh install:
sudo apt install pandoc weasyprint
Then convert, naming the engine explicitly:
pandoc book.epub --pdf-engine=weasyprint -o book.pdf
WeasyPrint prints a few CSS warnings about media queries it ignores; the output is fine. It comes from the same HTML-to-PDF family as wkhtmltopdf, but unlike that project it is still actively maintained.
Error: “pdflatex not found. Please select a different –pdf-engine or install pdflatex”
Run pandoc against a PDF target without naming an engine and it fails immediately:
pdflatex not found. Please select a different --pdf-engine or install pdflatex -- see also /usr/share/doc/pandoc/README.Debian
pandoc defaults to LaTeX for PDF output, and pdflatex means pulling in a TeX Live installation you do not otherwise need. Passing --pdf-engine=weasyprint sidesteps the whole thing. Any of the engines pandoc supports would clear the error; WeasyPrint wins here because it handles the HTML and CSS inside an EPUB properly without dragging in TeX.
pandoc silently drops images unless you extract media
This one costs people real output quality and nothing warns you. When we converted the 24 MB illustrated EPUB through pandoc and WeasyPrint, the command exited 0 and produced a plausible 296-page PDF, but every one of the 174 images was gone. We confirmed it with pdfimages -list: zero embedded images. The fix is telling pandoc to extract the EPUB’s media to disk so the engine can find it:
pandoc book.epub --pdf-engine=weasyprint --extract-media=./media -o book.pdf
With --extract-media the same book came out at 25 MB with the illustrations embedded. If your EPUBs are plain text novels the flag changes nothing, but there is no downside to using it every time. The behaviour is documented, thinly, in the pandoc manual.
Calibre or pandoc
Use Calibre’s ebook-convert when the output matters: it preserved images, chapter structure and internal links on everything we threw at it, and its PDF-specific flags (paper size, fonts, page numbers, TOC) have no pandoc equivalent. Use pandoc when the machine already has it installed or when EPUB-to-PDF is one step in a scripted document pipeline, and always pass --extract-media. On RHEL-family servers the decision is made for you at install time: pandoc is one dnf command away, while Calibre means the upstream binary installer. Either way the conversion itself is a one-liner, and both run fine over SSH with no display attached.
Hello, the instructions for Fedora is out of date. calibre is now provided from the main repos, you can install it like any program
It actually installs the latest release.