Cardano Node Installation process

After we have done all the prerequisites we are finally ready to do the installation process of Cardano Node!

Let's start by downloading the Cardano Node source code from git (github)

cd ~/git
git clone https://github.com/input-output-hk/cardano-node.git

cardano@localhost:~$ git clone https://github.com/input-output-hk/cardano-node.git Cloning into 'cardano-node'... remote: Enumerating objects: 18, done. remote: Counting objects: 100% (18/18), done. remote: Compressing objects: 100% (16/16), done. remote: Total 17996 (delta 3), reused 4 (delta 1), pack-reused 17978 Receiving objects: 100% (17996/17996), 5.66 MiB | 1.62 MiB/s, done. Resolving deltas: 100% (11955/11955), done.

You should have now a new folder - cardano-node with the source code of the cardano node, let's go to that directory and choose which version we would like to install (compile)

cd cardano-node
git fetch --all --recurse-submodules --tags

cardano@localhost:~/cardano-node$ cd cardano-node cardano@localhost:~$ git fetch --all --tags && git tag Fetching origin ....... 1.18.0 1.18.1 1.19.1 ....... 1.23.0

Currently (at the time I'm writing this tutorial) the latest Mainnet Tag is 1.23.0, so let's take it!

git checkout tags/1.23.0

Let's force the installation process to use the GHC version that we just installed.

cabal configure --with-compiler=ghc-8.10.2

Starting from tag 1.14.x we need to add libsodium libraries to Cardano node, so let's do that

echo "package cardano-crypto-praos" >> cabal.project.local
echo " flags: -external-libsodium-vrf" >> cabal.project.local

Now we are ready to start the installation (compilation) process (for those who are just updating and skipping to this page... I added cabal clean & cabal update command)! This will take a while... if you are installing this on VPS server, then you can go and grab coffee/beer/wine/water... as it will take a while.

cabal clean
cabal update
cabal build all

as the last step in our installation process is to copy newly compiled bin (executive) files to an early created folder: .local/bin

before you copy the new binary files, make sure that you have stopped your current cardano-node processes, otherwise ,you will not be able to overwrite the new file.

mkdir -p ~/.local/bin/
cp -p dist-newstyle/build/x86_64-linux/ghc-8.6.5/cardano-cli-1.23.0/x/cardano-cli/build/cardano-cli/cardano-cli ~/.local/bin/
cp -p dist-newstyle/build/x86_64-linux/ghc-8.6.5/cardano-node-1.23.0/x/cardano-node/build/cardano-node/cardano-node ~/.local/bin/

Let's check if we have installed the binary files in the correct location and the latest version

which cardano-node && which cardano-cli
cardano-node --version
cardano-cli --version
‚Äč

cardano@sp247srv:~$ cardano-node --version cardano-node 1.23.0 - linux-x86_64 - ghc-8.6 git rev eed250546fa9acec4c9de557b3e3551c1f682a30

cardano@sp247srv:~$ cardano-cli --version cardano-cli 1.23.0 - linux-x86_64 - ghc-8.6 git rev eed250546fa9acec4c9de557b3e3551c1f682a30

Great! We have installed the cardano node on our server!

Congratulations on running a Cardano Node (MainNet)!