This guide shows how to install Electrum on an air-gapped machine. You will also need an Ubuntu machine connected to the network in order to complete this guide (it can be a virtual machine).
If you are running Ubuntu 16.04 off of a live USB, there is a bug that affects the package manager. You need to run these two commands at the terminal to fix it:
$ sudo mv /var/cache/app-info/xapian/default /var/cache/app-info/xapian/default_old
$ sudo mv /var/cache/app-info/xapian/default_old /var/cache/app-info/xapian/default
Next update the package manager:
$ sudo apt-add-repository universe
$ sudo apt-get update
Make a temporary directory to download .deb package files
$ mkdir debs
$ cd debs
Generate a list of URIs for the software you would like to install. This generates a text file called “apturls”.
$ sudo apt-get -y install --print-uris python-qt4 python-pip qrencode | cut -d\' -f2 | grep http:// > apturls
Now download the software packages to your hard drive
$ wget -i apturls
The previous step downloaded several .deb files to your hard drive in the “debs” directory. Copy this directory to the software usb drive. Make another temporary directory for the Electrum python sources
$ mkdir ~/python_files
$ cd ~/python_files
Download Electrum’s python dependencies
$ sudo pip download https://download.electrum.org/2.7.6/Electrum-2.7.6.tar.gz
Check https://electrum.org/#download to see if there is a URL available for a more recent version. The previous step should have downloaded several files into the “python_files” directory. Copy this to your software usb. Your software usb is now ready to be transferred to the air-gapped machine.
Plug in the usb and navigate to the directory of the "debs" files. Install the packages.
$ sudo dpkg -i *.deb
Now switch to the directory with the python files. Install the python files
$ sudo pip install --no-index --find-links=../python_files ../python_files/Electrum-2.7.5.tar.gz
That's it! You should be able to run Electrum by typing $ electrum
at the command line.
I found an alternative way to install the debian packages on the airgapped machine. It doens't seem to work on computers running on a live USB, but it may be more secure (I think apt-get checks package signatures and dpkg doesn't, but I'm still researching this).
Instead of $ sudo dpkg -i *.deb
, copy all the .deb files to /var/cache/apt/archive
. Then you should be able to sudo apt-get install python-qt4 python-pip
. Try it and see what works for you.
Please leave any feedback in a comment!
I wanted to be certain that there was some kind of verification for the .deb files on the air-gapped machine, I couldn't find any. I was able to extract one of the .deb files, modify one of its files, change its internal md5sum and recreate the deb file, then I installed the recreated deb file without any issues or warning, tested with apt apt-get and dpkg.
Also I noticed that while using these commands on an online machine that had Electrum installed I got an empty apturls file (because everything was already installed). So to use this method and not miss any dependencies both your online and air-gapped machine might need to be the same version and also fresh installs.
Because of these 2 findings I think the safest and easiest thing to do is to use verified ubuntu liveCDs (with the same version) for both your online and air-gapped machines. There still would be risks with this method (from the online machine/network) but it would be much less risky than to download .deb packages on an unknowingly compromised ubuntu machine/VM and install them on your air-gapped machine without being able to verify them.