# 🔧 Installing a Polkadot Node Using Kagome

### *System Preparation*

```bash
sudo apt update && sudo apt upgrade -y
sudo apt install -y gpg curl lz4
```

*Check your OS version:*

```bash
lsb_release -a
# Should return something like: Ubuntu 24.04.1 LTS
```

## ***Automatic Installation***

```bash
source <(curl -s https://raw.githubusercontent.com/validexisinfra/polkadot/main/install_kagome.sh)
```

## ***Manual Installation***

### *Add Kagome Repository*

*Import the GPG key:*

```bash
curl -fsSL https://europe-north1-apt.pkg.dev/doc/repo-signing-key.gpg | sudo gpg --dearmor -o /usr/share/keyrings/europe-north-1-apt-archive-keyring.gpg
```

*Add the repository source:*

```bash
echo "deb [signed-by=/usr/share/keyrings/europe-north-1-apt-archive-keyring.gpg] https://europe-north1-apt.pkg.dev/projects/kagome-408211 kagome main" | sudo tee /etc/apt/sources.list.d/kagome.list
```

*Update your package index:*

```bash
sudo apt update
```

### *Install Kagome*

```bash
sudo apt install -y kagome
kagome --version
```

### *Create User and Database Directory*

*Create a dedicated system user:*

```bash
sudo useradd -m -r -s /bin/false kagome
```

*Create the base path directory:*

```bash
sudo mkdir -p /home/kagome/polkadot-node-1
sudo chown -R kagome:kagome /home/kagome
```

### *Create systemd Service*

*Create the service file:*

```bash
sudo nano /etc/systemd/system/kagome.service
```

Paste the following content (replace `<your-node-name>` and `<your-public-ip>`):

```bash
[Unit]
Description=Kagome Node

[Service]
User=kagome
Group=kagome
LimitCORE=infinity
LimitNOFILE=65536
ExecStart=/usr/local/bin/kagome \
  --name <your-node-name> \
  --base-path /home/kagome/polkadot-node-1 \
  --public-addr=/ip4/<your-public-ip>/tcp/30334 \
  --listen-addr=/ip4/0.0.0.0/tcp/30334 \
  --chain polkadot \
  --rpc-port=9944 \
  --prometheus-port=9615 \
  --telemetry-url 'wss://telemetry.polkadot.io/submit/ 1' \
  --telemetry-url 'wss://telemetry-backend.w3f.community/submit/ 1' \
  --node-key 63808171009b35fc218f207442e355b0634561c84e0aec2093e3515113475624 \
  --database rocksdb \
  --sync Warp \
  --enable-db-migration

Restart=always
RestartSec=10

[Install]
WantedBy=multi-user.target

```

### *Enable and Start the Node*

```bash
sudo systemctl daemon-reload
sudo systemctl enable kagome
sudo systemctl start kagome
```

*Check service status:*

```bash
sudo systemctl status kagome
```

*Check service logs*:

```bash
journalctl -u kagome -f
```

#### *Check Your Node on Polkadot Telemetry*

Once your node is running, you can verify that it's connected and visible on the Polkadot telemetry dashboard:

🔗 <https://telemetry.polkadot.io/>

Look for your node by the name you specified in the `--name` argument of your `kagome.service` file.


---

# Agent Instructions: 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:

```
GET https://services.validexis.com/mainnets/polkadot/installing-a-polkadot-node-using-kagome.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
