> For the complete documentation index, see [llms.txt](https://docs.money-printer-go-brrr.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.money-printer-go-brrr.com/readme/bitcoin-node/setup-your-bitcoin-node-from-source/prepare-the-system.md).

# Prepare the system

Update the system and install dependencies before compiling Bitcoin Core.

## Update the system

```
sudo apt update && sudo apt upgrade -y
```

## Disable SSH Password Login

In the SSH configuration, make sure password login is disabled (`PasswordAuthentication no`)

```
sudo cat /etc/ssh/sshd_config | grep PasswordAuthentication
```

## Setup a firewall

We need to setup a firewall to restrict inbound traffic for our node.

First we install it:

```
sudo apt install ufw
```

By default `ufw` denies all incoming traffic so we must allow inbound SSH traffic before we enable it:

```
sudo ufw allow 22/tcp
```

Now we can enable the firewall:

```
sudo ufw enable
```

We can check the status with those commands:

```
sudo ufw status
```

```
sudo ufw status verbose
```

## Install Tor

Install Tor:

```
sudo apt install tor
```

Add your user:

```
sudo usermod -a -G debian-tor your-user
```

You must log out and log back in for the changes to take effect.

Finally we can enable Tor at boot and start it:

```
sudo systemctl enable tor
```

```
sudo systemctl start tor
```

## Install Bitcoin Core dependencies

The following packages will be needed to install Bitcoin Core:

```
sudo apt install git automake autoconf autotools-dev build-essential cmake make pkg-config protobuf-compiler libminiupnpc-dev libprotobuf-dev libdb++-dev libzmq3-dev libsqlite3-dev libboost-thread-dev libboost-test-dev libboost-all-dev libevent-dev libtool libssl-dev libboost-system-dev libboost-filesystem-dev capnproto libcapnp-dev
```

{% hint style="danger" %}
If you get the error `Error: Unable to locate package libdb++-dev` then you must specify the version number. Run `apt search 'libdb.*++-dev'`and install the latest version displayed. Example: `libdb5.3++-dev`
{% endhint %}

## Install Node.js

{% hint style="info" %}
This is only required if you plan to install [BTC RPC Explorer](https://github.com/janoside/btc-rpc-explorer).
{% endhint %}

The steps to install Node.js 23 are detailed [here](https://github.com/nodesource/distributions?tab=readme-ov-file#using-ubuntu-nodejs-23).

Install curl:

```
sudo apt install curl
```

Download the setup script:

```
curl -fsSL https://deb.nodesource.com/setup_23.x -o nodesource_setup.sh
```

Run it:

```
sudo -E bash nodesource_setup.sh
```

Install node:

```
sudo apt install nodejs
```

Verify the installation:

```
node -v
```

And also update npm to the latest version:

```
sudo npm install -g npm@latest
```

## Install Rust and Cargo

{% hint style="info" %}
This will be needed by the Electrum server if you plan on installing it.
{% endhint %}

Install dependencies:

```bash
sudo apt install -y clang cmake
```

Install Rust and Cargo:

```bash
curl https://sh.rustup.rs -sSf | sh
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.money-printer-go-brrr.com/readme/bitcoin-node/setup-your-bitcoin-node-from-source/prepare-the-system.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
