CentOS7安装xmr-stak挖矿门罗币

首先关闭CentOS的SELinux功能和防火墙

#systemctl disable firewalld.service   禁用firewalld服务
修改 /etc/selinux/config 文件中的 SELINUX="disabled" ,然后重启。

配置网卡:

    编辑/etc/sysconfig/network-scripts/网卡配置文件

    BOOTPROTO=static

    ONBOOT=yes

    IPADDR=xxx

    NETMASK=xxx

    GATEWAY=xxx

    编辑/etc/resolve.conf

    nameserver 114.114.114.114

编译和安装xmr-stak,cmake3命令后面的参数声明只使用CPU进行挖矿

yum install -y centos-release-scl epel-release
yum install -y cmake3 devtoolset-4-gcc* hwloc-devel libmicrohttpd-devel openssl-devel make git
scl enable devtoolset-4 bash
git clone https://github.com/fireice-uk/xmr-stak.git

注意,从github上克隆完成后,要修改一下默认的作者抽费率的设置,否则默认的作者要从你挖的结果中抽掉2%,修改文件xmr-stak/xmrstak/donate-level.hpp中默认的2.0改为0.0

constexpr double fDevDonationLevel = 0.0 / 100.0;
继续下面的编译操作
mkdir xmr-stak/build
cd xmr-stak/build
cmake3 -DCUDA_ENABLE=OFF -DOpenCL_ENABLE=OFF ..
make install

PS:对于不需要编译直接拷过来xmr-stak用的话,只需要安装以下包即可

hwloc-devel libmicrohttpd-devel openssl-devel

编译好的64位CentOS7.x适用的xmr-stak程序(已删除2%开发者费率设置)已上传至CSDN资源:

https://download.csdn.net/download/lpwmm/10370863

更新适用于64位CentOS 6.x系统的xmr-stak程序(已删除2%开发者费率设置)下载地址:

https://download.csdn.net/download/lpwmm/10370879

编写后台运行的脚本:

#vi /opt/runXMR.sh
添加内容如下:
cd /opt/bin
nohup /opt/bin/xmr-stak >/dev/null 2>&1 &
自行修改上面的具体程序位置

运行./xmr-stak根据向导提示录入相关配置信息

[root@seafile bin]# ./xmr-stak 
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
666
Configuration stored in file 'config.txt'
Please enter:
- Please enter the currency that you want to mine: 
        - aeon7
        - cryptonight
        - cryptonight_lite
        - edollar
        - electroneum
        - graft
        - intense
        - karbo
        - monero7
        - stellite
        - sumokoin

monero7
- Pool address: e.g. pool.usxmrpool.com:3333
mine.ppxxmr.com:3333
- Username (wallet address or pool login):
46TEUwhbvqGY5wMzpdZ5q6b1zNdVGibrcdSyc1e2uTaJ2FTz2CpPy7UZNUiw7oy2gVZGB6U1CQCXg7yk4JcC4Z5yHfC45bY
- Password (mostly empty or 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'
[2018-04-17 18:23:20] : Your CPU doesn't support hardware AES. Don't expect high hashrates.
[2018-04-17 18:23:20] : MEMORY ALLOC FAILED: mmap failed
[2018-04-17 18:23:20] : MEMORY ALLOC FAILED: mmap failed
[2018-04-17 18:23:20] : MEMORY ALLOC FAILED: mmap failed
[2018-04-17 18:23:20] : MEMORY ALLOC FAILED: mmap failed
[2018-04-17 18:23:20] : MEMORY ALLOC FAILED: mmap failed
-------------------------------------------------------------------
xmr-stak 2.4.2 e10e8e6

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 2.0%

You can use following keys to display reports:
'h' - hashrate
'r' - results
'c' - connection
-------------------------------------------------------------------
[2018-04-17 18:23:20] : Mining coin: monero7
[2018-04-17 18:23:20] : CPU configuration stored in file 'cpu.txt'
[2018-04-17 18:23:20] : Starting 2x thread, affinity: 0.
[2018-04-17 18:23:20] : hwloc: memory pinned
[2018-04-17 18:23:20] : Starting 2x thread, affinity: 1.
[2018-04-17 18:23:20] : MEMORY ALLOC FAILED: mmap failed
[2018-04-17 18:23:20] : MEMORY ALLOC FAILED: mmap failed
[2018-04-17 18:23:20] : hwloc: memory pinned
[2018-04-17 18:23:20] : Fast-connecting to mine.ppxxmr.com:3333 pool ...
[2018-04-17 18:23:20] : MEMORY ALLOC FAILED: mmap failed
[2018-04-17 18:23:20] : MEMORY ALLOC FAILED: mmap failed
[2018-04-17 18:23:20] : Pool mine.ppxxmr.com:3333 connected. Logging in...
[2018-04-17 18:23:20] : Difficulty changed. Now: 8000.
[2018-04-17 18:23:20] : Pool logged in.
[2018-04-17 18:23:21] : New block detected.

这里我设置了使用666端口运行web服务,可以远程查看当前的挖矿状态,矿池用的是皮皮虾,一个国内的,速度不错,先挖挖试试吧,网站地址:https://xmr.c1d2.com,矿池分了好几个,可以根据自己机器性能来选,我这台垃圾虚拟机,就用最low的矿池了,地址mine.ppxxmr.com:3333,其他矿池地址:

CentOS7安装xmr-stak挖矿门罗币_第1张图片

这样就开始挖矿了,但是上面出现了有个内存分配的错误

MEMORY ALLOC FAILED: mmap failed

还需要设置一下系统的参数

[root@seafile bin]# vi /etc/security/limits.conf

增加内容:
* soft memlock 262144

* hard memlock 262144

再执行

# sysctl -w vm.nr_hugepages=128    

再运行xmr-stak就不再提示内存的报错了

这时候本地打开浏览器访问服务器的地址:666就可以看到当前的挖矿状态:

CentOS7安装xmr-stak挖矿门罗币_第2张图片

你可能感兴趣的:(软件应用,Linux)