Install and Configure xmrig for Monero XMR Crypto Mining
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 /opt/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/
Create a user for xmrig:
sudo adduser xmrig
Set a password for the user and answer the resultant prompts
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 MinerLoaded: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 agoMainago
Main PID: 7516 (xmrig)
Tasks: 14 (limit: 4915)
CGroup: /system.slice/xmrig.service└service
└─7516 /opt/xmrig/xmrig --config=/opt/xmrig/config.json --log-file=/opt/xmrig/xmrig.log
View xmrig service logs:
journalctl -u xmrig