Compiling Cardano Node

After you finish installing GHC and Cabal successfully, you can compile Cardano Node from source code.

To compile Cardano Node:

  1. In a terminal window on the computer hosting your block-producing node, type the following command to navigate to the working directory that you created in the procedure Installing Glasgow Haskell Compiler and Cabal:

cd $HOME/git
  1. To download Cardano Node source code, type:

git clone
cd cardano-node
git fetch --all --recurse-submodules --tags
  1. To switch the repository that you downloaded to your local computer in step 2 to the latest tagged commit, type:

git checkout $(curl -s | jq -r .tag_name)

Typing a dollar sign ("$") before a command in parentheses refers to the output of the command in parentheses. For example, using a Web browser you can navigate to the above URL to display the data that the curl command retrieves, and then confirm the value of the tag_name attribute that the jq command selects.

  1. To adjust the project configuration to disable optimization and set the recommended compiler version, type the following command where <GHCVersionNumber> is the GHC version that you set in the procedure Installing Glasgow Haskell Compiler and Cabal:

cabal update
cabal configure -O0 -w ghc-<GHCVersionNumber>
  1. To produce executable cardano-node and cardano-cli binaries, type:

cabal build all
cabal build cardano-cli

Depending on your the processing power of your computer, the build process requires about 20 minutes to complete.

  1. To copy the cardano-node and cardano-cli binaries that you produced in step 7 into the /usr/local/bin directory, type:

sudo cp -p "$(./scripts/ cardano-node)" /usr/local/bin/cardano-node
sudo cp -p "$(./scripts/ cardano-cli)" /usr/local/bin/cardano-cli
  1. To confirm that the version installed on your computer matches the latest release available in the Cardano Node GitHub repository, type:

cardano-node --version
cardano-cli --version
  1. On each computer hosting a relay node for your stake pool, repeats steps 1 to 8

Last updated