liongrass / May 2023 (1222 Words, 7 Minutes)
Prepare your own device
In this step we are going to acquire and prepare a device that we later want to run our Lightning Network node on.
Great sample devices:
- Used laptop such as a Lenovo ThinkPad
- Refurbished desktop computer such as a Dell Precision Workstation
- Mini-PC such as a Beelink Mini
- Raspberry Pi or Rock Pi, although they tend to be in short supply at the moment, and as a result, far more expensive than more powerful hardware.
For the installation process we will need a screen and keyboard. Once we have set up our device, these can be disconnected. A screen and keyboard are not required for raspberry pis or devices specifically intended to be run as servers.
We are very flexible as to our requirements. More RAM will will let you handle more channels, more CPU power will let you sync the blockchain faster. We will need about 20GB of space for the Bitcoin blockchain alone, plus about 20GB of storage for the operating system, Lightning and eventual side applications and tools.
Most importantly: We will need to be able to access the BIOS of the machine to install Linux on it. While it is possible to run a Lightning Node on Windows, Mac OS or OpenBSD, this should only be done by enthusiasts of these operating system. When buying a used device, make sure you can access the BIOS before concluding the purchase! Some devices may have their BIOS locked with a password or otherwise inaccessible.
Absolute minimum requirements:
- 2GB of RAM
- 1 GHz quad core
- 20GB of storage
- 4GB of RAM
- 2 GHz six core
- 256GB SSD
We recommend running your node on a Linux-based operating system.
Great choices for operating systems are Ubuntu and Debian, as most packages we are going to make use of are readily available on these systems. On a Raspberry Pi you may use Raspbian or Ubuntu.
To install Ubuntu, we will first need to make a live USB.
- We will need a USB drive with at least 4GB of space (8GB is better). This can be any USB except for one made by Sandisk.
- We are going to download Rufus for Windows. If you are already using Ubuntu or Mac OS X, you do not need to download additional software.
- The Ubuntu installation file can be found here. We recommend downloading Ubuntu 22.04 LTS.
- We will need to temporarily
To install Ubuntu on your spare machine, you will need to access the BIOS. This is typically done by pressing a specific button, such as the Enter button, F1 or F12 at startup. The startup screen should be able to give you a hint as to which button to press. Searching for “Access BIOS” together with your make and model number will also typically yield helpful results. ChatGPT can help here, too.
Next, we will plug in the live USB we created in the previous step and instruct the BIOS to boot from it. Often this is called “temporary boot partition.” We should now be able to confirm our selection, which should let us leave BIOS and boot into Ubuntu.
Finally, we are going to follow the instructions on screen. These include setting our time zone, a name for our device and user, as well as a password. We recommend to install the operating system on the entire partition. This will wipe everything on the hard disk, so be prepared. We do not recommend running Ubuntu alongside Windows for the purpose of a Lightning Network node.
As part of the installation process, we can also already connect the computer to the internet and apply all recent updates.
In this step, we are going to get ready to access our device from our personal computer via SSH. To do that, we are going to first create an SSH key. We recommend you creating a new SSH key, in case you will later need to revoke it or exchange it.
Create an SSH key on your personal machine
In Mac OS X, Windows or Linux we are going to open a terminal for the first time and execute the following.
We are typically asked for a name for this key, for example
nodekey_rsa. You may optionally choose a passphrase for this key, meaning you will have to enter this passphrase everytime you log into your machine. Your public key will be called
newkey_rsa.pub and it will be saved in the following location:
C:\Documents and Settings\userName\Application Data\SSH\UserKeys\newkey_rsa.pub
Save this file on a USB stick, we are going to carry it over to our node later.
Configure SSH access on your Ubuntu machine
First we will need to make sure the SSH server is installed. On our node, we are going to open a terminal and type:
sudo apt update sudo apt install openssh-server
Next, we will need need to authorize our new SSH key to access the node. We can do this with the command line, or in the graphical user interface.
Open a terminal and edit the
authorized_keys file. If the file is not there, this command will also create it.
We will paste our SSH key from the step above into this file into line one. It will look like this
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQD5GTA4m8[...]M810pRF88pgY255H/KUmL77PHiMTom+1n2Levmi6M0= user@device
We will save this file by pressing
Enter and exit the application with
Open the files explorer (called Nautilus or Files), typically found on the top left of the screen, or by searching for Files.
By default you should be in your Home folder. To display hidden folders, press
H on your keyboard, you should see a folder named
Now we plug our USB with the ssh into our node, rename the public key
authorized_keys (without a dot or file extension in the end), and place it into the
Obtain your node’s IP address
To obtain our node’s IP address, we can click in the top right corner, then the network we are connected to, then Settings and finally we should see an overview of our connection, including our node’s IPv4 address. It may look like this:
192.168.1.110. We will remember it.
If you prefer to use the command line you can run
hostname -I to list your IPv4 address.
Connect from your personal computer
On your personal computer, open a terminal window and connect via the following command:
ssh <username>@<ip address>
More specifically, this may look like this:
If you are running into errors, you may have to specify the location and name of the SSH key you want to use:
ssh -i ~/.ssh/id_rsa <username>@<ip address>
For instance, if you did not name your key
id_rsa, substitute its name in the command above. If the key is located elsewhere, specify it’s path as shown above.
As this is your first time connecting to the node, you will see a warning “the authenticity of the host can not be established” together with the SSH fingerprint of your node. You can type
yes to add this fingerprint to your configuration, and you will only receive a warning in the future if the fingerprint does not match.
Once you see the notice:
Welcome to Ubuntu 22.02.2 LTS we have successfully installed Ubuntu and configured SSH. Congratulations!
- SSH settings
- Firewall: Ubuntu uses “ufw” (uncomplicated firewall). It is disabled by default but if you are interested in using it more information can be found here
- Ping the node