FreeBSD Install XMRIG And CPUMiner For Mining Crypto

This article will explain how to install and configure XMRIG and CPUMiner using the FreeBSD system. XMRIG and CPUMiner are applications commonly used by miners to mine crypto currency coins.


List of contents:
1. Understanding XMRIG and CPUMiner
2. Installing XMRIG on FreeBSD
3. CPUMiner Installation on FreeBSD
4. Solo Mining
5. Pool Mining


1. Understanding XMRIG and CPUMiner

At the beginning, this application was often used for mining Monero coins, but gradually as more and more new coins appeared, XMRIG was not only used for mining Monero coins. Many other coins based on the CryptoNight algorithm can be mined with XMRIG.

XMRig is a high-performance Monero (XMR) miner. Mining with XMRIG can be done using just a CPU or can also be done with the help of a VGA Card such as an NVIDIA-GPU/AMD-GPU. Even though the results obtained by mining with a CPU are very small compared to using NVIDIA-GPU/AMD-GPU, there are still many miners who mine using CPUs.

XMRIG can be run in almost all applications such as Windows, FreeBSD, DragonflyBSD, Linux and macOS. In general, miners prefer to use XMRIG with Ubuntu Linux and Microsoft Windows systems.

XMRIG is an open source application with very high performance and maximum hash reading capabilities so that it can be used for various coins with the RandomX, KawPow, CryptoNight and GhostRider integrated CPU/GPU miner platforms and RandomX benchmarks. Not only that, XMRig CPU Miner can be used to mine CryptoNight variants with CPU. Miner allows you to set up failover backup pools, smart automatic CPU configuration, and it is open source. The default fee is 5%, but can be adjusted to 1%.

Meanwhile, CPUMiner is a software program used to generate cryptocurrency using a central processing unit (CPU). Special CPUs and software are required to mine some cryptocurrencies, thanks to their processing speed.

There are various software programs developed for mining purposes, with each offering different features to miners. There are two main mining models: solo mining or participating in a mining pool. The last option is recommended as it can help reap better results and share mining efforts with other users.

CPUminer is a simple client program that performs Pooled Mining or solo mining. The program receives proposed block data from the server, which tries to guess the nonce value that will produce a valid block. If a block hash with at least 32 consecutive zero bits is found, the block data containing the guessed nonce value is sent back to the server. If used in Pooled Mining mode, these blocks are called "shares" because the server is supposed to credit the registered user's account, according to the number of shares the user has contributed, and finally transfer a certain amount of coins to the address of the user mining in the pool.

CPU Miner has been largely replaced by Con Kolivas's cgminer fork (with GPU support) and Luke-Jr's BFGMiner fork (with FPGA support).


2. XMRIG installation

On a FreeBSD system, the XMRIG installation process using a CPU is not too complicated. Difficulties for miners will arise when mining XMRIG using a VGA Card, because apart from having to install the XMRIG program, miners also have to install a VGA Card driver according to the VGA brand.

Below is how to install XMRIG on a FreeBSD system.

root@ns1:~ # pkg update
root@ns1:~ #
pkg upgrade
root@ns1:~ #
pkg install git libuv openssl automake libtool autoconf
root@ns1:~ #
pkg install cmake hwloc libmicrohttpd

The script above is to update the FreeBSD software system and install the repositories needed by XMRIG to run on FreeBSD. To install XMRIG you have to download the XMRIG master file, you can download it from the official XMRIG website or Github. In this article we will download the master XMRIG file from Github, and will place it in the /usr/local/etc folder. Follow the steps below to install XMRIG.

root@ns1:~ # cd /usr/local/etc
root@ns1:/usr/local/etc #
git clone https://github.com/xmrig/xmrig.git
Cloning into 'xmrig'...
remote: Enumerating objects: 27868, done.
remote: Counting objects: 100% (202/202), done.
remote: Compressing objects: 100% (119/119), done.
remote: Total 27868 (delta 99), reused 153 (delta 82), pack-reused 27666
Receiving objects: 100% (27868/27868), 13.22 MiB | 9.00 MiB/s, done.
Resolving deltas: 100% (20409/20409), done.

