In this guide, we’ll show you how to go about mining Monero with a VPS. We’re going to be using an Ubuntu server, but the steps will be the same (or very similar) for most Linux based servers.
As you’ll see Monero VPS mining is not profitable – this guide is more aimed at theory and learning. Although should the price of Monero XMR rise substantially, then it might become worth it (but that’s all speculative).
Furthermore, please note that software versions may change, so this guide might be outdated. Also, note that the difficulty of mining cryptocurrencies and their prices are always changing.
Getting your VPS
Before you start mining, you need to order a VPS from a provider with Ubuntu 18 installed. You can see a list of the best VPS providers here. Since it isn’t profitable there isn’t a best vps for mining monero. While there are no suitable free VPS servers available, DigitalOcean is a good cheap alternative. Your server should be up and running within 5 minutes after they received the payment. After the first login, it is always good to run
sudo apt-get update sudo apt-get upgrade
to upgrade your software to the latest stable version. Update loads the list of the most recent versions, and with the upgrade line, you install the new versions.
First, you need to create a Monero wallet. We used mymonero.com, which is a web-wallet; it is effortless to create and use, but not that secure in the long-term. We suggest having a different one if you plan to mine Monero for a longer time.
For mining, we joined nanopool. It accepts multiple mining software; it’s easy to use and considered a healthy pool. You don’t need to create an account on nanopool. Just set your mining software properly, and it will mine through the pool. Furthermore, it provides you with excellent statistics, so you can always keep up-to-date with your state, and even calculate ahead.
For the mining software, we choose XMRig. There are helpful guides on their site for mining with FinMiner (rebranded as Nanominer on Dec 29) or XMR-stak.
To install and run XMRig you might need to run
apt install cmake apt-get install xdg-utils
, but if you still miss something Ubuntu always helps with what you need to properly install your software.
To download and install XMRig, run the following lines:
mkdir xmrig cd xmrig wget https://github.com/nanopool/xmrig/releases/download/v2.8.1/xmrig-2.8.1-linux-CPU.tar.gz tar xzvf xmrig-2.8.1-linux-CPU.tar.gz
After this was successful you need to edit the config file (config.json). You need to replace “YOUR_XMR_ADDRESS.YOUR_PAYMENT_ID.YOUR_WORKER/YOUR_EMAIL”:
Where YOUR_XMR_ADDRESS is your valid Monero address. This is where nanopool will send the payouts. YOUR_PAYMENT_ID is an optional setting, that allows you to set a payment ID. YOUR_WORKER is also an optional setting, where you can name your worker. At YOUR_EMAIL you can set an email address where you want to receive notifications. This last setting is also optional.
If everything went smoothly, now you just need to run XMRig with:
Congratulations you now have a running VPS mining Monero!
It’s important to note, that if this is a remote server when you SSH into the machine the process will stop if you close the connection to the server. A handy solution is using tmux. It is easy to use and keeps the processes running in the background until you shut it down.
Just type tmux to start a new session start the mining there and you can exit with pressing ‘Ctrl’+’b’ and then ‘d’. You can safely close the SSH connection to your server, the mining will run inside the tmux session. If you connect next time, you can continue the work if you type ‘tmux attach‘.
AWS GPU Mining
As with most mining, GPU mining is more efficient for Monero. You can use AWS (Amazon Web Services) GPU accelerated servers to achieve this. You’ll need to follow these steps.
sudo apt-get update -y sudo apt-get upgrade -y linux-aws sudo apt-get install -y gcc make linux-headers-$(uname -r) sudo reboot wget http://us.download.nvidia.com/tesla/410.79/NVIDIA-Linux-x86_64-410.79.run sudo /bin/sh ./NVIDIA-Linux-x86_64-410.79.run sudo reboot
For the GPU accelerated server, we need a different mining software and the CUDA toolkit installed. Following the below steps, you can install these easily. (Please check the latest version available)
sudo wget https://developer.download.nvidia.com/compute/cuda/repos/ubuntu1804/x86_64/cuda-repo-ubuntu1804_10.0.130-1_amd64.deb sudo dpkg -i cuda-repo-ubuntu1804_10.0.130-1_amd64.deb sudo apt-key adv --fetch-keys https://developer.download.nvidia.com/compute/cuda/repos/ubuntu1804/x86_64/7fa2af80.pub sudo apt-get update sudo apt-get install cuda
With the CUDA toolkit successfully installed we can move to installing the mining software itself.
sudo apt-get install git build-essential cmake libuv1-dev libmicrohttpd-dev git clone https://github.com/xmrig/xmrig-nvidia.git cd xmrig-nvidia mkdir build cd build cmake .. -DOPENSSL_ROOT_DIR=/usr/include/openssl -DOPENSSL_LIBRARIES=/usr/include/openssl/lib make
With that you have your mining software installed. For the your config file you can use the https://config.xmrig.com/nvidia site. You might need to open the port that your pool is using. You can find those options at the security groups at AWS.
In conclusion, setting up a VPS that’s mining Monero is easy. However, similarly to most Bitcoin mining, it will not be profitable. This guide is just here as a fun exercise to do.