XMRig is a Monero CPU miner written in C++. It is the best miner for Monero in my opinion. XMRig gives best possible hashrate for your rigs with Ubuntu hugepages support. I’ll show you steps to install XMRig CPU Miner on Ubuntu 16.04 with hugepages enabled.
XMRig is an open source software and available to download from official github repository. We’ll download this shortly. But first you should connect to your Ubuntu command line. If you’re on Ubuntu desktop, hit CtrlAlt + T keys to launch CLI. If you’re connecting to a Ubuntu from Windows, use Putty to connect over SSH. Make sure to login with root user account.
Prepare Ubuntu 16.04 to Install XMRig CPU Miner
Before you can install XMRig on your Ubuntu 16.04 machine, there are few dependencies you should install. Let’s start by installing software-properties-common.
apt install software-properties-common
There is a good chance that software-properties-common is already installed on your system. Either way, above command will make sure you have the latest version on your machine.
Next we’ll install gcc 7 for a small performance boost. Following command will add Jonathon F’s GCC 7.1 PPA to your system.
Update apt cache,
apt update apt upgrade
Now install dependencies,
apt install git build-essential cmake libuv1-dev libssl-dev libmicrohttpd-dev gcc-7 g++-7
This can take few minutes. We’ll do a quick reboot when dependencies are finished installing.
Your Ubuntu 16.04 machine will be ready for XMRig CPU Miner when it comes back online.
Install XMRig CPU Miner on Ubuntu 16.04
We can now build XMRig CPU Miner Ubuntu 16.04. We will use Git to download the miner.
git clone https://github.com/xmrig/xmrig.git
Navigate to downloaded directory,
Create a new directory named build inside xmrig directory,
Navigate build directory,
Build XMRig with gcc 7,
cmake .. -DCMAKE_C_COMPILER=gcc-7 -DCMAKE_CXX_COMPILER=g++-7 make
That should do it. You can start mining now. But we’ll do one more thing to get 5% – 10% hashrate boost.
Enable Hugepages on Ubuntu
First check if hugepages are available on your system with following command.
Currently active option is enclosed in brackets. In the above output, I have hugepages set to madvise. Which means hugepages are available on my system. If you see [never] in your output, you can’t use hugepages. So skip this part.
I prefer to allocate hugepages equaling to number of CPU cores I’m mining with. If I’m mining with 8 cores, I’ll set hugepages to 8 with following command.
sysctl -w vm.nr_hugepages=8
I haven’t looked into hugepages much. So i’m no expert on that. Feel free to research more and adjust accordingly. This gives me good enough result not to bother with it.
Start mining Monero with XMRig CPU Miner on Ubuntu 16.04
Following is the command I run to start mining,
/root/xmrig/build/./xmrig -a cryptonight -o stratum+tcp://pool.supportxmr.com:5555 -u MoneroAddress -p MinerIdentifier:Email -t 8
This starts mining with 8 cores. There are more configuration option to the miner. You can view them with following command,
That’s it. You can further optimize your mining with xmr-node-proxy if you have more than 10 miners. Happy mining!!