Would you like to learn how to do a Bitcoin Lightning node installation? In this tutorial, we are going to show you how to install a Bitcoin Lightning node using a computer running Ubuntu Linux.
Hardware List:
The following section presents the list of equipment used to create this Bitcoin tutorial.
Every piece of hardware listed above can be found at Amazon website.
Bitcoin Related Tutorial:
On this page, we offer quick access to a list of tutorials related to Bitcoin.
Tutorial – Bitcoin Node Installation
First, you need to install a regular Bitcoin Node.
On the Ubuntu Linux console, use the following commands to install the BerkleyDB package:
# add-apt-repository ppa:bitcoin/bitcoin
# apt-get update
# apt-get install libdb4.8-dev libdb4.8++-dev
You must use BerkleyDB version 4.8 for everything to work.
Use the following commands to install the required libraries and the required packages:
# apt-get install libboost-all-dev libzmq3-dev libminiupnpc-dev
# apt-get install curl git build-essential libtool autotools-dev
# apt-get install automake pkg-config bsdmainutils python3
# apt-get install software-properties-common libssl-dev libevent-dev
Create a directory to the node software and download the Bitcoin package.
# mkdir /downloads
# cd /downloads
# git clone https://github.com/bitcoin/bitcoin.git
Compile and install the Bitcoin node software.
# cd bitcoin
# ./autogen.sh
# ./configure
# make
# make install
Create a Bitcoin configuration file and choose a username and a password.
# mkdir ~/.bitcoin
# vi $HOME/.bitcoin/bitcoin.conf
Here is the content of the bitcoin.conf file:
The only thing that you need to change is the username and password from the last two lines.
txindex=1
server=1
daemon=1
zmqpubrawblock=tcp://127.0.0.1:28332
zmqpubrawtx=tcp://127.0.0.1:28332
rpcuser=virtualcoin2018
rpcpassword=kamisama123
In our example, we choose the username virtualcoin2018 and the password kamisama123.
Start the Bitcoin node daemon using the following command:
# bitcoind
Wait for the synchronization of the blockchain to end.
The blockchain synchronization might take days or weeks.
Use the following command to verify the status of the blockchain synchronization:
# tail -f ~/.bitcoin/debug.log
Tutorial – Lightning Node Installation
Use the following commands to install the GO software:
# mkdir /downloads/go -p
# cd /downloads/go
# wget https://dl.google.com/go/go1.10.1.linux-amd64.tar.gz
# tar -C /usr/local -zxvf go1.10.1.linux-amd64.tar.gz
In our example, the Go software was installed under the /usr/local folder.
In order to work properly, the Go software expect the system to have a set of environment variables.
Let’s create a file to automate the required environment variables configuration.
# vi /etc/profile.d/go.sh
Here is the go.sh file content.
#/bin/bash
export GOROOT=/usr/local/go
export GOPATH=$GOROOT/work
export PATH=$PATH:$GOROOT/bin:$GOPATH/bin
Now, let’s reboot the computer.
Don’t forget to restart the bitcoin service daemon.
# reboot
# bitcoind
Use the following command to install DEP.
# go get -u github.com/golang/dep/cmd/dep
Use the following commands to install LND.
# go get -d github.com/lightningnetwork/lnd
# cd $GOPATH/src/github.com/lightningnetwork/lnd
# make
# make install
Now, let’s try to update LND to the last version.
# git pull
# make
# make install
Use the following command to test your LND installation.
# make check
Use the following command to start your lightning node.
You need to change the bitcoind.rpcuser to your bitcoin username.
You need to change the bitcoind.rpcpass to your bitcoin password.
You need to change the externalip to your node external IP address.
# lnd –bitcoin.active –bitcoin.mainnet –debuglevel=debug –bitcoin.node=bitcoind –bitcoind.rpcuser=virtualcoin2018 –bitcoind.rpcpass=kamisama123 –bitcoind.zmqpath=tcp://127.0.0.1:28332 –externalip=54.244.145.182 –noencryptwallet
Here is a list of useful commands:
# lncli getinfo
# lncli getnetworkinfo
# lncli describegraph
# lncli newaddress np2wkh
# lncli walletbalance