The wife wants to get into Cryptocurrency, so we get into Crypto.
None of them intersect, so I’ll start with my list first 🙂
First thing is to build a miner, and we’ll use an old Intel Core2 Quad Q9650 with 8GB RAM and an nVidia GeForce GT710 that I scrounged together from old parts.
Second thing is to choose a cryptocurrency to see how we can optimize it. Monero looks ezpz.
Third thing is to get familiar with xmrig and xmrig-cuda built and running. We’ll plan and build this in a Virtual Machine to make sure we have all our dependencies ironed out before committing this to an actual machine. We’ll steal some guidance from Litaiem Moatez and their first linkedin article to help us out.
Setup and Building xmrig
Our Hypervisor will be Oracle VirtualBox 6.1, and we’ll set up a VM with 4 vCPUs and 4GB RAM and a 20GB hard drive. We’ll install Rocky Linux 8.5 minimal and do the standard online yum updates. I’ll also set selinux=permissive in /etc/selinux/config and disable firewalld.
Next up is to install epel-release and enable powertools. For Rocky we need powertools enabled so we can build applications with source code (mainly installing -devel packages)
sudo yum update sudo yum install epel-release sudo dnf config-manager --set-enabled powertools
Next is to install build dependencies for xmrig and xmrig-cuda
sudo yum install wget git cmake gcc gcc-c++ hwloc-devel libuv-devel openssl-devel libstdc++-static
Clone and build xmrig
git clone https://github.com/xmrig/xmrig.git cd xmrig mkdir build cmake .. make
And then run
./xmrig --stress --cuda --opencl * ABOUT XMRig/6.16.4 gcc/8.5.0 * LIBS libuv/1.41.1 OpenSSL/1.1.1k hwloc/2.2.0 * HUGE PAGES supported * 1GB PAGES unavailable * CPU AMD Ryzen 5 5600X 6-Core Processor (1) 64-bit AES VM L2:2.0 MB L3:32.0 MB 4C/4T NUMA:1 * MEMORY 1.0/3.8 GB (26%) * DONATE 1% * ASSEMBLY auto:ryzen * POOL #1 stratum+ssl://randomx.xmrig.com:443 algo auto * COMMANDS hashrate, pause, resume, results, connection * OPENCL disabled (failed to load OpenCL runtime) * CUDA disabled (/home/user/xmrig/build/libxmrig-cuda.so: cannot open shared object file: No such file or directory)
Since we’re using an nVidia GeForce graphics card and we want to use GPU mining we’re going to be getting CUDA set up and kicking off, and xmrig has the resources to make the libxmrig-cuda.so file.
We’ll need the nVidia CUDA kit, which has a fancy download process. In their menus we’ll select: Linux / x86_64 / Centos / 8 / rpm (local). The results is a series of commands that they provide us to download and build up their kit:
wget https://developer.download.nvidia.com/compute/cuda/11.6.1/local_installers/cuda-repo-rhel8-11-6-local-11.6.1_510.47.03-1.x86_64.rpm sudo rpm -i cuda-repo-rhel8-11-6-local-11.6.1_510.47.03-1.x86_64.rpm sudo dnf clean all sudo dnf -y module install nvidia-driver:latest-dkms sudo dnf -y install cuda
After this we clone and build xmrig-cuda to make libxmrig-cuda.so
git clone https://github.com/xmrig/xmrig-cuda mkdir build cmake .. make
And finally (and fancifully) we’ll just symlink to the libxmrig-cuda.so from our xmrig executable:
cd ~/xmrig/build/ ln -s ../../xmrig-cuda/build/libxmrig-cuda.so
Executing to verify that the file doesn’t crap out our system:
./xmrig --stress --cuda --opencl [user@xmrig-cuda build]$ ./xmrig --stress --cuda --opencl [2022-03-19 10:37:37.160] Error UNKNOWN_ERROR when calling clGetPlatformIDs for number of platforms. [2022-03-19 10:37:37.160] No OpenCL platform found. * ABOUT XMRig/6.16.4 gcc/8.5.0 * LIBS libuv/1.41.1 OpenSSL/1.1.1k hwloc/2.2.0 * HUGE PAGES supported * 1GB PAGES unavailable * CPU AMD Ryzen 5 5600X 6-Core Processor (1) 64-bit AES VM L2:2.0 MB L3:32.0 MB 4C/4T NUMA:1 * MEMORY 3.6/3.8 GB (93%) * DONATE 1% * ASSEMBLY auto:ryzen * POOL #1 stratum+ssl://randomx.xmrig.com:443 algo auto * COMMANDS hashrate, pause, resume, results, connection [2022-03-19 10:37:37.358] Error UNKNOWN_ERROR when calling clGetPlatformIDs for number of platforms. [2022-03-19 10:37:37.358] No OpenCL platform found. * OPENCL disabled (selected OpenCL platform NOT found) * CUDA disabled (no devices)
Of course, since we’re in a VM this is not going to find our device, but we’ve planned enough to get this up and running!