How to Install Ubuntu 22.04 on WSL2 for Nosana Node Setup A Comprehensive Guide.md

Tutorials4个月前发布 easygpus
58 0

How to Install Ubuntu 22.04 on WSL2 for Nosana Node Setup: A Comprehensive Guide

Introduction

Setting up a Nosana node on Windows requires a specific configuration using Ubuntu 22.04 on WSL2 (Windows Subsystem for Linux 2). This guide will walk you through the process of installing Ubuntu 22.04 on WSL2, configuring Docker, setting up NVIDIA drivers and tools, and installing Podman. By the end of this tutorial, you'll have a fully functional environment ready for running a Nosana node.

Table of Contents

  1. Installing Ubuntu 22.04 on WSL2
  2. Setting Up Docker
  3. Configuring NVIDIA Drivers and Tools
  4. Installing and Configuring Podman
  5. Running the Nosana Test Grid Script
  6. Advanced Configuration (Optional)

Installing Ubuntu 22.04 on WSL2

To begin, you need to install Ubuntu 22.04 on WSL2. It's crucial to use this specific version, as Ubuntu 20.04 is not compatible with WSL2 for this setup.

Follow these steps to install Ubuntu 22.04 on WSL2:

  1. Visit the official Ubuntu tutorial: How to install Ubuntu on WSL2 on Windows 11 with GUI support
  2. Follow the instructions provided in the tutorial to install WSL2 and Ubuntu 22.04.

After installation, verify the WSL2 Ubuntu version by running the following command in your terminal:

lsb_release -a

Ensure that the version displayed is 22.04.

Setting Up Docker

To set up Docker for use with WSL2, follow these steps:

  1. Install Docker Desktop with WSL2 backend by visiting the official Docker documentation: Install Docker Desktop with WSL2 backend
  2. After installation, make sure to add Docker to its own user group for proper functionality.

Configuring NVIDIA Drivers and Tools

To utilize GPUs on the grid, you need to install both NVIDIA drivers and the NVIDIA CUDA toolkit.

Installing NVIDIA Drivers

  1. Download and install the appropriate NVIDIA driver from the official NVIDIA website: NVIDIA Driver Downloads
  2. To verify the driver installation, open a terminal and run:
nvidia-smi

If the driver is correctly installed, you should see detailed information about your GPU, similar to the following output:

+-----------------------------------------------------------------------------+
| NVIDIA-SMI 525.54       Driver Version: 526.56       CUDA Version: 12.0     |
|-------------------------------+----------------------+----------------------+
| GPU  Name        Persistence-M| Bus-Id        Disp.A | Volatile Uncorr. ECC |
| Fan  Temp  Perf  Pwr:Usage/Cap|         Memory-Usage | GPU-Util  Compute M. |
|                               |                      |               MIG M. |
|===============================+======================+======================|
|   0  NVIDIA GeForce ...  On   | 00000000:01:00.0 Off |                  N/A |
| N/A   43C    P5     9W /  N/A |      0MiB /  4096MiB |      0%      Default |
|                               |                      |                  N/A |
+-------------------------------+----------------------+----------------------+

+-----------------------------------------------------------------------------+
| Processes:                                                                  |
|  GPU   GI   CI        PID   Type   Process name                  GPU Memory |
|        ID   ID                                                   Usage      |
|=============================================================================|
|  No running processes found                                                 |
+-----------------------------------------------------------------------------+

Installing NVIDIA Container Toolkit

To install the NVIDIA Container Toolkit (nvidia-ctk), run the following commands:

curl -fsSL https://nvidia.github.io/libnvidia-container/gpgkey | sudo gpg --dearmor -o /usr/share/keyrings/nvidia-container-toolkit-keyring.gpg 
  && curl -s -L https://nvidia.github.io/libnvidia-container/stable/deb/nvidia-container-toolkit.list | 
    sed 's#deb https://#deb [signed-by=/usr/share/keyrings/nvidia-container-toolkit-keyring.gpg] https://#g' | 
    sudo tee /etc/apt/sources.list.d/nvidia-container-toolkit.list 
  && 
    sudo apt-get update

sudo apt-get install -y nvidia-container-toolkit

Configuring NVIDIA Container Toolkit

To configure the NVIDIA Container Toolkit for native Podman v4 on WSL2, follow the CDI configuration instructions available at https://docs.nvidia.com/datacenter/cloud-native/container-toolkit/latest/cdi-support.html.

