How to setup xmr-stak pool mining on Debian Linux VPS

This article will show you how to install and run xmr-stak and setup pool mining on Debian 8 VPS. You can also opt for Ubuntu 16 using this tutorial.

Requirements

VPS
Mining Pool

Cryptocurrency Supported

  • Aeon
  • BBSCoin
  • Croat
  • Edollar
  • Electroneum
  • Graft
  • Haven
  • Intense
  • Karbo
  • Monero
  • MoneroV
  • Stellite
  • Sumokoin

Please note that this is not an endorsement nor a complete list.

Installation Steps

Prep the system

Assuming you already have built a Debian 8 / Ubuntu 16 instance

1. cd ~; sudo apt-get update && sudo apt-get --assume-yes install software-properties-common libmicrohttpd-dev libuv1-dev libssl-dev cmake build-essential libhwloc-dev screen git nano

Setup Huge Pages

2. sysctl -w vm.nr_hugepages=128; sudo nano /etc/sysctl.conf

At the end of the file add:

vm.nr_hugepages=128

Save and exit [ctrl][x].

Download xmr-stak

3.a sudo git clone https://github.com/fireice-uk/xmr-stak.git
3.b cd xmr-stak && cd xmrstak

Edit donation level according to your needs:

3.c sudo nano donate-level.hpp

Save and exit [ctrl][x].

3.d cd .. && sudo cmake -DCMAKE_LINK_STATIC=ON -DCMAKE_BUILD_TYPE=Release -DXMR-STAK_COMPILE=native -DCUDA_ENABLE=OFF -DOpenCL_ENABLE=OFF -DXMR-STAK_LARGEGRID=OFF -DXMR-STAK_THREADS=32 . && sudo make install
3.e sudo chmod 0777 bin && cd bin && sudo chmod +x xmr-stak && ./xmr-stak

The miner will run after successful configuration; Press [ctrl][c] to exit because we will have to make it run as a daemon.

! You can use multiple pools if you want, but it’s kind of backup only if the main pool is down so it’s useless.
!! Don’t answer y to the nicehash question ‘coz we are running on a CPU-only VPS environment.

Create service

4. nano /lib/systemd/system/mine.service

Paste this code

[Unit]
Description=mine
After=network.target
[Service]
ExecStart=/root/xmr-stak/bin/xmr-stak --cpu /root/xmr-stak/bin/cpu.txt -c /root/xmr-stak/bin/config.txt -C /root/xmr-stak/bin/pools.txt
User=root
[Install]
WantedBy=multi-user.target

Save and exit [ctrl][x].

Activate service

5. sudo systemctl daemon-reload && sudo systemctl enable mine.service
6. sudo systemctl restart mine.service && service mine status

Status check

7. service mine status

You should see something like

Active: active (running).

Congratulations, you now have a 24/7 miner!

Note: On some systems, systemd is not available. You will have to use nohup ./xmr-stak to run xmr-stak as a background process.

Note #2: In the event you want to change the pool address and wallet address, just nano pools.txt and edit the corresponding field. [ctrl][x] to save and exit; You will have to repeat steps 5 to 6 to activate changes.

You can check your earnings on your selected mining pool website.

Like this post? Consider donating!

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.