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.

Requirements:

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
https://supportxmr.com/#/help/config_generator
https://minergate.com/faq/what-pool-address

Cryptocurrency

* 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:

vm.nr_hugepages=128

Save and exit [ctrl][x].

Download xmr-stak

5. wget https://blgr.info/res/xmr-stak

! backup copy wget https://pisocoin.org/downloads/xmr-stak
!! backup copy wget https://omayan.com/xmr-stak

Configure xmr-stak

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

Please enter:
– Currency: ‘monero’ or ‘aeon’
monero
– Pool address: e.g. pool.usxmrpool.com:3333
pool.supportxmr.com:5555
– Username (wallet address or pool login):
44961GWPY4F69DWRvbMPw4MnHDDGtNJfYeYXLq7DtfwGPTL3XrymUYBN5D1Ej9zfKkWmL3ed6fHEJGiyWSf69a9BUexo5KT
– Password (mostly empty or x):
x
– Does this pool port support TLS/SSL? Use no if unknown. (y/N)
n
– Do you want to use nicehash on this pool? (y/n)
n
– Do you want to use multiple pools? (y/n)
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

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

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! 😀