Skip to content

Instantly share code, notes, and snippets.

@cjwirth
Forked from yantonov/install-ghc-ubuntu.md
Last active August 29, 2015 14:07
Show Gist options
  • Save cjwirth/52331a0650350c93a653 to your computer and use it in GitHub Desktop.
Save cjwirth/52331a0650350c93a653 to your computer and use it in GitHub Desktop.

How to install latest GHC 7.8.3 + cabal 1.20.2 on ubuntu

ghc

ubuntu prerequisites

# Multiprecision arithmetic library developers tools
sudo apt-get install libgmp-dev -y
sudo -K

ghc installation

# get distr
cd $HOME/Downloads
wget http://www.haskell.org/ghc/dist/7.8.3/ghc-7.8.3-x86_64-unknown-linux-deb7.tar.bz2
tar xvfj ghc-7.8.3-x86_64-unknown-linux-deb7.tar.bz2
cd ghc-7.8.3

# install to 
mkdir $HOME/Development/bin/ghc-7.8.3
# or choose another path

./configure --prefix=$HOME/Development/bin/ghc-7.8.3

make install

# symbol links
cd $HOME/Development/bin
ln -s `pwd`/ghc-7.8.3 ghc

# add $HOME/Development/bin/ghc to $PATH
$ PATH=$HOME/Development/bin/ghc/bin:${PATH}

# remove temporary files
cd $HOME/Downloads
rm ghc-7.8.3-x86_64-unknown-linux-deb7.tar.bz2
rm -rf ghc-7.8.3

cabal (package manager for haskell)

cabal library

# clone dist
cd $HOME/Downloads
wget http://www.haskell.org/cabal/release/cabal-1.20.0.2/Cabal-1.20.0.2.tar.gz
# extract 
tar xzvf Cabal-1.20.0.2.tar.gz
cd Cabal-1.20.0.2

# build
ghc --make Setup.hs
./Setup configure --user
./Setup build
./Setup install

# remove temporary files
cd $HOME/Downloads
rm Cabal-1.20.0.0.tar.gz
rm -rf Cabal-1.20.0.0

cabal-install

# remove old
rm -rf $HOME/.cabal

# get distributive
cd $HOME/Downloads
wget http://www.haskell.org/cabal/release/cabal-install-1.20.0.3/cabal-install-1.20.0.3.tar.gz

# extract archive
tar xzvf cabal-install-1.20.0.3.tar.gz
cd cabal-install-1.20.0.3

# install
./bootstrap.sh

# remove temporary files
cd $HOME/Downloads
rm cabal-install-1.20.0.0.tar.gz
rm -rf cabal-install-1.20.0.0

# add path to cabal to PATH environment
$ PATH=$HOME/.cabal/bin:$PATH
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment