Install Calibre without Root

On Linux, software should generally be installed with your system package manager (apt, yum, portage etc.) However, Calibre is a bit “special” in this respect. While well-loved, it’s known to be a bit difficult to package (to say the least) and most distro packages you’ll find are out of date. The official website recommends against using any distro packages and instead installing it directly from the site.

Unfortunately, the official instructions are problematic for a number of reasons. For a start, copying and pasting commands from the browser is considered dangerous. But that’s easy to fix, in bash do Ctrl-X Ctrl-E and your preferred text editor will be opened for you to type your command. This means you can inspect what is pasted before is run (save the file then exit the editor to run the command). Very important. Always do this when copy/pasting from the web.

But that’s not all, it also has you run the installer as root. The installer does tuck everything nicely away inside /opt/calibre, but it’s just not a good idea for many reasons.

User-level installation

Instead you can install it in your home directory under ~/opt like this:

1wget -nv -O- https://download.calibre-ebook.com/linux-installer.sh \
2    | sh /dev/stdin install_dir=~/opt isolated=True

Or, even better, as a completely different user so any error in the script can’t trample anything in your home directory:

1sudo useradd calibre            # add new user the first time
2
3wget -nv -O- https://download.calibre-ebook.com/linux-installer.sh \
4    | sudo -u calibre sh -s install_dir=~calibre/opt isolated=True

Once finished it will tell you to run /home/<user>/opt/calibre/calibre to start. If you have ~/bin (or perhaps ~/.local/bin) on your PATH you can add a nicer link with the following:

1ln -s /home/<user>/opt/calibre/calibre ~/bin

Then you should be able to run simply calibre.

Desktop environment integration

If you need a menu item in a desktop environment then you might first need to add the link to /usr/bin (this also makes it available for all users):

1sudo ln -s /home/calibre/opt/calibre/calibre /usr/bin/calibre

Then you need to make a desktop file called /usr/share/applications/calibre-gui.desktop with the following:

 1[Desktop Entry]
 2Version=1.0
 3Type=Application
 4Name=calibre
 5GenericName=E-book library management
 6Comment=E-book library management: Convert, view, share, catalogue all your e-books
 7TryExec=calibre
 8Exec=calibre --detach %U
 9Icon=calibre-gui
10Categories=Office;
11X-GNOME-UsesNotifications=true
12MimeType=image/vnd.djvu;application/x-cb7;application/oebps-package+xml;application/epub+zip;application/x-mobi8-ebook;text/plain;application/x-cbc;application/xhtml+xml;application/x-cbz;application/ereader;application/pdf;text/fb2+xml;application/x-mobipocket-subscription;application/x-cbr;application/x-sony-bbeb;text/x-markdown;text/html;application/vnd.oasis.opendocument.text;application/x-mobipocket-ebook;application/vnd.ms-word.document.macroenabled.12;application/vnd.openxmlformats-officedocument.wordprocessingml.document;text/rtf;x-scheme-handler/calibre;

You only need to make these links and desktop entry once. Next time you update Calibre they will point to the new version.