I followed the procedure here for installing GHC and cabal, and then for ghc-mod.
But, I get this error at this step
cabal update && cabal install cabal-install
Configuring cabal-install-1.24.0.2... Failed to install cabal-install-1.24.0.2 cabal: Error: some packages failed to install: cabal-install-1.24.0.2 failed during the configure step. ExitFailure 11