Launch a Virtual Machine

Cardano nodes run on standard computers that always need to be connected to the internet. The nodes can be run from a cloud service provider, your home, or anywhere else where you have a stable internet connection and a "reasonably" fast computer.

It is best to run Cardano Node starting from a clean environment and have everything installed fresh. For this, we will use a new Virtual machine running on Contabo.

Table of Content

Setting up VirtualBox

We will choose the "Cloud VPS M" if the workshop host has not given you a virtual machine. You can use any other cloud provider as long as the machine satisfies the following minimum prerequisites:

  • Operating system: 64-bit Linux (i.e. Ubuntu Server 20.04 LTS)
  • Processor: A processor with two or more cores, at 2GHz or faster
  • Memory: 16GB RAM
  • Storage: 150GB free storage
  • Internet: Broadband connection supporting speeds at least 10 Mbps
  • Data Plan: at least 1GB per hour. 720GB per month.

Create a new user

SSH into your server

ssh username@server.public.ip.address
# example
# ssh myUsername@77.22.161.10

Create a new user called cardano and set a password

useradd -m -s /bin/bash cardano
passwd cardano
usermod -aG sudo cardano

Generate a new SSH key

Generate a new SSH key for the cardano user and transfer it to the server. Run the following command on your local machine to generate the key

ssh-keygen -t ed25519

Transfer the public key to your remote node. Update the <keyname>.

ssh-copy-id -i $HOME/.ssh/<keyname>.pub cardano@server.public.ip.address

Log-in with your new cardano user using the newly generated SSH key

ssh-copy-id -i $HOME/.ssh/<keyname>.pub cardano@server.public.ip.address

If you want to use this server in a production environment, then make sure to make some additional adjustments to secure the server as described in this article.

Update your system

Update your system to get the latest version of the software. In a production environment, this is something that you should do periodically (e.g. once every quarter, or when you need to upgrade your Cardano node)

sudo apt-get update -y && sudo apt-get upgrade -y
sudo apt-get install git jq bc make automake rsync htop curl build-essential pkg-config libffi-dev libgmp-dev libssl-dev libtinfo-dev libsystemd-dev zlib1g-dev make g++ wget libncursesw5 libtool autoconf -y

Configure Firewall

The standard UFW firewall can control network access to your node. With any new installation, ufw is disabled by default. Enable it with the following settings.

# By default, deny all incoming and outgoing traffic
sudo ufw default deny incoming
sudo ufw default allow outgoing
# Allow ssh access
sudo ufw allow ssh #<port 22 or your random ssh port number>/tcp
# Allow cardano-node p2p port
sudo ufw allow 6000/tcp
# Enable firewall
sudo ufw enable
# Verify status
sudo ufw status numbered

Ensure your server time is in sync

Set-up and configure chrony

sudo apt-get install chrony -y

To create the chrony.conf config file, copy and paste the following:

cat > $HOME/chrony.conf << EOF
pool time.google.com       iburst minpoll 1 maxpoll 2 maxsources 3
pool ntp.ubuntu.com        iburst minpoll 1 maxpoll 2 maxsources 3
pool us.pool.ntp.org     iburst minpoll 1 maxpoll 2 maxsources 3

# This directive specify the location of the file containing ID/key pairs for
# NTP authentication.
keyfile /etc/chrony/chrony.keys

# This directive specify the file into which chronyd will store the rate
# information.
driftfile /var/lib/chrony/chrony.drift

# Uncomment the following line to turn logging on.
#log tracking measurements statistics

# Log files location.
logdir /var/log/chrony

# Stop bad estimates upsetting machine clock.
maxupdateskew 5.0

# This directive enables kernel synchronisation (every 11 minutes) of the
# real-time clock. Note that it can’t be used along with the 'rtcfile' directive.
rtcsync

# Step the system clock instead of slewing it if the adjustment is larger than
# one second, but only in the first three clock updates.
makestep 0.1 -1
EOF

Move the file to /etc/chrony/chrony.conf/etc/chrony/chrony.conf and start chrony

sudo mv $HOME/chrony.conf /etc/chrony/chrony.conf
sudo systemctl restart chronyd.service

References

Preparing the Environment for Cardano Node - CoinCashew

License

This work is distributed under a Creative Commons Attribution 4.0 International (CC BY 4.0) The license allows you to copy and redistribute the material in any medium or format, as well as remix, transform, and build upon the material for any purpose, including commercial, as long as you give appropriate credit to the creator.