How-to: Bitcoin Full Node on Ubuntu 22.04

Published: 12 August 2022
on channel: Philip D'Ath
8,598
186

In this video, I talk about how to install and configure a Bitcoin full node using a snap on Ubuntu 22.04.

One important thing I left out of the video is you need to go onto your Internet router and port forward tcp/8333 to your node to allow inbound Bitcoin node connections.

** Since I recorded the video I've made some tweaks to the log rotation so the below doesn't exactly match the video. **

The basic steps are:

= Prep OS and install bitcoin core software
sudo su
apt update
apt upgrade
snap install bitcoin-core

= Create an account to run Bitcoin core in even more isolation from the rest of the system
groupadd btc
useradd -g btc -m -s /bin/bash btc
su - btc

= Do a test run:
bitcoin-core.daemon
== If no errors then after 30s:
ctrl-c
tail ~/snap/bitcoin-core/common/.bitcoin/debug.log

= Create the configuration file:
cd ~/snap/bitcoin-core/common
mkdir .bitcoin
vi .bitcoin/bitcoin.conf
externalip=121.98.x.x
externalip=2404:4408:x:x::x
listenonion=0
disablewallet=1
dbcache=2048

= If you created a config file then do another test run:
bitcoin-core.daemon
== If no errors then after 30s:
ctrl-c
tail ~/snap/bitcoin-core/common/.bitcoin/debug.log


= Now setup to run as a daemon:
== Become root again:
exit

vi /etc/systemd/system/bitcoind.service
[Unit]
Description=Bitcoin daemon
After=network.target
Wants=network-online.target

[Service]
User=btc
Group=btc
Type=forking
PIDFile=/home/btc/snap/bitcoin-core/common/.bitcoin/bitcoin.pid
ExecStart=/snap/bin/bitcoin-core.daemon -daemon -pid=bitcoin.pid
KillMode=process
Restart=always
TimeoutSec=120
RestartSec=30

[Install]
WantedBy=multi-user.target

== Enable and start service
systemctl daemon-reload
systemctl enable bitcoind.service
systemctl start bitcoind.service
systemctl status bitcoind.service
journalctl -xeu bitcoind.service

= Setup log rotation of debug log
vi /etc/logrotate.d/bitcoind
/home/btc/snap/bitcoin-core/common/.bitcoin/debug.log
{
su btc btc
missingok
notifempty
compress
delaycompress
sharedscripts
copytruncate
}

== Check logrotation service is correctly configured
sudo systemctl restart logrotate.service
sudo systemctl status logrotate.service



= Check Bitcoin Daemon
su - btc

bitcoin-core.cli -netinfo
bitcoin-core.cli getnetworkinfo
bitcoin-core.cli getblockchaininfo
bitcoin-core.cli getpeerinfo

tail ~/snap/bitcoin-core/common/.bitcoin/debug.log

= This shows disk space used - should grow to begin with, currently 450GB "all up" for me
du -h ~/snap/bitcoin-core/common/.bitcoin/


#bitcoin #ubuntu #howto

Video Content
00:00 Intro
00:11 Why run a Bitcoin full node?
00:51 Requirements
02:22 CPU Load
02:34 Initial setup prep
04:06 Setup separate user to run software
04:32 Initial test run
04:52 Creating a config file
07:28 Create a systemd service
09:39 Setting up log rotation
11:15 Checks and troubleshooting


Watch video How-to: Bitcoin Full Node on Ubuntu 22.04 online without registration, duration hours minute second in high quality. This video was added by user Philip D'Ath 12 August 2022, don't forget to share it with your friends and acquaintances, it has been viewed on our site 8,59 once and liked it 18 people.