Install XMRig as a Windows service (2022 tutorial)

 


The official guide is a bit sparse so I thought I'd share my process:


Create folder C:\xmrig-deps

Download the most recent version of pre-built dependencies by using the green Code button and Download ZIP

Extract the gcc and msvc2019 folders to C:\xmrig-deps

Download NSSM and extract nssm.exe to C:\xmrig-deps

Install CMake (during installation select "Add to path for all users")

Install Visual Studio Community 2022 -- during install choose following components: 

  • Desktop development with C++ (left side)
  • C++/CLI support for v143 build tools (right side)

Install Git (just use all defaults during setup)

Reboot your machine

Open "Git CMD" program and run the following commands:

  • git clone https://github.com/xmrig/xmrig.git
  • mkdir xmrig\build && cd xmrig\build

Optional: edit donate.h to change 1 to 0: notepad ../src/donate.h

Next, run the following commands:

  • cmake .. -G "Visual Studio 17 2022" -A x64 -DXMRIG_DEPS=c:\xmrig-deps\msvc2019\x64
  • cmake --build . --config Release
  • cd Release
  • del *.cmd
  • echo "" > xmrig.log


Create a file called xmrig-config.json and enter the values as instructed by the mining pool you're joining. Here's a boilerplate template as a guide:

echo { > xmrig-config.json

echo     "autosave": true, >> xmrig-config.json

echo     "cpu": { >> xmrig-config.json

echo         "enabled": true, >> xmrig-config.json

echo         "memory-pool": true >> xmrig-config.json

echo     }, >> xmrig-config.json

echo     "donate-level": 0, >> xmrig-config.json

echo     "opencl": false, >> xmrig-config.json

echo     "cuda": false, >> xmrig-config.json

echo     "log-file": "/var/log/xmrig.log", >> xmrig-config.json

echo     "colors": false, >> xmrig-config.json

echo     "pools": [ >> xmrig-config.json

echo         { >> xmrig-config.json

echo             "algo": "astrobwt", >> xmrig-config.json

echo             "url": "us.dero.herominers.com:10120", >> xmrig-config.json

echo             "user": "YOUR-WALLET-ADDRESS-HERE", >> xmrig-config.json

echo             "pass": "YOUR-WORKER-NAME-HERE", >> xmrig-config.json

echo             "keepalive": true, >> xmrig-config.json

echo             "tls": true >> xmrig-config.json

echo         } >> xmrig-config.json

echo     ] >> xmrig-config.json

echo } >> xmrig-config.json


Close the Git CMD terminal window.

Open a Windows Command Prompt as Administrator and run the following:

%USERPROFILE%/xmrig/build/Release/xmrig.exe --config=%USERPROFILE%/xmrig/build/Release/xmrig-config.json

After 10 seconds, press Ctrl+C on your keyboard to stop it running, then reboot your computer (this step is required to enable Huge Pages)

After the computer reboots, open a normal Windows Command Prompt and run the following:

%USERPROFILE%/xmrig/build/Release/xmrig.exe --config=%USERPROFILE%/xmrig/build/Release/xmrig-config.json

Make sure "HUGE PAGES" says "permission granted" then press Ctrl+C on your keyboard to stop it running.

While still in the command prompt, run the following:

C:\xmrig-deps\nssm.exe install XMRIGService %USERPROFILE%/xmrig/build/Release/xmrig.exe --config=%USERPROFILE%/xmrig/build/Release/xmrig-config.json

Close the command prompt and then on your keyboard press Windows+S and type services.msc and hit enter to load the Windows services list. At the bottom of the list, right click on XMRIGService and choose "Start".

After a minute, open your mining pool dashboard and verify your mining worker is active.

Enjoy!

Comments

Popular Posts