您现在的位置是:首页 > 文章详情

CentOS7安装xmr-stak挖矿门罗币

日期:2018-05-04点击:1142

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

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

配置网卡:

  1. 编辑/etc/sysconfig/network-scripts/网卡配置文件
  2. BOOTPROTO=static
  3. ONBOOT=yes
  4. IPADDR=xxx
  5. NETMASK=xxx
  6. GATEWAY=xxx
  7. 编辑/etc/resolve.conf
  8. nameserver 114.114.114.114

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

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

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

  1. constexpr double fDevDonationLevel = 0.0 / 100.0;

继续下面的编译操作

  1. mkdir xmr-stak/build
  2. cd xmr-stak/build
  3. cmake3 -DCUDA_ENABLE=OFF -DOpenCL_ENABLE=OFF ..
  4. make install

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

  1. 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

编写后台运行的脚本:

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

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

  1. [root@seafile bin]# ./xmr-stak
  2. Please enter:
  3. - Do you want to use the HTTP interface?
  4. Unlike the screen display, browser interface is not affected by the GPU lag.
  5. If you don't want to use it, please enter 0, otherwise enter port number that the miner should listen on
  6. 666
  7. Configuration stored in file 'config.txt'
  8. Please enter:
  9. - Please enter the currency that you want to mine:
  10.         - aeon7
  11.         - cryptonight
  12.         - cryptonight_lite
  13.         - edollar
  14.         - electroneum
  15.         - graft
  16.         - intense
  17.         - karbo
  18.         - monero7
  19.         - stellite
  20.         - sumokoin
  21. monero7
  22. - Pool address: e.g. pool.usxmrpool.com:3333
  23. mine.ppxxmr.com:3333
  24. - Username (wallet address or pool login):
  25. 46TEUwhbvqGY5wMzpdZ5q6b1zNdVGibrcdSyc1e2uTaJ2FTz2CpPy7UZNUiw7oy2gVZGB6U1CQCXg7yk4JcC4Z5yHfC45bY
  26. - Password (mostly empty or x):
  27. - Rig identifier for pool-side statistics (needs pool support). Can be empty:
  28. - Does this pool port support TLS/SSL? Use no if unknown. (y/N)
  29. n
  30. - Do you want to use nicehash on this pool? (y/n)
  31. n
  32. - Do you want to use multiple pools? (y/n)
  33. n
  34. Pool configuration stored in file 'pools.txt'
  35. [2018-04-17 18:23:20] : Your CPU doesn't support hardware AES. Don't expect high hashrates.
  36. [2018-04-17 18:23:20] : MEMORY ALLOC FAILED: mmap failed
  37. [2018-04-17 18:23:20] : MEMORY ALLOC FAILED: mmap failed
  38. [2018-04-17 18:23:20] : MEMORY ALLOC FAILED: mmap failed
  39. [2018-04-17 18:23:20] : MEMORY ALLOC FAILED: mmap failed
  40. [2018-04-17 18:23:20] : MEMORY ALLOC FAILED: mmap failed
  41. -------------------------------------------------------------------
  42. xmr-stak 2.4.2 e10e8e6
  43. Brought to you by fireice_uk and psychocrypt under GPLv3.
  44. Based on CPU mining code by wolf9466 (heavily optimized by fireice_uk).
  45. Configurable dev donation level is set to 2.0%
  46. You can use following keys to display reports:
  47. 'h' - hashrate
  48. 'r' - results
  49. 'c' - connection
  50. -------------------------------------------------------------------
  51. [2018-04-17 18:23:20] : Mining coin: monero7
  52. [2018-04-17 18:23:20] : CPU configuration stored in file 'cpu.txt'
  53. [2018-04-17 18:23:20] : Starting 2x thread, affinity: 0.
  54. [2018-04-17 18:23:20] : hwloc: memory pinned
  55. [2018-04-17 18:23:20] : Starting 2x thread, affinity: 1.
  56. [2018-04-17 18:23:20] : MEMORY ALLOC FAILED: mmap failed
  57. [2018-04-17 18:23:20] : MEMORY ALLOC FAILED: mmap failed
  58. [2018-04-17 18:23:20] : hwloc: memory pinned
  59. [2018-04-17 18:23:20] : Fast-connecting to mine.ppxxmr.com:3333 pool ...
  60. [2018-04-17 18:23:20] : MEMORY ALLOC FAILED: mmap failed
  61. [2018-04-17 18:23:20] : MEMORY ALLOC FAILED: mmap failed
  62. [2018-04-17 18:23:20] : Pool mine.ppxxmr.com:3333 connected. Logging in...
  63. [2018-04-17 18:23:20] : Difficulty changed. Now: 8000.
  64. [2018-04-17 18:23:20] : Pool logged in.
  65. [2018-04-17 18:23:21] : New block detected.

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

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

  1. MEMORY ALLOC FAILED: mmap failed

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

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

增加内容:
* soft memlock 262144

* hard memlock 262144

再执行

  1. # sysctl -w vm.nr_hugepages=128

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

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

原文链接:https://www.centoschina.cn/course/introduction/10484.html
关注公众号

低调大师中文资讯倾力打造互联网数据资讯、行业资源、电子商务、移动互联网、网络营销平台。

持续更新报道IT业界、互联网、市场资讯、驱动更新,是最及时权威的产业资讯及硬件资讯报道平台。

转载内容版权归作者及来源网站所有,本站原创内容转载请注明来源。

文章评论

共有0条评论来说两句吧...

文章二维码

扫描即可查看该文章

点击排行

推荐阅读

最新文章