🏠 home πŸ““ lab notes πŸ›  stack πŸ“– runbooks ~$ whoami

πŸͺ™ Monero

Install Monero and run it as a service


  1. Update packages
    apt update && apt upgrade -y
    apt install git build-essential cmake libuv1-dev libssl-dev libhwloc-dev -y
    
  2. Download XMRig
    cd /opt
    git clone https://github.com/xmrig/xmrig.git
    cd xmrig
    mkdir build
    cd build
    
  3. Build it
    cmake ..
    make -j$(nproc)
    

    This compiles using all available CPU threads.
    After build, the binary will be here:

    /opt/xmrig/build/xmrig
    

  4. Create config

Either generate one from the official wizard on XMRig’s website, or create a simple config manually:

nano /opt/xmrig/build/config.json

Example minimal config:

{
    "autosave": true,
    "cpu": true,
    "opencl": false,
    "cuda": false,
    "pools": [
        {
            "url": "pool.supportxmr.com:3333",
            "user": "YOUR_MONERO_WALLET_ADDRESS",
            "pass": "proxmox"
        }
    ]
}

Replace wallet address with yours.

  1. Run it
    cd /opt/xmrig/build
    ./xmrig
    

  2. Optional: run in background with systemd

Create service:

nano /etc/systemd/system/xmrig.service

Paste:

[Unit]
Description=XMRig Miner
After=network.target

[Service]
ExecStart=/opt/xmrig/build/xmrig
WorkingDirectory=/opt/xmrig/build
Restart=always
User=root

[Install]
WantedBy=multi-user.target

Enable:

systemctl daemon-reload
systemctl enable xmrig
systemctl start xmrig

Check status:

systemctl status xmrig

Strong recommendation: limit CPU usage

Otherwise Proxmox and your containers will hate you.

Edit config:

"max-threads-hint": 50

or launch with:

./xmrig --threads=4

Set the donation on xmrig

nano /opt/xmrig/build/config.json

Search for this line and change to what you want:

"donate-level": 1,

1 = default 1% donation (recommended by XMRig devs) 0 = disable donation entirely 5 = 5% donation, etc.

after restart the service

systemctl restart xmrig

  1. Here some ways to view your xmrig log

Easy way

journalctl -u xmrig -f

Nice way

nano /opt/xmrig/build/config.json
"api": {
  "id": null,
  "worker-id": null
},
"http": {
  "enabled": true,
  "host": "127.0.0.1",
  "port": 8080,
  "access-token": null,
  "restricted": true

restart service

systemctl restart xmrig

then just curl it

curl http://127.0.0.1:8080/1/summary

Questions / idea? Open an issue on GitHub.