Code:
#!/bin/bash
# Step 1: Install Required Dependencies
sudo apt-get update
sudo apt-get install -y git build-essential cmake libuv1-dev libssl-dev libhwloc-dev
# Step 2: Download and Build XMRig
if [ ! -d "xmrig" ]; then
git clone https://github.com/xmrig/xmrig.git
fi
cd xmrig
if [ ! -d "build" ]; then
mkdir build
fi
cd build
cmake ..
if [ $? -ne 0 ]; then
echo "Error: Failed to configure XMRig. Please check dependencies and try again."
exit 1
fi
make
if [ $? -ne 0 ]; then
echo "Error: Failed to build XMRig. Please check dependencies and try again."
exit 1
fi
# Step 3: Configure Mining Pool
echo '{
"pools": [
{
"algo": "randomx",
"url": "pool-url:port",
"user": "your-wallet-address.your-worker-name",
"pass": "x",
"tls": false,
"keepalive": true
}
]
}' > config.json
# Step 4: Start Mining
./xmrig