Let's start by downloading the Cardano Node source code from git (github)
cd ~/gitgit 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-nodegit 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.24.2
Currently (at the time I'm writing this tutorial) the latest Mainnet Tag is 1.24.2, so let's take it!
git checkout tags/1.24.2
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.localecho " 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 cleancabal updatecabal 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.10.2/cardano-cli-1.24.2/x/cardano-cli/build/cardano-cli/cardano-cli ~/.local/bin/cp -p dist-newstyle/build/x86_64-linux/ghc-8.10.2/cardano-node-1.24.2/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-clicardano-node --versioncardano-cli --version​
cardano@sp247srv:~$ cardano-node --version cardano-node 1.24.2 - linux-x86_64 - ghc-8.10 git rev 400d18092ce604352cf36fe5f105b0d7c78be074
cardano@sp247srv:~$ cardano-cli --version cardano-cli 1.24.2 - linux-x86_64 - ghc-8.10 git rev 400d18092ce604352cf36fe5f105b0d7c78be074
Great! We have installed the cardano node on our server!
Congratulations on running a Cardano Node (MainNet)!