The Lightning Network enables fast, low-fee Bitcoin transactions through payment channels. This guide covers setting up LND (Lightning Network Daemon), one of the most widely-used Lightning implementations, on a VPS.
Prerequisites
- A fully synced Bitcoin full node already running (see How to Run a Bitcoin Full Node on a VPS)
- Ubuntu 22.04/24.04 VPS: 2 vCPU, 4 GB RAM minimum (in addition to what the underlying Bitcoin node needs)
Step 1 — Install Go (Required to Build LND)
wget https://go.dev/dl/go1.22.linux-amd64.tar.gz
sudo tar -C /usr/local -xzf go1.22.linux-amd64.tar.gz
echo 'export PATH=$PATH:/usr/local/go/bin' >> ~/.bashrc
source ~/.bashrc
Check the current recommended Go version in LND's official documentation.
Step 2 — Download and Build LND
git clone https://github.com/lightningnetwork/lnd.git
cd lnd
git checkout v0.18.0-beta
make install
Always checkout a specific tagged release rather than the main branch for production use.
Step 3 — Create LND Configuration
mkdir ~/.lnd
nano ~/.lnd/lnd.conf
[Application Options]
alias=YourNodeName
[Bitcoin]
bitcoin.active=1
bitcoin.mainnet=1
bitcoin.node=bitcoind
[Bitcoind]
bitcoind.rpcuser=YOUR_BITCOIN_RPC_USER
bitcoind.rpcpass=YOUR_BITCOIN_RPC_PASSWORD
bitcoind.zmqpubrawblock=tcp://127.0.0.1:28332
bitcoind.zmqpubrawtx=tcp://127.0.0.1:28333
These credentials must match your existing Bitcoin Core node's RPC configuration.
Step 4 — Enable ZMQ on Your Bitcoin Node
Add to your existing bitcoin.conf if not already present:
zmqpubrawblock=tcp://127.0.0.1:28332
zmqpubrawtx=tcp://127.0.0.1:28333
bitcoin-cli stop
bitcoind
Step 5 — Start LND and Create a Wallet
lnd
lncli create
Follow the prompts to set a wallet password and securely back up the generated seed phrase — this seed is the only way to recover funds if the node is lost.
Step 6 — Check Node Status
lncli getinfo
Step 7 — Fund Your Node's On-Chain Wallet
lncli newaddress p2wkh
Send Bitcoin to this address before opening any Lightning channels, since channels require on-chain funds to open.
Step 8 — Open Your First Channel
lncli connect PEER_PUBKEY@PEER_IP:9735
lncli openchannel PEER_PUBKEY CHANNEL_SIZE_IN_SATOSHIS
Allowing the Lightning P2P Port
sudo ufw allow 9735/tcp
Backing Up Channel State (Critical)
Beyond the seed phrase, regularly back up your channel state (channel.backup file) — losing this without a proper recovery process can result in loss of funds locked in open channels, even with the seed phrase intact.
Common Errors
"unable to synchronize wallet to chain" — verify your underlying Bitcoin node is fully synced and the RPC credentials in lnd.conf exactly match your bitcoin.conf.
Channel won't open — verify sufficient on-chain balance exists and the peer is actually reachable at the specified address/port.
Continue Reading
- How to Run a Bitcoin Full Node on a VPS
- How to Secure a Cryptocurrency Node on a VPS
- Running a Crypto Wallet Backend Securely on a VPS
Browse more articles in Cryptocurrency & Blockchain Node Hosting.