root@ns1:/usr/local/etc #
cd xmrig
root@ns1:/usr/local/etc/xmrig #
mkdir build && cd build
root@ns1:/usr/local/etc/xmrig/build #
cmake ..
root@ns1:/usr/local/etc/xmrig/build #
make -j4

Script "make -j4" means the number of processor threads used, because in this installation I used a processor with 4 threads, so write -j4. If you are using a processor with 8 threads, the script will be "make -j8".

If the above installation fails, use another method.

root@ns1:/usr/local/etc # cd xmrig
root@ns1:/usr/local/etc/xmrig #
cd build
root@ns1:/usr/local/etc/xmrig/build #
cmake -DCMAKE_C_COMPILER=gcc -DCMAKE_CXX_COMPILER=g++ ..
root@ns1:/usr/local/etc/xmrig/build #
make -j4

After the installation is complete, you are required to create a json file. Json files are files that contain coin addresses, mining pool users and others. We recommend that you create 3 jason files. The following is a guide to creating 3 Jason files with different folders.

root@ns1:~ # touch /usr/local/etc/xmrig/build/config.json
root@ns1:~ #
touch /root/.xmrig.json
root@ns1:~ #
mkdir /root/.config
root@ns1:~ #
touch /root/.config/xmrig.json

In the script above we create 3 json files, namely config.json, .xmrig.json and xmrig.json. After you have created the json file, enter the script below.

{
    "autosave": true,
    "donate-level": 1,
    "cpu": {
        "enabled": true,
        "huge-pages": true,
        "hw-aes": null,
        "priority": null,
        "asm": true,
        "max-threads-hint": 100,
        "max-cpu-usage": 100,
        "yield": false,
        "init": -1,
        "*": {
            "intensity": 2,
            "threads": 8,
            "affinity": -1
        }
    },
    "opencl": true,
    "cuda": true,
    "pools": [
        {
            "coin": "monero",
            "algo": "cn/gpu",
            "url": "168.235.86.33:3393",
            "user": "SK_QzApkbVGsAxyQykaWSnEF.umaroh1976",
            "pass": "x",
            "tls": false,
            "keepalive": true,
            "nicehash": false
        }
    ]
}

The script above is just an example, you can adjust it depending on which mining pool you will use. In the script above I use the mining pool from autofaucet.org. If you use another mining pool, what you need to replace is the red script.

Now you can do mining. Below is how to mine XMRIG, follow the script below.

root@ns1:~ # cd /usr/local/etc/xmrig/build
root@ns1:/usr/local/etc/xmrig/build #
./xmrig
* ABOUT XMRig/6.20.0 clang/14.0.5
* LIBS libuv/1.46.0 OpenSSL/1.1.1u hwloc/1.11.13
* HUGE PAGES supported
* 1GB PAGES unavailable
* CPU Intel(R) Core(TM)2 Duo CPU E8400 @ 3.00GHz (1) 64-bit -AES
L2:6.0 MB L3:0.0 MB 2C/2T NUMA:1
* MEMORY 1.1/1.7 GB (65%)
DIMM0: 1 GB DDR2 @ 667 MHz
DIMM1: 1 GB DDR2 @ 667 MHz
* MOTHERBOARD Acer - MMCP73VEM
* DONATE 1%
* ASSEMBLY auto:none
* POOL #1 168.235.86.33:3393 coin Monero
* COMMANDS hashrate, pause, resume, results, connection
[2023-08-03 13:31:24.966] config configuration saved to: "/usr/local/etc/xmrig/build/config.json"

Script ./xmrig (red) is to start mining


3. CPUMiner Installation

To install CPUMiner on FreeBSD, we have to download the CPUMiner master file. In this article we will download the CPUMiner master file from Github. Follow these steps.

root@ns1:~ # cd /usr/local/etc
root@ns1:/usr/local/etc #
git clone https://github.com/pooler/cpuminer.git
Cloning into 'cpuminer'...
remote: Enumerating objects: 1529, done.
remote: Total 1529 (delta 0), reused 0 (delta 0), pack-reused 1529
Receiving objects: 100% (1529/1529), 628.14 KiB | 1.36 MiB/s, done.
Resolving deltas: 100% (995/995), done.

In the script above, the downloaded file is stored in the /usr/local/etc folder. After the download process is complete, the next step is to install CPUMiner. Follow the script below to carry out the CPUMiner installation process.

root@ns1:~ # cd /usr/local/etc
root@ns1:/usr/local/etc #
cd cpuminer
root@ns1:/usr/local/etc/cpuminer #
./autogen.sh
root@ns1:/usr/local/etc/cpuminer #
./configure
root@ns1:/usr/local/etc/cpuminer #
make
root@ns1:/usr/local/etc/cpuminer #
make install
Making install in compat
Making install in jansson
./install-sh -c -d '/usr/local/bin'
/usr/bin/install -c minerd '/usr/local/bin'
./install-sh -c -d '/usr/local/share/man/man1'
/usr/bin/install -c -m 644 minerd.1 '/usr/local/share/man/man1'

To start mining, you can run the ./minerd script file. The following is an example of how to start mining with CPUMiner with the mining pool "mining-dutch.nl"

root@ns1:~ # cd /usr/local/etc/cpuminer
root@ns7:/usr/local/etc/cpuminer # ./minerd --url=stratum+tcp://singapore.mining-dutch.nl:8888 --userpass=umaroh1076.worker1:d=128000 [2024-01-10 06:56:14] Binding thread 1 to cpu 1 [2024-01-10 06:56:14] Binding thread 0 to cpu 0 [2024-01-10 06:56:14] Starting Stratum on stratum+tcp://singapore.mining-dutch.nl:8888 [2024-01-10 06:56:14] 2 miner threads started, using 'scrypt' algorithm. [2024-01-10 06:56:20] Stratum requested work restart [2024-01-10 06:56:21] thread 1: 4104 hashes, 6.19 khash/s [2024-01-10 06:56:21] thread 0: 4104 hashes, 5.07 khash/s [2024-01-10 06:56:30] Stratum requested work restart [2024-01-10 06:56:30] thread 1: 43248 hashes, 4.90 khash/s [2024-01-10 06:56:30] thread 0: 44592 hashes, 5.15 khash/s [2024-01-10 06:56:31] Stratum requested work restart [2024-01-10 06:56:31] thread 1: 4560 hashes, 6.33 khash/s [2024-01-10 06:56:31] thread 0: 3816 hashes, 5.09 khash/s [2024-01-10 06:56:44] Stratum requested work restart [2024-01-10 06:56:44] thread 1: 85968 hashes, 6.34 khash/s [2024-01-10 06:56:44] thread 0: 69912 hashes, 5.17 khash/s [2024-01-10 06:56:46] Stratum requested work restart [2024-01-10 06:56:46] thread 1: 10044 hashes, 6.34 khash/s [2024-01-10 06:56:46] thread 0: 8256 hashes, 5.21 khash/s [2024-01-10 06:56:49] Stratum requested work restart [2024-01-10 06:56:49] thread 0: 15984 hashes, 4.67 khash/s [2024-01-10 06:56:49] thread 1: 21708 hashes, 6.33 khash/s [2024-01-10 06:56:55] Stratum requested work restart [2024-01-10 06:56:55] thread 0: 24804 hashes, 4.63 khash/s [2024-01-10 06:56:55] thread 1: 33924 hashes, 6.33 khash/s [2024-01-10 06:57:08] Stratum requested work restart [2024-01-10 06:57:08] thread 0: 63096 hashes, 4.69 khash/s [2024-01-10 06:57:08] thread 1: 85104 hashes, 6.33 khash/s


In the script --url=http://myminingpool.com:9332 --userpass=my.worker:password, you must change it according to the name of the mining pool you are using.

If you are focused on becoming a crypt currency miner, it is recommended to use a VGA Card for mining. Because with VGA Carad the number of coins obtained is faster because the hash produced by the VGA Card is higher compared to the CPU Processor.
Iwan Setiawan

I Like Adventure: Mahameru Mount, Rinjani Mount I Like Writer FreeBSD

Post a Comment

Previous Post Next Post