Skip to content

Latest commit

 

History

History
214 lines (157 loc) · 10.6 KB

getting-started.md

File metadata and controls

214 lines (157 loc) · 10.6 KB

Getting Started

Install and tune an XMRig worker from a fresh machine. The rigforge.sh entrypoint and bundled util/ helpers drive the whole process, and most of it is automated.

TL;DR

git clone --branch v1.19.0 https://github.com/p2pool-starter-stack/rigforge.git
cd rigforge
chmod +x rigforge.sh
sudo ./rigforge.sh

Enter your pool URL and optional stratum password (an .onion pool also offers a SOCKS proxy override), let it build, and on Linux reboot once to apply the kernel tuning. The xmrig service starts automatically after the reboot.


1. Prerequisites

Requirement Recommendation
Operating system Ubuntu 24.04 is fully supported (Ubuntu 22.04+ and Debian 12 also work). macOS is best effort: most of it works and some features are degraded (see Running on macOS); other Linux distros are courtesy.
CPU 64-bit x86 with AVX2 is strongly recommended for RandomX performance. More and faster cores mean more hashrate.
RAM ~2.3 GB free for RandomX fast mode (a 2080 MB dataset + 256 MB cache), plus ~2 MB of L3 cache per mining thread. 4 GB+ recommended.
Privileges root for setup (it installs packages and tunes the kernel, so run it with sudo). Looking is free: status, logs, and backup never need root.
Network The worker must reach your pool / stack host on its Stratum port (Pithead uses 3333). LAN pools need no Tor; an .onion pool needs a Tor SOCKS proxy that you install and run yourself.

📐 Full sizing guidance, including minimum vs. recommended specs and the per-CPU tuning profiles, is in Hardware Requirements. The stack host these workers connect to is sized separately in Pithead's hardware guide.

You don't need to install build dependencies yourself. RigForge installs the toolchain (cmake, libuv, hwloc, …) for you on first run. You only need git to clone the repo.

Install with Homebrew (macOS best effort, Linux extra)

The repository is its own Homebrew tap, installed by URL:

brew tap p2pool-starter-stack/rigforge https://github.com/p2pool-starter-stack/rigforge.git
brew install p2pool-starter-stack/rigforge/rigforge