After configuration, run the following command:

sudo nvidia-ctk cdi generate --output=/etc/cdi/nvidia.yaml

Installing and Configuring Podman

Nosana nodes connect to Podman to run your containers. On WSL2, you need to install Podman >v4.1 natively:

echo "deb https://download.opensuse.org/repositories/devel:/kubic:/libcontainers:/unstable/xUbuntu_22.04/ /" | sudo tee /etc/apt/sources.list.d/devel:kubic:libcontainers:unstable.list
curl -fsSL https://download.opensuse.org/repositories/devel:/kubic:/libcontainers:/unstable/xUbuntu_22.04/Release.key | sudo gpg --dearmor | sudo tee /etc/apt/trusted.gpg.d/devel_kubic_libcontainers_unstable.gpg > /dev/null
sudo apt update
sudo apt install podman

Verify that you have installed Podman version 4 and that you have GPU support:

podman --version
podman run --rm --device nvidia.com/gpu=all --security-opt=label=disable ubuntu nvidia-smi -L

If this doesn't work, ensure you have installed the NVIDIA drivers and nvidia-ctk as described in the installation guide and configuration guide.

Running the Nosana Test Grid Script

To easily set up the Nosana node on your machine, run the following command:

bash <(wget -qO- https://nosana.io/register.sh)

Note: This script has certain requirements and is specifically designed to run without sudo permissions. Always exercise caution when running any script from the internet with sudo privileges. Even in this case, it's recommended to thoroughly inspect the script before executing it on your system. You can view the script here: https://nosana.io/register.sh

The script will run a series of tests to verify that the previous steps outlined in the guide were completed successfully.

You will see the node's information displayed in the following format:

  _   _                             
 |  | | ___  ___  __ _ _ __   __ _ 
 |  | |/ _ / __|/ _` | '_  / _` |
 | |  | (_) __  (_| | | | | (_| |
 |_| _|___/|___/__,_|_| |_|__,_|

Reading keypair from ~/.nosana/nosana_key.json

Network:    mainnet
Wallet:    <NODE_ADDRESS>
SOL balance: 0E-9 SOL
NOS balance: 0 NOS
Provider:    podman

Test Grid Registration Instructions

When running the script, it will ask for some information: email, Discord, and Twitter/X handle (optional). After filling in the information and agreeing to the terms and conditions, the benchmark will begin. During this benchmark, we will check the hardware of your node.

If the benchmark is successful, you should see the following output:

Benchmark finished
================================
Thank you for registering for Nosana Node. 
We'll review your registration and you will get an email from us if you are selected.

Congratulations! 🎉 You have completed the registration. If you are selected for the test grid, you will receive an email with further information.

Warning: To find your node's Solana key, navigate to ~/.nosana/nosana_key.json. It is crucial to back up this file to ensure its security.

Advanced Configuration (Optional)

Running the Podman API

This command can be used to start the Podman service on port 8080 so that our Nosana node can access it. The register.sh script has already done this in the last step, so this step is optional:

podman system service --time 0 tcp:0.0.0.0:8080&

To verify that Podman is running correctly, use:

curl http://localhost:8080/v4.5.0/libpod/info

Starting the Nosana Node with Custom Parameters

You can manually start the Nosana node to modify certain parameters:

  • Use the --podman parameter to direct it to the service if the Podman service is running elsewhere.
  • Map your Solana key to the Docker container using --volume if you want to use your own key.
docker run 
      --pull=always 
      --network host  
      --interactive 
      --volume ~/.config/solana/id.json:/root/.nosana/nosana_key.json 
      nosana/nosana-node 
         --podman http://$(ip addr show eth0 | grep -oP '(?<=inets)d+(.d+){3}'):8080 
         join-test-grid

Troubleshooting

If you have any questions or receive error messages, please check our troubleshooting guide or join our Discord for assistance.

By following this comprehensive guide, you should now have a fully configured environment for running a Nosana node on WSL2 with Ubuntu 22.04. If you encounter any issues or need further clarification, don't hesitate to seek help from the Nosana community.

Keywords for SEO: WSL2, Ubuntu 22.04, Nosana node, Docker, NVIDIA drivers, CUDA toolkit, Podman, GPU support, container toolkit, test grid, blockchain node setup, Windows Subsystem for Linux, cryptocurrency mining, distributed computing.

© 版权声明

相关文章