Install your own instance of BTCPay Server on Ubuntu Server – Upgrade your Bitcoin Node

If you prefer video and don’t need help to install your own BTCPay Server instance on Ubuntu server, see this video for instructions. Use the below text as a way to help when you run in to something you don’t understand.

Install BTCPay Server

wget -O packages-microsoft-prod.deb

  • Install more software with:

sudo dpkg -i packages-microsoft-prod.deb

  • Remove a file that you no longer need:

rm packages-microsoft-prod.deb

  • Check for software updates:

sudo apt-get update

  • Install this package:

sudo apt-get install -y apt-transport-https

  • Check for updates to that package with:

sudo apt-get update

  • Install the .net package

sudo apt-get install -y dotnet-sdk-6.0

  • Next we install a database

sudo apt install postgresql postgresql-contrib

  • Change to user postgres with:

sudo -i -u postgres

  • Create a new user with:
createuser --pwprompt --interactive
  • You will be prompted to enter a username for this. Use whatever you’d like and make sure to take note of it.
  • You will be prompted to enter a password. It should be a secure password that you will remember.
  • You will be asked if this should be a ‘superuser’ – say no.
  • You will be asked if this user should be able to create a database – say yes.
  • You will be asked if this user should be able to create new roles – say no.
  • Create two databases, one for BTCPay Server and one for NBXplorer

createdb -O <the username you picked above> btcpayserver

createdb -O <the username you picked above> nbxplorer

  • Type command [exit] to get out of that username. You should be back in your downloads folder.
  • cd into your home directory with [cd ~]
  • Clone NBXplorer with the command:

git clone

  • cd into NBXplorer with:

cd NBXplorer

  • Build NBXplorer with:


  • Create data directory in your home folder

mkdir -p ~/.nbxplorer/Main

  • cd into that using

cd ~/.nbxplorer/Main

  • Create a settings file

nano settings.config

  • Past this into the file:
btc.rpc.auth=<bitcoind rpc user>:<bitcoind rpc password>
postgres=User ID=<your db user>;Password=<your db password>;Host=localhost;Port=5432;Database=nbxplorer;
  • Change the bitcoin user to your bitcoind username, same with password. Also fix the postgres username and password you setup above. Control x, y, enter to save and exit
  • Back to the NBXplorer directory using: [cd ~]
  • Then cd into nbxplorer directory using [cd NBXplorer]
  • Run it using


  • You should see NBXplorer syncing up
  • Hit ‘control c’ to close it
  • Now we make a file to auto-start NBXplorer whenever the machine boots
  • cd into [cd /etc/systemd/system]
  • Paste this command into terminal:

sudo wget

  • Edit that file with command

Sudo nano nbxplorer.service

  • Edit the line that starts with ExecStart and find that part that says “netcoreapp2” to “net6.0”. Also remove the word /source from the filepath. Ensure username is accurate. Freedomnode uses ‘satoshi’ as the username, you may have changed that.
  • An example of that line: ExecStart=/usr/bin/dotnet “/home/<username>/NBXplorer/NBXplorer/bin/Release/net6.0/NBXplorer.dll” -c /home/<username>/.nbxplorer/Main/settings.config
  • Change User and Group to your username.
  • Control x, y, enter to save and leave
  • Enable this using:

sudo systemctl enable nbxplorer.service

  • Start it:

sudo systemctl start nbxplorer.service

  • Check status:

sudo systemctl status nbxplorer.service

  • You should see a green dot showing NBXplore is up and running
  • Now we install BTCPay Server
  • Open a new terminal window and login to your node
  • In your home directory install BTCPay server

git clone

  • cd into btcpayserver using:

cd btcpayserver

  • Build it with:


  • Make another directory:

mkdir -p ~/.btcpayserver/Main

  • cd into it:

cd ~/.btcpayserver/Main

  • Create a config file:

nano settings.config

  • Add these lines to it and change your username and pass to match what you entered for the postgres install:
#BTC.lightning=type=lnd-rest;server=;macaroonfilepath=~/.lnd/data/chain/bitcoin/mainnet/admin.macaroon;certthumbprint=<finger print>
postgres=User ID=<yourusername>;Password=<your db password>;Host=localhost;Port=5432;Database=btcpayserver;
  • Go to home directory using

Cd ~

  • cd into btcpay server folder using

cd btcpayserver

  • Run it


  • Use a web browser to visit your ip address with :23001 at the end to see btcpay server running
  • Now we edit a service file

cd /etc/systemd/system

  • Now we download BTCPay service file:

sudo wget

  • Edit the file using

sudo nano btcpayserver.service

  • Fix the file path to remove the /source part
  • Fix the username in the file path also
  • Fix the user to match what you made
  • Fix the group to match you username
  • Enable the service:

sudo systemctl enable btcpayserver.service

  • Start it
sudo systemctl start btcpayserver.service
  • Check status:
sudo systemctl status btcpayserver.service