Installing is inert: it puts a rigforge command on your PATH (with bash, jq and flock) and changes nothing else. Setup stays explicit: copy config.minimal.json to config.json in the installed tree, then run sudo "$(command -v rigforge)" setup (the full path, because sudo's secure_path may not include the Homebrew prefix). There is no service block, and brew upgrade rigforge never restarts a running miner. config.json lives in the installed tree, which an upgrade replaces, so run rigforge backup before and rigforge restore after. Brew cannot do the root tuning (GRUB, HugePages, MSR): on Linux, that is rigforge setup's job, and Linuxbrew's user-owned prefix is not a safe place for code that root-run units execute, so prefer the git route below on a Linux rig.

Install with apt (Debian / Ubuntu on Linux)

The apt steps (signing key, source entry, apt install rigforge) are in the README, under Prefer apt?. Installing changes nothing on the host: the package puts the release bundle (without the developer notes under docs/dev) in the root-owned /usr/lib/rigforge, adds the one-shot upgrade unit, and installs a /usr/bin/rigforge that runs it with RIGFORGE_LIB=/usr/lib/rigforge and RIGFORGE_STATE=/var/lib/rigforge (where files live). Provision with sudo rigforge setup, which creates config.json, the XMRig build and every other piece of state under /var/lib/rigforge; that directory is root's, so run backup and restore with sudo too.

apt upgrade rigforge on a configured host queues the package upgrade. apt remove stops and disables the units setup rendered for the package (never those of a git install) and keeps /var/lib/rigforge. apt purge also deletes it, the control state under /var/lib/rigforge-control*, every unit, timer and path setup rendered, the API firewall rules file and the logrotate rule. Neither reverts system tuning (GRUB, HugePages, MSR, fstab, limits); that is rigforge uninstall, run before apt purge.


2. Get the code

git clone --branch v1.19.0 https://github.com/p2pool-starter-stack/rigforge.git
cd rigforge
chmod +x rigforge.sh

Want to see exactly what setup would do to this machine before handing it root? The dry run prints a numbered plan (missing packages, the GRUB diff, HugePages count, units) and changes nothing — it doesn't even need sudo:

./rigforge.sh setup --dry-run

Have your pool URL ready, a host:port. For a Pithead stack that's the stack machine's address and its proxy port 3333 (e.g. stack.lan:3333); with Pithead you do not need a wallet, since the stack handles payouts centrally.

Mining to a public pool (SupportXMR, etc.) instead of Pithead? Public pools pay you, so they expect your Monero wallet address as the login (and usually a TLS port). First-run setup leaves the wallet and TLS fields for you, so afterwards set pools[].user to your wallet (and tls) and run sudo ./rigforge.sh apply. There's a copy-paste example in Configuration › Connecting to a public pool. Otherwise your hashes credit the rig's hostname instead of you.


3. Run setup

sudo ./rigforge.sh

setup is the default command and is safe to re-run. On a fresh machine it walks through:

  1. Dependencies. Installs the build toolchain and runtime libraries for your OS.
  2. First-run config. If there's no config.json, it asks for your pool URL and optional stratum password (Enter skips it). An .onion host also offers a SOCKS proxy override, defaulting to 127.0.0.1:9050; install and run Tor yourself. It writes a minimal config. (You can also pre-create one; see Configuration.)
  3. Build. Clones and compiles XMRig from source, pinned to a known version/commit and patched to your DONATION level. Build output is captured to a logfile.
  4. Hardware tuning. Detects your CPU and writes a matching XMRig config (NUMA, ASM, thread layout, MSR). See How It Works.
  5. Kernel tuning (Linux only). Configures HugePages (1 GB and 2 MB), MSR access, hugetlbfs mounts, and memlock limits. The GRUB change requires a reboot.
  6. Service. Installs and enables the xmrig systemd service with a cpupower performance governor and log rotation.

Re-running setup is idempotent: it skips the (slow) recompile when the pinned XMRig is already built, and it won't duplicate the kernel/limits edits. Later on, to apply a config.json edit use apply; to redeploy a release and rebuild when its pin, compiled-minimum marker or binary checksum requires it, use upgrade.

Optional: a rigforge command on your PATH. Set "add_to_path": true in config.json and setup installs a rigforge symlink in /usr/local/bin, so you can run it from any directory (sudo rigforge doctor, sudo rigforge tune, …) instead of ./rigforge.sh. It's off by default, so this guide uses ./rigforge.sh throughout. (uninstall removes the symlink.)


4. Reboot (Linux only)

To apply HugePages and the other kernel tuning, a reboot is required on Linux. The script tells you when:

sudo reboot

After the reboot the xmrig service starts automatically. (macOS needs no reboot.)


5. Verify it's mining

sudo systemctl status xmrig      # service should be active (running)
sudo journalctl -u xmrig -f      # live logs — watch for accepted shares

Confirm the optimizations applied:

sudo ./rigforge.sh doctor                       # the one-stop health check (HugePages, MSR, governor, …)
sudo ./rigforge.sh bios                         # guided BIOS checklist for what the OS can't set (XMP/EXPO, SMT, PBO)
grep Huge /proc/meminfo                         # HugePages_Total should be non-zero
grep -i msr data/worker/xmrig.log               # MSR mod applied (no errors)

<WORKER_ROOT> is data/worker inside the repo by default. If you see MSR errors, you may need to disable Secure Boot in your BIOS/UEFI; see Operations › Troubleshooting.

On macOS the steps above (the systemd service and the HugePages/MSR checks) don't apply: there's no service and no kernel tuning. Start the miner yourself with ./rigforge.sh start (then status / logs / stop); see Operations › Running on macOS.


6. Connect to Pithead dashboard (optional)

Running a Pithead stack? The dashboard discovers workers from the mining connection, but to show enriched stats (RigForge version, health probes, tune state, watchdog status), each rig's sister API must be enabled. If your worker appears in Workers Alive without these status chips, the sister API is off.

Enable it by adding an api block to config.json, with ACCESS_TOKEN set to your rig's pool user (the dashboard label):

{
    "pools": [
        { "url": "your-stack:3333", "user": "garage-rig" }
    ],
    "api": "enabled",
    "ACCESS_TOKEN": "garage-rig"
}

Then, on the Linux rig, sudo ./rigforge.sh apply activates the sister API on :8081 (the sister API is part of the Linux service install — a macOS dev build accepts the config but runs no API). Set ACCESS_TOKEN to match the rig name so Pithead can use workers.api_auth: name mode (the simplest setup). For other token strategies and the full API contract, see Pithead Integration › Sister API.


Next steps