Install Lightning (LND) on Ubuntu Server – Upgrade your Bitcoin Node

If you prefer a video guide in order to install Lightning LND on your AMD64 machine, please see Ketan’s tutorial. This guide is based on that tutorial and is meant to serve as a companion in case you run into any issues finding links, commands, etc.

Install Lightning

  • Using the installation instructions from https://raspibolt.org/guide/lightning/lightning-client.html we will install LND
  • Don’t use the link from raspibolt for your version of LND since that is for an arm based machine. If you are running an AMD64 go here to find latest release of LND: https://github.com/lightningnetwork/lnd/releases/
  • Scroll down until you find the Assets section. Find your version for the hardware you are running. If you are installing on a dell optiplex machine the version you want has ‘amd64’ in it.
  • Download into your downloads directory with [cd downloads] then [wget <link to LND version>]
  • Now using the instructions from the raspibolt.org page we can download the PGP file  and verify
  • When you’ve verified the release, unzip the file [tar -xzf lnd-linux-amd64-v0.14.3-beta.tar.gz]
  • Install with this [sudo install -m 0755 -o root -g root -t /usr/local/bin lnd-linux-amd64-v0.14.3-beta/*]
  • After install you need to setup a .conf file. Go to this github page to download an example and then we can edit that https://raw.githubusercontent.com/lightningnetwork/lnd/master/sample-lnd.conf
  • In your home directory create a directory called .lnd using [mkdir .lnd] and use [ll] to confirm it is there
  • Use [wget https://raw.githubusercontent.com/lightningnetwork/lnd/master/sample-lnd.conf] to copy that file to your .lnd directory. [ls] to confirm it is there.
  • Rename that file using [mv sample-lnd.conf lnd.conf]
  • This is a giant file. Edit the settings. In order to ‘activate’ a line the semi-colon must be removed.
    • From [; tlsextraip=] to [tlsextraip=.0.0.0.0]
    • [; tlsextradomain=] to [tlsextradomain=.0.0.0.0]
    • [;   listen=0.0.0.0:9735] remove the semi-colon to activate
    • [;   rpclisten=localhost:10009] remove the semi-colon
    • [;   restlisten=0.0.0.0:8080] remove the semi-colon
    • [;  alias=My Lightning] to [alias=<NAME YOUR LIGHTNING NODE>]
    • [; bitcoin.mainnet=true] to [bitcoin.mainnet=true]
    • [bitcoin.simnet=true] put a semi-colon in front of it to de-activate
    • [bitcoin.node=btcd] de-activate with the semi-colon
    • [; bitcoin.node=bitcoind] remove the semi-colon to activate
    • Scrolling down until you see Bitcoind settings
    • [; bitcoind.rpcuser=kek] remove the semi-colon and change to your username for bitcoind
    • Same for the password line
    • Remove the semi colons from both of these lines:
    • ; bitcoind.zmqpubrawblock=tcp://127.0.0.1:28332
    • ; bitcoind.zmqpubrawtx=tcp://127.0.0.1:28333
  • Control x, y, enter to save the file and return to the command line
  • Run lnd with the command [lnd]
  • Open a new terminal window and login
  • Type the command [lncli create]
  • It will ask for a password, enter a strong one to login to lightning. Later this will be the password to login to Ride the Lightning
  • It will ask you to confirm password
  • It will ask if you have an existing seed, or if you want to create a fresh wallet for this lightning instance. Choose your options
  • Create a password.txt file in your .lnd directory with [cd .lnd] and [nano password.txt] and put your lightning password in there.
  • Edit the lnd.conf file with [sudo nano lnd.conf]
  • Find the below two lines in the lnd.conf file and edit them
    • change [; wallet-unlock-password-file=/tmp/example.password] to [wallet-unlock-password-file=/home/<YOURUSERNAME>/.lnd/password.txt
    • change [; wallet-unlock-allow-create=true] remove the semi-colon
  • Scroll down to the tor settings
  • [; tor.active=true] remove the semi-colon
  • [; tor.streamisolation=true] remove the semi-colon
  • [; tor.v3=true] remove the semi-colon
  • Control x, y , enter to save and exit back to terminal
  • Stop lnd using the terminal that is running lnd using control c
  • Type [lnd] to start it up again
  • We will use this link to create a service file in order to boot lnd on restart: https://raw.githubusercontent.com/lightningnetwork/lnd/master/contrib/init/lnd.service
  • Go to directory cd /etc/systemd/system with [cd cd /etc/systemd/system]
  • Now [sudo wget https://raw.githubusercontent.com/lightningnetwork/lnd/master/contrib/init/lnd.service]
  • In the terminal that is running lnd, stop with Control c
  • Edit the service file with [sudo nano lnd.service]
  • Scroll down to the ‘Service’ area and change the user and group to your node’s username
  • Control x, y, enter to save and exit back to terminal
  • Start up again with [sudo systemctl start service.lnd]
  • Check status with [sudo systemctl start service.lnd]

In the other terminal window check that lnd is running with [journalctl -fu lnd.service]

If all went well you should have LND running on your node. Next we will move on to installing Ride the Lightning so that you can start opening channels using a GUI.