Time: 5 minutes

Having two terminals open is irritating. You want LND running in the background, just like bitcoind.

sudo nano /etc/systemd/system/lnd.service

Paste this in there.

Description=Lightning Network Daemon

Save it again with Ctrl + X and confirm with Y.

The system should be notified of the new service and can then be started.

sudo systemctl enable lnd
sudo systemctl start lnd

If you want to see if everything started up properly, run this:

systemctl status lnd

The output should look something like this:

lnd.service - Lightning Network Daemon
Loaded: loaded (/etc/systemd/system/lnd.service; enabled; vendor preset: enabled)
Active: active (running) since Sat 2022-01-15 11:19:18 UTC; 1min 24s ago
Main PID: 73287 (lnd)
Tasks: 9 (limit: 4203)
CGroup: /system.slice/lnd.service
└─73287 /home/ubuntu/go/bin/lnd
Nov 25 17:45:10 raspberrypi systemd[1]: Started Lightning Network Daemon.

Press q to exit the screen again.

If you want an overview of the status over multiple sessions, use this:

sudo journalctl -f -u lnd

To finish up, you have to unlock LND with your password just like before. The nice thing is that now you don't have to have two terminals open. With lncli unlock everything is completed.