环境:2cpu,2G,centos7
首先关闭CentOS的SELinux功能和防火墙
建议升级gcc到7.3:https://lijunmin.blog.csdn.net/article/details/102455127
安装依赖:
yum install centos-release-scl epel-release -y
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
vim xmr-stak/xmrstak/donate-level.hpp
constexpr double fDevDonationLevel = 0.0 / 100.0;
cd xmr-stak/
cmake3 . -DCUDA_ENABLE=OFF -DOpenCL_ENABLE=OFF
#如果有报错类似如:`GLIBCXX_3.4.21' not found
解决方法:
cp /usr/local/src/gcc-7.3.0/gcc-build/prev-x86_64-pc-linux-gnu/libstdc++-v3/src/.libs/libstdc++.so.6.0.24 /usr/lib64/
cd /usr/lib64/
rm -fr libstdc++.so.6
ln -s libstdc++.so.6.0.24 libstdc++.so.6
如果没报错执行下面命令:
make install
内存分配调整:
vim /etc/security/limits.conf
* soft memlock 262144
* hard memlock 262144
开始挖矿:
cd bin/
./xmr-stak
1、输入0 回车
2、输入cryptonight_v7 回车 xmr-jp1.nanopool.org:14444
#矿池:https://help.nanopool.org/category/8-monero-xmr-pool
3、输入钱包地址 回车
4、输入 x 回车 或者直接 回车
5、直接回车
6、输入n 回车
7、输入n 回车
8、输入n 回车
实践:
[root@localhost bin]# ./xmr-stak
Use simple setup method? (Y/n)
n
Please enter:
- Do you want to use the HTTP interface?
Unlike the screen display, browser interface is not affected by the GPU lag.
#If you don't want to use it, please enter 0, otherwise enter port number that the miner should listen on
0
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
cryptonight_v7
- Pool address: e.g. pool.example.com:3333
xmr-jp1.nanopool.org:14444
- Username (wallet address or pool login):
monero:48JoMFPaehYdzB1RQnvh7daftRr3QN8tVandRte8rRCiDNWSQiuY8h6A1dJRq3NuM3ZC3FcaviydmHoDSzYHuXuYRBr5A5b
- Password (mostly empty or x):
x
- Rig identifier for pool-side statistics (needs pool support). Can be empty:
- Does this pool port support TLS/SSL? Use no if unknown. (y/N)
n
- Do you want to use nicehash on this pool? (y/N)
n
- Do you want to use multiple pools? (y/N)
n
Pool configuration stored in file 'pools.txt'
-------------------------------------------------------------------
xmr-stak 2.10.8 67cf951
Brought to you by fireice_uk and psychocrypt under GPLv3.
Based on CPU mining code by wolf9466 (heavily optimized by fireice_uk).
Configurable dev donation level is set to 0.0%
-------------------------------------------------------------------
You can use following keys to display reports:
'h' - hashrate
'r' - results
'c' - connection
-------------------------------------------------------------------
Upcoming xmr-stak-gui is sponsored by:
##### ______ ____
## ## | ___ \ / _ \
# _ #| |_/ /_ _ ___ | / \/ _ _ _ _ _ _ ___ _ __ ___ _ _
# |_| #| /| | | | / _ \ | | | | | || '_|| '_|/ _ \| '_ \ / __|| | | |
# #| |\ \| |_| || (_) || \_/\| |_| || | | | | __/| | | || (__ | |_| |
## ## \_| \_|\__, | \___/ \____/ \__,_||_| |_| \___||_| |_| \___| \__, |
##### __/ | __/ |
|___/ https://ryo-currency.com |___/
This currency is a way for us to implement the ideas that we were unable to in
Monero. See https://github.com/fireice-uk/cryptonote-speedup-demo for details.
-------------------------------------------------------------------
[2020-10-23 14:18:39] : Mining coin: cryptonight_v7
[2020-10-23 14:18:39] : CPU configuration stored in file 'cpu.txt'
[2020-10-23 14:18:39] : Starting 2x thread, affinity: 0.
[2020-10-23 14:18:39] : hwloc: memory pinned
[2020-10-23 14:18:39] : Starting 2x thread, affinity: 1.
[2020-10-23 14:18:39] : hwloc: memory pinned
[2020-10-23 14:18:39] : Starting 2x thread, affinity: 2.
[2020-10-23 14:18:39] : hwloc: memory pinned
[2020-10-23 14:18:39] : Starting 2x thread, affinity: 3.
[2020-10-23 14:18:39] : hwloc: memory pinned
[2020-10-23 14:18:39] : Fast-connecting to xmr-jp1.nanopool.org:14444 pool ...
[2020-10-23 14:18:39] : Pool xmr-jp1.nanopool.org:14444 connected. Logging in...
[2020-10-23 14:18:40] : Difficulty changed. Now: 480045.
[2020-10-23 14:18:40] : Pool logged in.
[2020-10-23 14:18:40] : New block detected.
[2020-10-23 14:19:26] : New block detected.
[2020-10-23 14:19:35] : New block detected.
[2020-10-23 14:20:36] : New block detected.
[2020-10-23 14:21:36] : New block detected.
运行后可按H键 查看 当前算力
HASHRATE REPORT - CPU
| ID | 10s | 60s | 15m | ID | 10s | 60s | 15m |
| 0 | 16.0 | 15.7 | (na) | 1 | 15.9 | 15.8 | (na) |
| 2 | 16.0 | 15.8 | (na) | 3 | 15.8 | 15.6 | (na) |
Totals (CPU): 63.7 62.9 0.0 H/s
-----------------------------------------------------------------
Totals (ALL): 63.7 62.9 0.0 H/s
Highest: 64.5 H/s
-----------------------------------------------------------------
[2020-10-23 14:24:18] : New block detected.
执行完之后,机器将会开始挖矿。
但是如果需要后台常驻挖矿,可以先安装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方式效率太低了,基本挖不到。