Skip to content

Instantly share code, notes, and snippets.

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

How to install latest GHC 7.10.1 + cabal 1.22.3.0 from source on Debian Testing

ghc 7.10.1 installation

Debian prerequisites

    $ sudo apt-get install build-essential ca-certificates xz-utils -y
    $ sudo apt-get install libgmp10 libgmp-dev libffi-dev zlib1g-dev -y  
    $ sudo -K

ghc installation

    # get distr  
    $ cd $HOME/Downloads
    
    # 64 bit
    $ wget https://www.haskell.org/ghc/dist/7.10.1/ghc-7.10.1-x86_64-unknown-linux-deb7.tar.xz   
    
    $ tar xvf ghc-7.10.1-x86_64-unknown-linux-deb7.tar.xz
    $ cd ghc-7.10.1
    
    $ mkdir $HOME/ghc  
    # or choose another path
    
    $ ./configure --prefix=$HOME/ghc 
    $ make install

    # edit ~/.profile  
    export GHC_HOME=$HOME/ghc  
    export PATH=$GHC_HOME/bin:${PATH}
    
    # to use updated path without log off
    $ source ~/.profile
    
    # remove temporary files  
    $ cd $HOME/Downloads  
    $ rm -rfv ghc-7.10.1*
    
    # remove old  
    $ rm -rfv $HOME/.cabal
    $ rm -rfv $HOME/.ghc

cabal (package manager for haskell)

cabal library

    # clone dist  
    $ cd $HOME/Downloads  
    $ curl -O https://www.haskell.org/cabal/release/cabal-1.22.3.0/Cabal-1.22.3.0.tar.gz
    
    # extract   
    $ tar xvf Cabal-1.22.3.0.tar.gz  
    $ cd Cabal-1.22.3.0  
    
    # build
    $ ghc --make Setup.hs
    $ ./Setup configure --user
    $ ./Setup build
    $ ./Setup install
    
    # Remove temporary files
    $ cd $HOME/Downloads
    $ rm -rfv Cabal-1.22.3.0*

cabal-install

    # get tar file  
    $ cd $HOME/Downloads  
    $ curl -O https://www.haskell.org/cabal/release/cabal-install-1.22.3.0/cabal-install-1.22.3.0.tar.gz
    
    # extract archive  
    $ tar xzvf cabal-install-1.22.3.0.tar.gz  
    $ cd cabal-install-1.22.3.0  
    
    # install  
    $ ./bootstrap.sh
    
    # remove temporary files  
    $ cd $HOME/Downloads  
    $ rm -rfv cabal-install-1.22.3.0*  
    
    # edit ~/.profile 
    export CABAL_HOME=$HOME/.cabal
    export PATH=$CABAL_HOME/bin:$PATH

    # to use updated path without log off
    $ source ~/.profile
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment