Installing Calibre on Linux without root

Calibre is a great piece of software for managing e-books. Not only is it great, it's open source. What's not to like?

OK, there is one thing not to like about Calibre: packaging and installation. The project download page actually advises against using OS-provided packages on the grounds that they are "often buggy/outdated". And instead of providing a normal download-and-install process, Calibre expects you to download an unknown Python script which you then run as root.

Sorry, Calibre, but no. I'm not going to give you complete access to my computer to do anything you want with it. You are free to copy files into a directory of my choosing, but beyond that, I'm in charge. It's my computer, not yours.

So here's how I got calibre's installation script to behave according to my wishes.

  1. Download the installation script:

    $ wget -nv https://raw.githubusercontent.com/kovidgoyal/calibre/master/setup/linux-installer.py
    
  2. Run the installation script such that it installs to /tmp/calibre:

    $ python -c 'execfile("linux-installer.py"); main(install_dir="/tmp")'
    
  3. Move the installation to its permanent home:

    $ sudo mv calibre /usr/local/calibre-$VERSION
    
  4. Make sure the shell can find "calibre" (first time only):

    $ cd /usr/local
    $ sudo ln -s calibre-$VERSION calibre
    $ sudo ln -s ../calibre/calibre bin/.
    

For future upgrades, repeat steps 1-3. Then you just have to replace the /usr/local/calibre symlink:

$ cd /usr/local
$ sudo rm calibre
$ sudo ln -s calibre-$VERSION calibre

and the existing /usr/local/bin/calibre symlink will now point to the new version. If the upgrade is a failure, rolling back to the previous version is trivial.

Author: Greg Ward
Published on: Aug 30, 2014, 3:38:12 PM
Permalink - Source code