Installing Cardano-node

Latest version 1.25.1

Prerequisites

Set up your platform:
You will need:
  • An x86 host (AMD or Intel), Virtual Machine or AWS instance with at least 2 cores, 4GB of RAM and at least 10GB of free disk space;
  • A recent version of Linux, not Windows or MacOS – this will help us isolate any issues that arise.
  • Make sure you are on a network that is not firewalled. In particular, we will be using TCP/IP port 3000 and 3001 by default to establish connections with other nodes, so this will need to be open.

Install dependencies

We need the following packages and tools on our Linux system to download the source code and build it:
  • the version control system git,
  • the gcc C-compiler,
  • C++ support for gcc,
  • developer libraries for the arbitrary precision library gmp,
  • developer libraries for the compression library zlib,
  • developer libraries for systemd,
  • developer libraries for ncurses,
  • ncurses compatibility libraries,
  • the Haskell build tool cabal,
  • the GHC Haskell compiler.
If we are using an AWS instance running Amazon Linux AMI 2 (see the AWS walk-through for how to get such an instance up and running)or another CentOS/RHEL based system, we can install these dependencies as follows:
1
sudo yum update -y
2
sudo yum install git gcc gcc-c++ tmux gmp-devel make tar wget -y
3
sudo yum install zlib-devel libtool autoconf -y
4
sudo yum install systemd-devel ncurses-devel ncurses-compat-libs -y
Copied!
For Debian/Ubuntu use the following instead:
1
sudo apt-get update -y
2
sudo apt-get install build-essential pkg-config libffi-dev libgmp-dev -y
3
sudo apt-get install libssl-dev libtinfo-dev libsystemd-dev zlib1g-dev -y
4
sudo apt-get install make g++ tmux git jq wget libncursesw5 libtool autoconf -y
Copied!
If you are using a different flavor of Linux, you will need to use the package manager suitable for your platform instead of yum or apt-get, and the names of the packages you need to install might differ.

Download, unpack, install and update Cabal:

1
wget https://downloads.haskell.org/~cabal/cabal-install-3.2.0.0/cabal-install-3.2.0.0-x86_64-unknown-linux.tar.xz
2
tar -xf cabal-install-3.2.0.0-x86_64-unknown-linux.tar.xz
3
rm cabal-install-3.2.0.0-x86_64-unknown-linux.tar.xz cabal.sig
4
mkdir -p ~/.local/bin
5
mv cabal ~/.local/bin/
Copied!
Verify that .local/bin is in your PATH
1
echo $PATH
Copied!
If .local/bin is not in the PATH, you need to add the following line to your .bashrcfile
Navigate to your home folder:
1
cd
Copied!
Open your .bashrc file with nano text editor
1
nano .bashrc
Copied!
Go to the bottom of the file and add the following lines
1
export PATH="~/.local/bin:$PATH"
Copied!
You need to restart your server or source your .bashrc file
1
source .bashrc
Copied!
Update cabal
1
cabal update
Copied!
Above instructions install Cabal version 3.2.0.0. You can check the version by typing
1
cabal --version
Copied!

Download and install GHC:

For Debian/Ubuntu systems:
1
wget https://downloads.haskell.org/~ghc/8.10.2/ghc-8.10.2-x86_64-deb9-linux.tar.xz
2
tar -xf ghc-8.10.2-x86_64-deb9-linux.tar.xz
3
rm ghc-8.10.2-x86_64-deb9-linux.tar.xz
4
cd ghc-8.10.2
5
./configure
6
sudo make install
7
cd ..
Copied!
For CentOS/RHEL systems:
1
wget https://downloads.haskell.org/~ghc/8.10.2/ghc-8.10.2-x86_64-centos7-linux.tar.xz
2
tar -xf ghc-8.10.2-x86_64-centos7-linux.tar.xz
3
rm ghc-8.10.2-x86_64-centos7-linux.tar.xz
4
cd ghc-8.10.2
5
./configure
6
sudo make install
7
cd ..
Copied!
Alternatively, the ghcup tool can be used to install and set several versions of GHC:
1
curl --proto '=https' --tlsv1.2 -sSf https://get-ghcup.haskell.org | sh
2
ghcup upgrade
3
ghcup install <VERSION>
4
ghcup set <VERSION>
Copied!
here could be for example 8.10.2
You can check that your default GHC version has been properly set:
1
ghc --version
Copied!

Install Libsodium

1
export LD_LIBRARY_PATH="/usr/local/lib:$LD_LIBRARY_PATH"
2
export PKG_CONFIG_PATH="/usr/local/lib/pkgconfig:$PKG_CONFIG_PATH"
3
​
4
git clone https://github.com/input-output-hk/libsodium
5
cd libsodium
6
git checkout 66f017f1
7
./autogen.sh
8
./configure
9
make
10
sudo make install
Copied!
Add the following to your .bashrc file and source it.
1
export LD_LIBRARY_PATH="/usr/local/lib:$LD_LIBRARY_PATH"
2
export PKG_CONFIG_PATH="/usr/local/lib/pkgconfig:$PKG_CONFIG_PATH"
Copied!

Download the source code for cardano-node

1
cd
2
git clone https://github.com/input-output-hk/cardano-node.git
Copied!
This creates the folder cardano-node and downloads the latest source code.
After the download has finished, we can check its content by
1
ls cardano-node
Copied!
We change our working directory to the downloaded source code folder:
1
cd cardano-node
Copied!
For reproducible builds, we should check out a specific release, a specific "tag". For the Mary Testnet, we will use tag 1.25.1, which we can check out as follows:
1
git fetch --all --tags
2
git tag
3
git checkout tags/1.25.1
Copied!

Build and install the node

Now we build and install the node with cabal, which will take a few minutes the first time you do a build. Later builds will be much faster, because everything that does not change will be cached.
1
cabal clean
2
cabal update
3
cabal build all
Copied!
Now we can copy the executables files to the .local/bin directory
1
cp -p dist-newstyle/build/x86_64-linux/ghc-8.10.2/cardano-node-1.25.1/x/cardano-node/build/cardano-node/cardano-node ~/.local/bin/
Copied!
1
cp -p dist-newstyle/build/x86_64-linux/ghc-8.10.2/cardano-cli-1.25.1/x/cardano-cli/build/cardano-cli/cardano-cli ~/.local/bin/
Copied!
1
cardano-cli --version
Copied!
If you need to update to a newer version follow the steps below:
1
cd cardano-node
2
git fetch --all --tags
3
git tag
4
git checkout tags/<the-tag-you-want>
5
cabal update
6
cabal build cardano-node cardano-cli
Copied!
Note: This is a good time to backup your current binaries (in case you have to revert to an earlier version). Something like this will work:
1
cd ~/.local/bin
2
mv cardano-cli cardano-cli-backup
3
mv cardano-node cardano-node-backup
Copied!
Now copy your newly built binaries to the appropriate directory, with:
1
cp -p dist-newstyle/build/x86_64-linux/ghc-8.10.2/cardano-node-<NEW VERSION>/x/cardano-node/build/cardano-node/cardano-node ~/.local/bin/
2
​
3
cp -p dist-newstyle/build/x86_64-linux/ghc-8.10.2/cardano-cli-<NEW VERSION>/x/cardano-cli/build/cardano-cli/cardano-cli ~/.local/bin/
Copied!
Note: It might be necessary to delete the db-folder (the database-folder) before running an updated version of the node.
QUESTIONS AND FEEDBACK
If you have any questions and suggestions while taking the lessons please feel free to ask in the forum and we will respond as soon as possible.
Last modified 6mo ago