因公众号粉丝留言说门罗币挖坑遇到很多坑,故而实战此篇仅作技术交流及内容留存。
基于Linux平台
测试环境
Ubuntu 18.04 LTS
Intel(R) Xeon(R) CPU E5-2680 v2 @ 2.80GHz 单核
修改本地源
因国内阿里、清华及其他旧的源均存在一些坑点,经过测试建议设置如下源
# See http://help.ubuntu.com/community/UpgradeNotes for how to upgrade to
# newer versions of the distribution.
deb http://us.archive.ubuntu.com/ubuntu/ bionic main restricted
# deb-src http://us.archive.ubuntu.com/ubuntu/ bionic main restricted
## Major bug fix updates produced after the final release of the
## distribution.
deb http://us.archive.ubuntu.com/ubuntu/ bionic-updates main restricted
# deb-src http://us.archive.ubuntu.com/ubuntu/ bionic-updates main restricted
## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu
## team. Also, please note that software in universe WILL NOT receive any
## review or updates from the Ubuntu security team.
deb http://us.archive.ubuntu.com/ubuntu/ bionic universe
# deb-src http://us.archive.ubuntu.com/ubuntu/ bionic universe
deb http://us.archive.ubuntu.com/ubuntu/ bionic-updates universe
# deb-src http://us.archive.ubuntu.com/ubuntu/ bionic-updates universe
## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu
## team, and may not be under a free licence. Please satisfy yourself as to
## your rights to use the software. Also, please note that software in
## multiverse WILL NOT receive any review or updates from the Ubuntu
## security team.
deb http://us.archive.ubuntu.com/ubuntu/ bionic multiverse
# deb-src http://us.archive.ubuntu.com/ubuntu/ bionic multiverse
deb http://us.archive.ubuntu.com/ubuntu/ bionic-updates multiverse
# deb-src http://us.archive.ubuntu.com/ubuntu/ bionic-updates multiverse
## N.B. software from this repository may not have been tested as
## extensively as that contained in the main release, although it includes
## newer versions of some applications which may provide useful features.
## Also, please note that software in backports WILL NOT receive any review
## or updates from the Ubuntu security team.
# deb http://us.archive.ubuntu.com/ubuntu/ bionic-backports main restricted universe multiverse
# deb-src http://us.archive.ubuntu.com/ubuntu/ bionic-backports main restricted universe multiverse
## Uncomment the following two lines to add software from Canonical's
## 'partner' repository.
## This software is not part of Ubuntu, but is offered by Canonical and the
## respective vendors as a service to Ubuntu users.
# deb http://archive.canonical.com/ubuntu bionic partner
# deb-src http://archive.canonical.com/ubuntu bionic partner
deb http://security.ubuntu.com/ubuntu bionic-security main restricted
# deb-src http://security.ubuntu.com/ubuntu bionic-security main restricted
deb http://security.ubuntu.com/ubuntu bionic-security universe
# deb-src http://security.ubuntu.com/ubuntu bionic-security universe
deb http://security.ubuntu.com/ubuntu bionic-security multiverse
# deb-src http://security.ubuntu.com/ubuntu bionic-security multiverse
环境部署
apt-get update
apt-get upgra -y
apt-get install git build-essential cmake libuv1-dev libssl-dev libhwloc-dev
git clone https://github.com/xmrig/xmrig.git
mkdir xmrig/build && cd xmrig/build
cmake ..
make -j$(nproc)
自定义赞助费
cd xmrig/src
vim donate.h
将如下内容修改为0或自定义
constexpr const int kDefaultDonateLevel = 0;
constexpr const int kMinimumDonateLevel = 0;
配置向导
进入 https://xmrig.com/wizard 选择New configuration
选择矿池
添加矿池信息
根据需求选择,默认只有CPU
设置赞助费,默认最低为1%,可按照上面的说明修改脚本,执行后不影响实际挖矿结果依然为自定义结果
配置结果展示,实战中推荐用下面的命令模式进行测试,除非对此文件很熟悉,可下载Config文件并编辑执行
配置hugepages
打开hugepages后算力能提升大概30%左右
core=`nproc --all`
sudo bash -c "echo vm.nr_hugepages=$core >> /etc/sysctl.conf"
效果
直接通过命令的方式进行执行【注:需要先执行一遍,再关闭,会在本地生成config.json文件,可自定义配置文件】
./xmrig -o sg.minexmr.com:443 -u 钱包地址 -k --tls --rig-id 小生观察室
因用单核CPU去挖,所以对应的miner不会很多在600左右。
基于Windows平台
测试环境
WindowsServer2008R2
Intel(R) Xeon(R) CPU E5-2690 v3 @ 2.60GHz 8核
环境部署
https://github.com/xmrig/xmrig/releases
选择xmrig-6.7.2-msvc-win64.zip版本
下载至本地并解压,将xmrig的配置向导中最后一步生成的Windows命令复制并修改start.cmd文件。
配置向导过程与Ubuntu一致,此处忽略重复步骤!!!
自定义赞助费
修改config.json文件中donate-level": 0或在命令行中添加 --donate-level 0
配置hugepages
在本地安全策略下启动锁定内存页并添加账户
- 最简单的方法:以管理员身份运行一次矿机,然后重新启动
- 手动配置可参考此处 https://docs.microsoft.com/en-us/sql/database-engine/configure-windows/enable-the-lock-pages-in-memory-option-windows?redirectedfrom=MSDN&view=sql-server-ver15
效果
直接通过命令的方式进行执行【注:需要先执行一遍,再关闭,会在本地生成config.json文件,可自定义配置文件】
xmrig.exe -o sg.minexmr.com:443 -u 钱包地址 -k --tls --rig-id 小生观察室
8核CPU也只在2300左右