Tormod Landet

Installing R in WSL

Short note for posteriority: the documentation for R tells you to install the key for the Ubuntu 18.04 R repository via the following command:

sudo apt-key adv --keyserver --recv-keys E298A3A825C0D65DFD57CBB651716619E084DAB9

Using apt-key in this way does not work on Ubuntu 18.04 on Windows 10 (in WSL, Windows Subsystem for Linux) due to use of an unsupported IPC mechanism for communicating with dirmngr (at least with Windows 10 version 1709). The command gives the following error:

Executing: /tmp/apt-key-gpghome.Sf0LlrpiEu/ --keyserver --recv-keys E298A3A825C0D65DFD57CBB651716619E084DAB9
gpg: connecting dirmngr at '/tmp/apt-key-gpghome.Sf0LlrpiEu/S.dirmngr' failed: IPC connect call failed
gpg: keyserver receive failed: No dirmngr

Instead run the following command to add the key:

curl -sL "" | sudo apt-key add

How did I get the number 0x51716619E084DAB9? Add the repository and run apt update:

sudo add-apt-repository 'deb bionic-cran35/'
sudo apt update

It will complain:

Err:2 bionic-cran35/ InRelease
  The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 51716619E084DAB9


The full set of commands to install R from the repositories:

curl -sL "" | sudo apt-key add
sudo add-apt-repository 'deb bionic-cran35/'
sudo apt-get update
sudo apt-get install r-base

I'm not really much of an R user, but I needed it this one time and I prefer using WSL when I have to use Windows.


comments powered by Disqus