3. Setting up Cabal and GHC

OK! So now you have installed Ubuntu on your virtual machine, we can start setting up the Cardano Haskell node. This is going to take a LOT of time. Actually, patience, as you don't have a lot of commands to execute, but some of them take a lot of time before being finished. So, make sure you get a book ready, or something else! 3.1 Click on the 9 little dots on the left of your screen, search for "terminal" in the search bar and open it

3.2 Once in your terminal, execute the following commands

sudo apt-get update

Make sure to input "Y" when the terminal asks you, when executing the command below.

sudo apt install build-essential libtool autoconf pkg-config libffi-dev libgmp-dev libssl-dev libtinfo-dev libsystemd-dev zlib1g-dev make g++ tmux git jq wget libncursesw5

3.3 Once all these tools have been downloaded, let's download and configure the Cabal library

3.31 First, download Cabal with this command

wget https://downloads.haskell.org/~cabal/cabal-install-

3.32 Now extract Cabal from the downloaded file

tar -xf cabal-install-

3.33 Let's delete the, now useless, downloaded file

rm cabal-install- cabal.sig

3.34 Create a new directory to place cabal in it

mkdir -p ~/.local/bin

3.35 Finally, move Cabal in it

mv cabal ~/.local/bin/

3.4 Now let's add ~/.local/bin/ to your PATH. First, open your .bashrc file in the nano editor with the following command

Make sure to get out of a directory, if you are in any, before doing the below command. You can get out of a directory in the terminal with the following command: cd .

nano .bashrc

3.41 In the editor, scroll to the bottom of the file, and add the following


3.42 Now save the file with ctrl + o and quit the editor with ctrl + x.

3.43 Execute the following command to enable the changes made to your .bashrc file

source .bashrc

3.43 Update Cabal, and check your version with these commands

cabal update
cabal -V

You should have version for the Cabal library.

3.5 Download and setup the Glasgow Haskell Compiler (GHC) with the following commands

3.51 Download the file

wget https://downloads.haskell.org/~ghc/8.6.5/ghc-8.6.5-x86_64-deb9-linux.tar.xz

3.52 Extract GHC of the downloaded file

tar -xf ghc-8.6.5-x86_64-deb9-linux.tar.xz

3.53 Delete the, now useless, downloaded file

rm ghc-8.6.5-x86_64-deb9-linux.tar.xz

3.54 Go into the GHC directory

cd ghc-8.6.5

3.55 Configure it


3.56 Now that the configuration is ready, let's install it

sudo make install

3.57 Get out of the GHC directory with cd, and check if you have the correct version of GHC

ghc -V

You should have version 8.6.5 for GHC.

Questions? Ask them in our Telegram chat!