Skip to main content

Install and Configure xmrig for Monero XMR Crypto Mining

Ensure you have created and activated an account on https://minergate.com. You will need your minergate.com UserID before proceeding.

Create a directory for xmrig under /opt:

mkdir /opt/xmrig

Download attached xmrig-linux.zip and extract to the /opt/xmrig directory you created above:

unzip xmrig-linux.zip -d /opt/xmrig

Edit /opt/xmrig/config.json file and under the following section:

"pools": [
{
"algo": null,
"coin": null,
"url": "xmr.pool.minergate.com:45700",
"user": "12345678",
"pass": "x",
"rig-id": null,
"nicehash": false,
"keepalive": false,
"enabled": true,
"tls": false,
"tls-fingerprint": null,
"daemon": false,
"socks5": null,
"self-select": null
}
],

set the 123456 in the "user": "12345678"  section to your Minergate.com UserID.

Make /opt/xmrig/xmrig executable:

chmod +x /opt/xmrig/xmrig

Move the xmrig.service file that was included in the xmrig-linux.zip file to /etc/systemd/system:

mv /opt/xmrig/xmrig.service /etc/systemd/system/

Adjust the CPU Quota that xmrig will use on your system by editing the /etc/systemd/system/xmrig.service file:

vi /etc/systemd/system/xmrig.service

Insert the following line:

CPUQuota=50%

after the following line:

ExecStart=/opt/xmrig/xmrig --config=/opt/xmrig/config.json --log-file=/opt/xmrig/xmrig.log

So the whole service looks like below:

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

[Service]
User=xmrig
Group=xmrig

StandardOutput=journal
StandardError=journal

ExecStart=/opt/xmrig/xmrig --config=/opt/xmrig/config.json --log-file=/opt/xmrig/xmrig.log
CPUQuota=50%

Restart=always

[Install]
WantedBy=multi-user.target

Adjust the percentage from the default 50% to a level appropriate for your system.

Save the /etc/systemd/system/xmrig.service file.

Create a user for xmrig:

sudo adduser xmrig

Set a password for the xmrig user and answer the resultant prompts

Give xmrig user root privileges:

usermod -G sudo xmrig

Enable the xmrig service:

sudo systemctl enable --now xmrig

Start the xmrig service:

sudo systemctl restart xmrig

Ensure xmrig service has started:

systemctl status xmrig

If the service is started, the output should be similar to below:

● xmrig.service - XMRig Monero Miner
   Loaded: loaded (/etc/systemd/system/xmrig.service; enabled; vendor preset: enabled)
   Active: active (running) since Fri 2021-02-19 21:17:30 UTC; 11min ago
 Main PID: 7516 (xmrig)
    Tasks: 14 (limit: 4915)
   CGroup: /system.slice/xmrig.service
           └─7516 /opt/xmrig/xmrig --config=/opt/xmrig/config.json --log-file=/opt/xmrig/xmrig.log

View xmrig service logs:

journalctl -u xmrig