Skip to content

BTCPayServer Setup on Ubuntu

Dan Janosik edited this page Sep 9, 2020 · 4 revisions

Running on Ubuntu

  1. Install .NET

     wget -q https://packages.microsoft.com/config/ubuntu/20.04/packages-microsoft-prod.deb
     sudo dpkg -i packages-microsoft-prod.deb
     sudo apt-get install apt-transport-https
     sudo apt-get update
     sudo apt-get install -y dotnet-sdk-3.1
    
  2. Install and run NBXplorer

     git clone https://github.com/dgarage/NBXplorer
     cd NBXplorer
     ./build.sh
     vim ~/.nbxplorer/Main/settings.config
    
     # Add RPC username password:
     btc.rpc.user=username
     btc.rpc.password=password
    
     nohup ./run.sh > out.log &
    
  3. Install and run BTCPayServer

     git clone https://github.com/btcpayserver/btcpayserver
     cd btcpayserver
     ./build.sh
    
     # By default lnd binds to 8080, so use 8081
     nohup ./run.sh --port 8081 --bind 0.0.0.0 > out.log &
    
  4. Install LetsEncrypt cert:

    wget https://raw.githubusercontent.com/janoside/bitcoin-resources/master/files/btcpay-nginx-config.txt
    mv btcpay-nginx-config.txt /etc/nginx/sites-available/btcpay.btc21.org
    cd /etc/nginx/sites-enabled/
    ln -s ../sites-available/btcpay.btc21.org .
    service nginx restart
    certbot --nginx -d btcpay.btc21.org
    service nginx restart
    

Optional:

If you're running LND - configure a store and go to its settings and down to Lightning Nodes

# get admin macaroon hex
xxd -plain /root/.lnd/data/chain/bitcoin/mainnet/admin.macaroon | tr -d '\n'

# get cert thumbprint
openssl x509 -noout -fingerprint -sha256 -in /root/.lnd/tls.cert | sed -e 's/.*=//;s/://g'

Then configure the lightning node with:

type=lnd-rest;server=https://127.0.0.1:8080/;macaroon=MACAROON_HEX;certthumbprint=CERT_THUMBPRINT

Optional:

vim /etc/systemd/system/nbexplorer.service
sudo systemctl enable nbxplorer.service
sudo service nbxplorer start
sudo service nbxplorer status

vim /etc/systemd/system/btcpayserver.service
sudo systemctl enable btcpayserver.service
sudo service btcpayserver start
sudo service btcpayserver status