---
# System prepended metadata

title: 'Setting Up a Xai Sentry Node on Your VPS or VM: A Step-by-Step Guide'

---

# Running a Xai Node on a VPS

This guide will show you how to run Xai Node on a VPS. This is a community-built guide. You can find the official Xai documentation [here](https://xai-foundation.gitbook.io/xai-network/xai-blockchain/sentry-node-purchase-and-setup).

## Minimum hardware requirements

The following hardware is required to run a Xai node:

- 4 GB RAM
- 2 CPU Cores
- 60 GB Disk Space
- x86/X64 Processor
- Stable Internet Connection

> Note, the above requirements are subject to change. You can find the latest requirements on the [official Xai docs](https://xai-foundation.gitbook.io/xai-network/xai-blockchain/xai-protocol/sentry-nodes-explained/sentry-node-hardware-requirements).

## 1. VPS Setup

### 1.1 Choose VPS

First, choose one of the recommended VPS providers and purchase the package that matches the minimum hardware requirements provided above. Make sure to select **Ubuntu 22.04** as your Operating System. You can use Racknerd since they are one of the cheapest VPS providers. The location of your VPS has no influence on whether you can pass the KYC or claim rewards
| Provider | Price |
| --- | --- |
| [Racknerd](https://my.racknerd.com/aff.php?aff=10290&pid=795) | $38.88 Annually|

After your purchase, you'll receive login details in your email.

### 1.2 Log into a server

> Perform this step on your laptop/PC.

| Windows | Command Prompt |
| --- | --- |

| MacOS | Terminal |
| --- | --- |

To connect to VPS, use the `ssh` command from your terminal:

```bash
ssh $USER@$REMOTE_SERVER_IP
```

Example:

```bash
ssh root@706.437.14.562
```

> If you're using Windows, the SSH Client is available starting from [Windows 10](https://docs.microsoft.com/en-us/windows-server/administration/openssh/openssh_overview) version. For earlier versions, please use [PuTTY](https://www.putty.org/) or [Terminus](https://termius.com/)  or other alternatives 

When you log in the first time, you’ll see the following message:

```bash
The authenticity of host '$REMOTE_SERVER' can`t be established.
ED25519 key fingerprint is SHA256:...
This key is not known by any other names.
Are you sure you want to continue connecting (yes/no/[fingerprint])?
```

Type `yes` and press `Enter`. This will prompt you to input a **password**. Note, all Linux systems don't reveal passwords when you type them. Finish entering your password and click `Enter`. 

If your credentials are correct, you will see the following message:

```bash
Warning: Permanently added '$REMOTE_SERVER' (ECDSA) to the list of known hosts.
root@$REMOTE_SERVER`s password:
Welcome to Ubuntu 20.04.6 LTS (GNU/Linux 4.4.0-169-generic x86_64)

 * Documentation:  https://help.ubuntu.com
 * Management:     https://landscape.canonical.com
 * Support:        https://ubuntu.com/advantage

0 packages can be updated.
0 updates are security updates.
```
# Setting Up the Xai Sentry Node on Your VPS: A Step-by-Step Guide

Running a Xai Sentry Node can be a rewarding venture, allowing you to solve challenges and earn esXAI tokens. Here’s a detailed guide to help you set up your node on a Virtual Private Server (VPS).

## 2. Set up Xai Sentry Node

###  2.1 Log Into Your VPS/VM
Start by logging into your VPS or VM where you intend to run the Xai Sentry Node.


###  2.2 Update Your System
Ensure your system is up to date:
```bash
sudo apt update
```

###  2.3 Install Necessary Dependencies
Install the required dependencies, `curl` and `unzip`, using the following command:
```bash
sudo apt install curl unzip
```

###  2.4 Download Xai CLI
Fetch the latest version of the Xai Command Line Interface (CLI) using `curl`:

> You dont need to download the file on your computer since this command takes it from the github website
```bash
curl -L -o sentry-node-cli-linux.zip https://github.com/xai-foundation/sentry/releases/latest/download/sentry-node-cli-linux.zip
```

Unzip the file:

```bash
unzip sentry-node-cli-linux.zip
```

### 2.5 Set Up a Screen
[Screen](https://www.gnu.org/software/screen/manual/screen.html) will allow you to keep running the CLI even if you're disconnected or you log out from your server.

Install screen:
```bash
sudo apt update && sudo apt install screen
```
Start a screen session:
```bash
screen -S xai
```
This will open a screen session, create a new window, and start a shell in that window.

The first time you start a screen, you'll see a page of license information. You can press the `Space` bar to read the second page or `Enter` to return to the command prompt.

To verify that you set up a Screen session, type `screen -ls` in a second terminal. You should see a message that looks as follows:

```bash
There is a screen on:
	82824.xai	(12/09/2023 11:04:52 AM)	(Attached)
1 Socket in /run/screen/@root.
```
### 2.6 Start Xai CLI

Now that you set up a Screen, you can start Xai CLI:

```bash
./sentry-node-cli-linux
```

### 2.7 Boot the operator

To receive node rewards, boot your operator: 

```bash
boot-operator
```

This will prompt you to enter the private key of your **sentry wallet** (a.k.a Operator). Paste the key and press `Enter`.

You can get your **sentry wallet** private key by going to the XAI Desktop App and clicking on the 3 dots **[1]** next to your sentry wallet. You will then have the option to **Export** the sentry wallet private key **[2]** 
![image](https://hackmd.io/_uploads/HyDjUR5_6.png)



You will be asked if you want to use a **Whitelist** for the operator runtime. If you want to prevent others from utilizing your operator to pay the gas for operating their Keys, then enter "Y". 
Then hit `Enter`.

(*It is strongly recommended to have a whitelist for the operator runtime.*)

Use the Up & Down `arrow keys` on your keyboard to navigate to the wallet you want to add to the whitelist, then hit `Spacebar` to select that wallet.

It is recommended that you only whitelist the wallet(s) containing Key(s). If you see any wallets you do not recognize, it is recommended that you do not select those wallets.

Once you have selected your wallet(s) hit `Enter`

Wait a few minutes until you see the following message:

```
The operator has finished booting. The operator is running successfully. esXAI will accrue every few days.
Current timestamp: 2023-12-10T01:47:04.273Z. The operator is still running successfully. esXAI will accrue every few days.
```

### 2.8 Detach from your Screen session

You can detach from your current Screen session by **pressing**:

- `ctrl a + d` (Windows)
- `control a + d` (macOS)

or

```bash
screen -d <screen_id>
```
where `<screen_id>` is the numbers of your Screen session.

Example:

```
screen -d 82824
```

Make sure to **Detach** before exiting the server. Detached mode allows you to exit your Screen session without closing or interrupting any processes that are happening within that session. That means that everything will keep running in the background even if you log out from your VPS.

You can now safely log out from your server:

```bash
logout
```
___________________________
### 2.9 Show all Screen sessions
To see all Screen sessions, type `screen -ls` . You should see a message that looks as follows:

```bash
There is a screen on:
	82824.xai	(12/09/2023 11:04:52 AM)	(Detached)
1 Socket in /run/screen/@root.
```


### 2.10 Kill/Delete a Screen session
If you have multiple Screen sessions, you can kill the one you don't need as follows:

```bash
screen -XS <screen_id> quit
```

> Replace the following values:
> -`<screen_id>` - the id of your current Screen session
> -Example: `screen -xs 82824 quit`

If you want to delete all running Screen sessions, you can use the following command:
```
Pkill screen
``` 
this will delete every screen session you where running. If you want to restart the node i recommend starting from step **2.5 Set Up a Screen** in this guide.
### 2.11 Reattach to your Screen session

Anytime you want to see the logs from your node, you can reattach to that session as follows:

```
screen -r <screen_id>
```

where `<screen_id>` is the numbers of your Screen session.

Example:

```
screen -r 82824
```

Note, currently you can't see the rewards using the CLI. You need to install a desktop app for it. For more details refer to [this video](https://xai-foundation.gitbook.io/xai-network/xai-blockchain/sentry-node-purchase-and-setup/how-to-videos/command-line-interface-cli/track-accrued-esxai).

### 2.12 Updating your node

Login to your server:

Use the `ssh` command from your terminal:

```bash
ssh $USER@$REMOTE_SERVER_IP
```
Reattach to your Screen session:

```bash
screen -r <screen_id>
```

> Replace the following values:
> -`<screen_id>` - the id of your current Screen session
> -Example: `screen -r 82824`

Stop the operator:

- `ctrl + c` (Windows)
- `control + c` (macOS)




Remove your current CLI:

```bash
rm sentry-node-cli-linux sentry-node-cli-linux.zip
```

Download the latest CLI:
> You dont need to download the file on your computer since this command takes it from the github website
```bash
curl -L -o sentry-node-cli-linux.zip https://github.com/xai-foundation/sentry/releases/latest/download/sentry-node-cli-linux.zip
```

Unzip the file:

```bash
unzip sentry-node-cli-linux.zip
```

Start CLI:

```bash
./sentry-node-cli-linux
```

Boot operator:

```bash
boot-operator
```

Paste the private key of your **Sentry Wallet** and press `Enter`.

Wait until the operator has finished booting and you see the following message:

```
The operator has finished booting. The operator is running successfully. esXAI will accrue every few days.
Health check complete, subscription to 'ChallengeSubmitted' is still active.
```

Detach from your Screen session:

- `ctrl a + d` (Windows)
- `control a + d` (macOS)

Logout from your server:

```bash
logout
```

**Note:** To KYC and view rewards, you need the desktop app, which is not covered in the CLI. Remember that the XAI Desktop App does not show your VPS Node status !!!!

Following these steps will help you set up and maintain your Xai Sentry Node effectively. Remember to regularly check for updates and monitor your node's performance.