liongrass / June 2023 (266 Words, 2 Minutes)
In this chapter we are going to update our operating system, install and configure a firewall.
Update the operating system
Applying all recent updates is easy. We only need to run the following two commands consecutively and type
Y then prompted:
sudo apt update sudo apt upgrade
Depending on what kind of updates we are getting we might have to confirm a few other prompts. Going with the defaults is generally fine for our purpose, so pressing the
Enter key is enough.
Occasionally our machine will ask us to restart it. This is not urgent, but can be done with the command:
sudo reboot now
It might be wise to shut down LND and Bitcoin Core before you do that!
Install and configure the Uncomplicated Firewall
The Uncomplicated Firewall (UFW) should already be installed on your Ubuntu system. You can check with the command:
sudo ufw status
It should return something like
Status: inactive. Otherwise you can install it with:
sudo apt install ufw
Before we enable the firewall, we are going to have to allow SSH connections into our machine, or else we might find ourselves locked out. If you are not using SSH to monitor or control your computer, for example because your computer has a keyboard and monitor attached to it, we don’t need to enable SSH.
sudo ufw allow ssh
It should return
Next, we are going to enable our firewall:
sudo ufw enable
We confirm with
y and should see the notice:
Firewall is active and enabled on system startup
Important: Before we continue, keep the existing terminal open and start a new terminal window and try to SSH into your machine. If this does not succeed, disable the firewall before trying the
sudo ufw allow ssh command again:
sudo ufw disable
Other useful services to enable
Depending on what services you make use of on your machine, you may want to open other ports too. Generally, you should only do this if your node is running on a clearnet IP address.
Incoming connections to LND:
sudo ufw allow 9735
Incoming connections to Bitcoin Core:
sudo ufw allow 8333