In this lab, we will try mining Monero, the de-centralizing cryptocurrency on our Ubuntu 20.04LTS VPS, CPU mining, using XMRig, the open-source miner.
We will start by:
- Update Our Ubuntu VPS/Server
- Building and Install The XMRig Miner
- Create Our Monero Cryptocurrency Wallet
- Configure the miner and start mining Monero
Step1: Update Ubuntu 20.04LTS VPS/Server
If you are not root, switch to the root shell by using sudo -i
# apt update # apt upgrade
Install Pre-Requested Package
As we will build our crypto mining software from the source, we need to make sure our Ubuntu is ready as a development environment and install the following packages.
Make sure all Linux required headers are ready
# apt install linux-headers-$(uname -r) -y
Make sure all of the Build-Essential development libraries and tools are installed
# apt install build-essential # apt install git cmake libuv1-dev libssl-dev libhwloc-dev
Step2: Building And Installing XMRig The Cryptocurrency Miner
XMRig is a CPU/GPU miner, but as always VPS resources are limited so we will use XMRing CPU miner mode.
Clone XMRig Project
# git clone https://github.com/xmrig/xmrig.git
Building XMRing from source
# mkdir xmrig/build && cd xmrig/build # cmake .. # make -j$(nproc)
After the building process is completed successfully, you will find the xmrig
executable miner binary file located at the same directory xmrig/build that we created while building in the above command.
Step3: Creating Our Monero Wallet
We can use MyMonero as our simple Monero cryptocurrency wallet, we will use the web-wallet version, and create a new one by this URL, then press the create a new button, then follow up the wallet creating process.
Now we have our Monero wallet address which we can use to keep Monero.
42WMDKmVzrKW5b4rbd9tvHjJr4o6Tr3EA2pE7R8zFHE1d6P7n7HB7wrCZHDUeyauMLhwzpPkBiw6gRWCwgTxFZqAUKkTh7P
Step4: Configure The XMRig Miner
We can create the XMRig JSON configuration file using the XMRing configuration wizard, start with pressing the + New configuration button
While configuration wizard we will need to Add Pool: we can optionally select the HashVault.Pro and pass our Monero wallet address to it
Now go to the Result tab to get the JSON configuration file contents:
PS: We can less/ignore the donation percentage by going to the Misc tab, then set the value to 1 or delete the donation “donate-level”: 5, the line from the output configuration JSON File.
The output JSON configuration will be
{
"autosave": true,
"donate-level": 5,
"cpu": true,
"opencl": false,
"cuda": false,
"pools": [
{
"url": "pool.hashvault.pro:443",
"user": "42WMDKmVzrKW5b4rbd9tvHjJr4o6Tr3EA2pE7R8zFHE1d6P7n7HB7wrCZHDUeyauMLhwzpPkBiw6gRWCwgTxFZqAUKkTh7P",
"keepalive": true,
"tls": true
}
]
}
Of course, do not forget to replace the Monero wallet address with yours.
Now you can create your JSON Config config.json
with the above content to pass to the XMRig.
Step5: Start Mining Monero
We can start mining Monero using the XMRig directly, pass the wallet address and the mining pool to the miner as the following
# ./xmrig -o pool.hashvault.pro:443 -u 42WMDKmVzrKW5b4rbd9tvHjJr4o6Tr3EA2pE7R8zFHE1d6P7n7HB7wrCZHDUeyauMLhwzpPkBiw6gRWCwgTxFZqAUKkTh7P -k --tls
, or using the above configuration files that we created in the previous step as the following
# ./xmrig -c config.json
To see full XMRig command options please check the URL
Step6: Tracking Our Mining State
As we are involved in the HashVault pool, we can monitor and Track our wallet address live state from the HashVault Dashboard URL