This script automates the installation of the Golem Network environment on multiple PCs. By running this script, you can connect each PC to the Golem Network to rent out computing power and earn income.
- SSH Access: Ensure SSH is enabled on each PC.
- Dependencies: The script will install Docker if it’s not already installed.
- User Permissions: Run the script with a user that has
sudo
privileges.
The install_golem.sh
script will:
- Update system packages.
- Install Docker if it is not already installed.
- Install the Golem Network node (
yagna
) and initialize payment.
Save the script as install_golem.sh
:
#!/bin/bash
# Update system packages
sudo apt update -y && sudo apt upgrade -y
# Install Docker
if ! command -v docker &> /dev/null; then
echo "Docker not found, installing Docker..."
sudo apt install -y apt-transport-https ca-certificates curl software-properties-common
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg
echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
sudo apt update -y
sudo apt install -y docker-ce docker-ce-cli containerd.io
sudo usermod -aG docker $USER
newgrp docker
fi
# Install Golem
if ! command -v ya-provider &> /dev/null; then
echo "Installing Golem Network node (Yagna)..."
sudo apt update -y
sudo apt install -y gnupg
mkdir -p ~/.local/share/yagna
curl -sS https://get.golem.network | bash
~/.local/share/yagna/yagna service run &
sleep 10
~/.local/share/yagna/yagna payment init --driver=zksync --network=mainnet
fi
# Additional setup can go here for authentication or node configuration
echo "Golem setup complete on $(hostname)"
To deploy this script across multiple PCs, use pssh
(parallel SSH) or Ansible
.
Example with pssh
- Install
pssh
if not already installed:sudo apt install pssh
- Create a file called
hostfile.txt
with the IP addresses or hostnames of each PC. - Run the script across all PCs:
example of hostfile.txt
pssh -h hostfile.txt -l username -A -i 'bash install_golem.sh'
[email protected]:22 [email protected]:2222 192.168.1.103 # Default user and port (optional) [email protected]:2200
-
After running the script, verify that each PC is connected to the Golem Network by checking the
yagna
service status.ps aux | grep yagna
Docker Permissions
: If Docker requires root permissions, ensure that the user running the script is part of the Docker group.SSH Access
: Ensure that each PC has SSH enabled and that you have the correct username and password or key for each system.