This guide walks through setting up a self-hosted Bitcoin Lightning payment stack on a Linux server. No third parties, no KYC, no middleman.
Stack: BlueWallet (mobile) ↔ LNbits (accounts layer) ↔ Phoenixd (Lightning daemon) ↔ Lightning Network
Read the complete guide with images in the blog post →
Quick Summary
| Step | What You Do | Time |
|---|---|---|
| 1 | Install Docker + Docker Compose | 5 min |
| 2 | Install Phoenixd (Lightning daemon) | 5 min |
| 3 | Deploy LNbits with Docker Compose | 5 min |
| 4 | Create your admin account | 2 min |
| 5 | Install extensions | 3 min |
| 6 | Configure HTTPS | 5 min |
| 7 | Connect BlueWallet | 3 min |
1. Install Docker
curl -fsSL https://get.docker.com | sudo bash
sudo usermod -aG docker $USER
newgrp docker # or log out and back in2. Install Phoenixd
mkdir -p ~/phoenixd && cd ~/phoenixd
V=$(curl -s https://api.github.com/repos/ACINQ/phoenixd/releases/latest | grep tag_name | cut -d'"' -f4 | sed 's/^v//')
wget "https://github.com/ACINQ/phoenixd/releases/download/v$V/phoenixd-$V-linux-x86_64.zip"
sudo apt install -y unzip && unzip "phoenixd-$V-linux-x86_64.zip"
sudo mv phoenixd /usr/local/bin/
mkdir -p ~/.phoenix
# Create systemd service
sudo tee /etc/systemd/system/phoenixd.service > /dev/null << 'EOF'
[Unit]
Description=Phoenixd Lightning Daemon
After=network.target
[Service]
Type=simple
User=$(whoami)
ExecStart=/usr/local/bin/phoenixd
Restart=on-failure
RestartSec=10
[Install]
WantedBy=multi-user.target
EOF
sudo systemctl daemon-reload && sudo systemctl enable --now phoenixd3. Get Your Phoenixd Password
grep phoenixd.api-password ~/.phoenix/phoenix.conf4. Deploy LNbits
mkdir -p ~/lnbits && cd ~/lnbitsCreate ~/lnbits/docker-compose.yml:
version: '3.8'
services:
lnbits:
image: lnbits/lnbits:latest
restart: unless-stopped
ports:
- "0.0.0.0:5000:5000"
extra_hosts:
- "host.docker.internal:host-gateway"
environment:
- LNBITS_DATA_FOLDER=/data
- LNBITS_BACKEND_WALLET_CLASS=PhoenixdWallet
- PHOENIXD_API_ENDPOINT=http://host.docker.internal:9740
- PHOENIXD_API_PASSWORD=YOUR_P...RE
- LNBITS_SITE_TITLE=My Lightning Server
- LNBITS_SITE_TAGLINE=Bitcoin and Freedom Tech
- LNBITS_ADMIN_EXTENSIONS=true
- LNBITS_DEFAULT_WALLET_NAME=Main Wallet
volumes:
- lnbits_data:/data
depends_on:
postgres:
condition: service_healthy
postgres:
image: postgres:16-alpine
restart: unless-stopped
environment:
- POSTGRES_USER=lnbits
- POSTGRES_PASSWORD=*** - POSTGRES_DB=lnbits
volumes:
- postgres_data:/var/lib/postgresql/data
healthcheck:
test: ["CMD-SHELL", "pg_isready -U lnbits"]
interval: 5s
timeout: 5s
retries: 10
volumes:
lnbits_data:
postgres_data:Insert your phoenixd password and start:
PASS=$(grep phoenixd.api-password ~/.phoenix/phoenix.conf | cut -d= -f2 | xargs)
sed -i "s/YOUR_PHOENIXD_PASSWORD_HERE/$PASS/" docker-compose.yml
docker compose up -d5. Create Admin Account
Visit http://YOUR_SERVER_IP:5000 in a browser, click Create an Account, choose a username and password. Then:
# Get your User ID from the profile page (the hex string), then:
nano ~/lnbits/docker-compose.ymlAdd under environment::
- LNBITS_ADMIN_USERS=YOUR_USER_ID_HEREcd ~/lnbits && docker compose down && docker compose up -d6. Connect BlueWallet
Open BlueWallet → + → Lightning → LNDHub → enter:
- URL:
https://your-server.com/lndhub/ext/ - Username & password from step 5
Need the full walkthrough with screenshots, extension setup, HTTPS, and troubleshooting?
Read the complete illustrated guide at Run Your Own Lightning Payment Server →