Ubuntu Server Setup for a Blockchain Node

Ubuntu Server Setup for a Blockchain Node

Published
AuthorDevansh

A blockchain node is only as safe as the server under it. Most node compromises do not start with the chain client. They start with a default root login, an open RPC port, or an unpatched server that nobody checked for months. This post is the setup to do before you install any node software: pick the right Ubuntu release, create a non-root user, lock down SSH, open only the ports the node needs, lay out disk and swap, and turn on automatic security updates. Do it once, do it in this order, and the node you install on top starts from a solid base.

This is the prequel to our validator on Ubuntu guide and our VPS in India guide. Those cover the node itself. This post covers the server it runs on. If you already have a server running, work through the checklist anyway - it takes an hour, and it catches the defaults people forget.

Pick the release first

Always run an LTS release on a server. LTS means Long Term Support: five years of standard security updates, with longer coverage available through Ubuntu Pro. As of November 2026 the two live LTS releases are Ubuntu 24.04, with standard support until May 2029, and Ubuntu 26.04, released in April 2026 with standard support until May 2031. The first 26.04 point release, 26.04.1, shipped in late August 2026, and LTS-to-LTS upgrades from 24.04 are now open. For a fresh install, 26.04 is the sensible default: it gives you two more years of support and a newer toolchain. For a production server that is already stable on 24.04, there is no reason to rush - 24.04 is supported until May 2029. Do not start a new node on 22.04, whose standard support ends in May 2027, and do not run 20.04 at all: its standard support ended in May 2025. Whatever you pick, confirm the dates on Canonical's release page on the day, and keep the OS patched.

Create a non-root user

Never run a node as root. A process running as root that gets compromised hands over the whole machine. Create a dedicated user, give it sudo, and do everything else as that user. On a fresh server, logged in as root:

adduser deploy
usermod -aG sudo deploy

Set a strong password for the new user, then add your SSH public key to its authorized keys file so you can log in without a password. Test the new login in a second terminal before you close the root session. If the key login fails, you still have root open to fix it. If you close root first and the key is wrong, you are locked out and the fix is a provider console or a rebuild.

Lock down SSH

SSH is the front door, and bots knock on it all day. Three changes close most of the risk: key-only login, no root login, and a firewall that only exposes SSH to the world. Edit the SSH daemon config, usually at /etc/ssh/sshd_config, and set these three lines:

PasswordAuthentication no
PermitRootLogin no
PubkeyAuthentication yes

Then restart SSH and test the new login in a second terminal before closing your current session:

sudo systemctl restart ssh
sudo systemctl status ssh

Changing the SSH port from 22 to something else cuts log noise but is not real security - a scanner finds it in seconds. Treat it as optional tidiness, not a defence. If you want a real second layer, install fail2ban, which bans IPs after repeated failed logins. Key-only login plus no root login is the pair that matters.

Firewall: open only what the node needs

Ubuntu ships with UFW, a simple firewall frontend. The rule is simple: deny everything, then allow only the ports the node needs. For most chain clients that means SSH and the P2P port, and nothing else. The RPC port must never be open to the internet - an open RPC port is how wallets and funds get drained. If your app needs RPC, bind it to localhost and reach it through SSH or a private network.

sudo ufw default deny incoming
sudo ufw default allow outgoing
sudo ufw allow OpenSSH
sudo ufw allow 30303/tcp
sudo ufw enable
sudo ufw status verbose

Port 30303 is the Ethereum P2P default - replace it with your chain's P2P port. Check the chain docs for the exact number, and open UDP as well if the client needs it. After enabling UFW, verify from another machine that only the intended ports answer. A firewall you never test is a firewall you are guessing about.

Disk layout and swap

Chain data grows forever, so give it its own volume. If chain data shares the system disk, a full chain can fill the root filesystem and stop the whole server, including SSH and logging. Mount a separate data volume at /data, point the client at it, and keep the system disk for the OS and logs. Check what you have before you start:

lsblk
df -h
free -h

Add swap if the machine has little RAM - 2 to 4 GB of swap file is a reasonable safety net for a small node, and it stops the out-of-memory killer from taking the client during a sync spike. Our node cost guide explains how to size the disk itself, including why an Ethereum full node needs about 2 TB and an archival node needs far more. Size the volume for the chain in six months, not the chain today.

Updates and unattended upgrades

An unpatched server is a countdown. Install security updates automatically so a missed week does not become a missed month. Update the package lists, apply everything pending, then install and enable unattended upgrades:

sudo apt update && sudo apt upgrade -y
sudo apt install -y unattended-upgrades
sudo dpkg-reconfigure -plow unattended-upgrades

Unattended upgrades install security patches, not every package update, so they rarely break a running node. Client upgrades are different - a chain client upgrade can change sync behaviour, so test those on a testnet node first and snapshot before you apply them. The OS should patch itself. The node should be upgraded deliberately, by a human, with a rollback plan.

Pre-flight checklist before you install the node

Run through this list before any node software touches the machine. One, the release is 24.04 or 26.04 LTS, confirmed on Canonical's page. Two, you log in as a non-root user with an SSH key, root login is off, and password login is off. Three, the firewall allows SSH and the chain's P2P port and nothing else, and the RPC port is not reachable from the internet. Four, chain data has its own volume with at least 30 percent headroom over today's chain size. Five, unattended upgrades are on, and you know where the logs go. Six, you have a snapshot or backup of the clean server, taken before the node install, so a bad install is a restore, not a rebuild. If all six are true, install the node. If any one is false, fix it first - every shortcut here becomes an incident later, usually at the worst time.

A hardened server is boring, and boring is the goal. The node on top gets the attention; the server underneath should just keep working, patched, and closed to everyone except you. If you want this setup done for a launch, or an audit of servers you already run, book a free infra audit with DevOpsBY. We set up and operate nodes, RPC, and validator infrastructure for Web3 teams, and a one-hour server review is usually enough to find the open port or the missing patch that matters.

Disclaimer: This post is educational only, not financial advice. Figures are listing or project data as of 2026-11-09 and may change - always confirm version numbers, requirements, and dates in the official docs before acting on them.

Related Articles

DevOps & Infrastructure Services

Need hands-on help? We build and manage the infrastructure behind the concepts covered in this article.

DevOpsBy Assistant

How can we help?

Select a topic to get started: