首先关闭CentOS的SELinux功能和防火墙
建议升级gcc到7.3
安装环境
yum install centos-release-scl epel-release
yum install cmake3 devtoolset-7-gcc* hwloc-devel libmicrohttpd-devel openssl-devel make git -y
scl enable devtoolset-7 bash
git clone https://github.com/fireice-uk/xmr-stak.git
mkdir xmr-stak/build
cd xmr-stak/build
cmake3 -DCMAKE_LINK_STATIC=ON -DXMR-STAK_COMPILE=generic -DCUDA_ENABLE=OFF -DOpenCL_ENABLE=OFF ..
make install
如果出现错误
[root@xuan xmr-stak]# cmake3 . -DCUDA_ENABLE=OFF -DOpenCL_ENABLE=OFF CMake Error at CMakeLists.txt:36 (message): g++ version must be at least 5.1! -- Configuring incomplete, errors occurred! See also "/root/xmr/xmr-stak/CMakeFiles/CMakeOutput.log".
但是查看g++的版本却是
[root@xuan build]# g++ --version g++ (GCC) 7.3.1 20180303 (Red Hat 7.3.1-5) Copyright (C) 2017 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
这种情况可能是操作中,把GCC旧版本的4.8.5的信息记录到CMakeCache.txt,升级后GCC 7.3.1后,CMakeCache.txt中的历史信息影响cmake的判断,因此需要把CMakeCache.txt文件删除,并重新执行命令:cmake … 。
编译好了以后,我们就到 bulud/bin 目录下面执行 ./xmr-stak 就可以了 .如图
[root@xuan bin]# ./xmr-stak Use simple setup method? (Y/n) y Configuration stored in file 'config.txt' Please enter: - Please enter the currency that you want to mine: - bbscoin - bittube - cryptonight - cryptonight_bittube2 - cryptonight_masari - cryptonight_haven - cryptonight_heavy - cryptonight_lite - cryptonight_lite_v7 - cryptonight_lite_v7_xor - cryptonight_r - cryptonight_superfast - cryptonight_turtle - cryptonight_v7 - cryptonight_v8 - cryptonight_v8_double - cryptonight_v8_half - cryptonight_v8_reversewaltz - cryptonight_v8_zelerius - cryptonight_v7_stellite - cryptonight_gpu - cryptonight_conceal - graft - haven - lethean - masari - qrl - ryo - torque - plenteum - zelerius
输入相关信息后就进行挖矿了,如果后面要修改配置,可以编辑pools.txt,config.txt后重新启动就可以了
但是如果需要后台常驻挖矿,可以先安装screen,之后再screen中运行挖矿程序:
yum -y install screen
screen
./xmr-stak
之后ctrl+A,松开后按下d,实现后台挖矿。如果要查看screen的运行程序,可以输入
screen -ls
查看挖矿效率,可以进入nanopool,在右上角粘贴进自己的钱包地址之后搜索来查看挖矿结果
https://xmr.nanopool.org/#
# 后台运行
nohup ~/xmr-stak/build/bin/xmr-stak &
# 关闭
ps -a|grep xmr
kill PID
pool.supportxmr.com:5555
修改cpu
vim /root/xmr-stak/build/bin/cpu.txt
# 将cpu的0 1线程用来挖矿,具体的可以根据情况设置,安装时会自动配置,可不更改
"cpu_threads_conf" :
[
{ "low_power_mode" : false, "no_prefetch" : true, "affine_to_cpu" : 0 },
{ "low_power_mode" : false, "no_prefetch" : true, "affine_to_cpu" : 1 },
],
总结:cpu方式效率太低了,基本挖不到。
参考:
https://blog.csdn.net/Doudou_Mylove/article/details/109443322
https://zhuanlan.zhihu.com/p/32378890
https://article.itxueyuan.com/E0mnr
https://mengniuge.com/monero-new.html

浙公网安备 33010602011771号