How to setup xmr-stak and mine on Debian Linux VPS

This article will show you how to install and run xmr-stak and setup mining on Debian 8 VPS. You can also use Ubuntu 16 on this tutorial. Other Linux distro and miner app may be supported, do it on your own risk.


Linux VPS
You can get a paid VPS at Digital Ocean or Vultr. You can also try Microsoft Azure with free $200 credit.

Mining Pools


* Using “monero” mode

  • Monero
  • Electroneum
  • Intense
  • Sumokoin
  • Bytecoin

* Using “aeon” mode

  • Aeon

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

0. cd ~
1. apt-get update
2. apt-get --assume-yes install libmicrohttpd-dev libssl-dev cmake build-essential libhwloc-dev screen git nano

Setup Huge Pages

3. sysctl -w vm.nr_hugepages=128
4. nano /etc/sysctl.conf

At the end of the file add:


Save and exit [ctrl][x].

Download xmr-stak

5. wget

! backup copy wget
!! backup copy wget

Configure xmr-stak

6. chmod +x xmr-stak
7. ./xmr-stak

Please enter:
– Currency: ‘monero’ or ‘aeon’
– Pool address: e.g.
– Username (wallet address or pool login):
– Password (mostly empty or x):
– Does this pool port support TLS/SSL? Use no if unknown. (y/N)
– Do you want to use nicehash on this pool? (y/n)
– Do you want to use multiple pools? (y/n)

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

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

Paste this code

ExecStart=/root/xmr-stak -c /root/config.txt

Save and exit [ctrl][x].

Activate service

9. systemctl daemon-reload
10. systemctl enable mine.service
11. systemctl restart mine.service

Status check

12. 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 config.txt and edit the corresponding field. [ctrl][x] to save and exit; You will have to repeat steps 9 to 12 to activate changes.

Like this post? Consider donating! 😀