Cardano: Difference between revisions

From Piszczynski
piszczynski>Aleks
(Created page with " == Build Cardano Node == -taken from https://developers.cardano.org/docs/get-started/installing-cardano-node/ Install Operating System dependencies: *sudo apt-get install a...")
 
m (1 revision imported)
 
(No difference)

Latest revision as of 22:30, 15 November 2023

Build Cardano Node

-taken from https://developers.cardano.org/docs/get-started/installing-cardano-node/

Install Operating System dependencies:

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

Install GHC and Cabal GHCup:

Check install of ghup

  • ghcup --version

The GHCup Haskell installer, version v0.1.14.1 ghcup will install the latest stable version of ghc. However, as of the time of writing this, Input-Output recommends using ghc 8.10.4. So, we will use ghcup to install and switch to the required version.

  • ghcup install ghc 8.10.4
  • ghcup set ghc 8.10.4

Check ghc version:

  • ghc --version

Check cabal version:

  • cabal --version


Downloading & Compiling

Make location for storing source files:

  • mkdir -p ~/cardano-src
  • cd ~/cardano-src

download, compile and install libsodium.


Add Environment Vairables:

  • export LD_LIBRARY_PATH="/usr/local/lib:$LD_LIBRARY_PATH"
  • export PKG_CONFIG_PATH="/usr/local/lib/pkgconfig:$PKG_CONFIG_PATH"

Reload Shell:

  • source ~/.bashrc

return to source folder:

  • cd ~/cardano-src

Download the cardano-node repository:

Switch the repository to the latest tagged commit (check for latest version first): You can check the latest available version/tag by visiting the cardano-node Github Release page.

  • git checkout tags/1.27.0

Configuring the build options#

We explicitly use the ghc version that we installed earlier. This avoids defaulting to a system version of ghc that might be newer or older than the one you have installed.

  • cabal configure --with-compiler=ghc-8.10.4

Update the local project file to use libsodium that you installed earlier.

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

Building and installing the node# We can now build the Haskell-based cardano-node to produce executable binaries.

  • cabal build all

Install the newly built node and CLI commands to the ~/.local/bin directory:

  • mkdir -p ~/.local/bin
  • cp -p "$(./scripts/bin-path.sh cardano-node)" ~/.local/bin/
  • cp -p "$(./scripts/bin-path.sh cardano-cli)" ~/.local/bin/

We have to add this line below our shell profile so that the shell/terminal can recognize that cardano-node and cardano-cli are global commands. (~/.zshrc or ~/.bashrc depending on the shell application you use)

  • export PATH="~/.local/bin/:$PATH"

Once saved, reload your shell profile by typing source ~/.zshrc or source ~/.bashrc (depending on the shell application you use).

Check the version that has been installed:

  • cardano-cli --version
  • cardano-node --version

Congratulations, you have successfully installed Cardano components into your Linux system! 🎉🎉🎉