闲置服务器进行门罗币挖矿

简介: 建站的时候租用了一台服务器,centos的操作系统。上面只放了两个网站, CPU使用率基本为零,偶尔操作的时候也只有40%,闲置是极大的浪费。资料说门罗币(monero)可以用cpu挖,那我也挖门罗币吧。

建站的时候租用了一台服务器,centos的操作系统。上面只放了两个网站, CPU使用率基本为零,偶尔操作的时候也只有40%,闲置是极大的浪费。资料说门罗币(monero)可以用cpu挖,那我也挖门罗币吧。
首先要有钱包地址,本地钱包或者在线钱包,我选择了后者,所以前者就不多说了。在线平台有很多,网友说这家还不错https://mymonero.com/https://hitbtc.com/,注册账号之后在account里找到钱包地址,下面会用到。
接下来要在服务器上安装挖矿工具,以下命令复制粘贴。安装运行需要的程序后,从fireice-uk获取源码并编译安装,此处可以修改捐赠比例,默认是2%。实际上安装的时候不用这么麻烦,但是原来的方法不记得了,这里记录一下这个低效的方法。
sudo yum -y install centos-release-scl epel-release
sudo yum -y install cmake3 devtoolset-7-gcc* hwloc-devel libmicrohttpd-devel openssl-devel make
sudo 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
然而总是在42%时出错,在网上找到了这个办法。清除后重新编译。后来发现这个错误也不是每次都会出现,这还看人品?
mkdir xmr-stak/build
cd xmr-stak/build
export CFLAGS=”-O2 -march=native -msse3 -fomit-frame-pointer -pipe”
export CHOST=”x86_64-pc-linux-gnu”
export CXXFLAGS=”${CFLAGS}”
export LDFLAGS=”-Wl,-O1″
cmake3 .. -DCUDA_ENABLE=OFF -DOpenCL_ENABLE=OFF
make -j 8

安装成功之后输入/usr/local/bin/cmake –version视版本略有不同,然后修改config.txt文件,在文件中的109行-111行填入矿池钱包地址等信息,端口3333难度较低笔记本也可以算,5555,7777和9999要求都较高,文件中有照着来就可以。将26行左右cpu_threads_conf及随后中括号前的星号删除。
输入接下来的命令就可以挖矿了。
cd /root/xmr-stak/bin/
./xmr-stak-cpu
但是有时会遇到MEMORY ALLOC FAILED: mmap failed的问题,停止运行后进入/etc/security/limits.conf,在文末添加

  • soft memlock 262144
  • hard memlock 262144
    保存并退出,输入下面的命令后重启。一般这样问题就解决了。

sysctl -w vm.nr_hugepages=128

有趣的是,有人对门罗币挖矿产生的电量进行了初步预测,尽管预测曲线和实际状况在18年底并不一致,最终结果和能耗估算很接近。19年三月,门罗币再次硬分叉,其能耗曲线已经展现一定程度的规律性。
参考文献:
https://maijiaoben.com/centos-monero.html
https://bitinfocharts.com/comparison/monero-hashrate.html
https://www.sciencedirect.com/science/article/pii/S0360544218322503

The followings are just for practicing English.
An ECS with centos installed was rent while creating websites. Only two websites are running on it. CPU usage usually is 0%, and sometimes 40% at most. Leaving it unused is a waste. It is sad that CPU calculation can obtain Monero, so let’s do it.
The first step is to get a wallet address. There are two methods to get it, local registration and online registration. The later one is chosen, so the previous one is neglected here. There are many platforms, such as https://mymonero.com/, and https://hitbtc.com/. After registration, you need to copy the address, which will be used later.
Copy and paste the commands to install mining tool on the server:
yum install centos-release-scl cmake3 hwloc-devel libmicrohttpd-devel openssl-devel
yum install devtoolset-4-gcc*
scl enable devtoolset-4 bash
git clone https://github.com/fireice-uk/xmr-stak-cpu xmr-stak
cd xmr-stak
cmake3 .
make install
After installation, check the version by input: /usr/local/bin/cmake –version. The commands may vary depending on the versions. Then, modify “config.txt”, input your pool address, your wallet address, and your password ID based on the examples at line 109-111, and delete the “*” at line 25-29 approximately. Port 3333 is the easiest for low & mid-range CPUs.
After these, you can start mining by input the following commands:
cd /root/xmr-stak/bin/
./xmr-stak-cpu
However, I met the problem of MEMORY ALLOC FAILED: mmap failed. The solution is to stop mining and enter /etc/security/limits.conf, add the following lines in the end of the file:

  • soft memlock 262144
  • hard memlock 262144
    Save and exit the file and input “sysctl -w vm.nr_hugepages=128”. Then, reboot.
目录
相关文章
|
3月前
|
前端开发 Linux 网络安全
旧手机闲置?教你用Termux搭建个移动服务器
旧手机闲置?教你用Termux搭建个移动服务器
156 0
|
存储 运维 虚拟化
《VMware vSphere企业运维实战》——第2章 从物理机到虚拟机 2.1 在闲置或新购服务器安装配置虚拟化主机
在你准备在服务器上安装VMware ESXi之前,你需要明白,在安装VMware ESXi的时候,需要对硬盘重新分区,此时服务器上原来的数据将会被清除。如果你的服务器上有重要的数据,需要将其备份到这台服务器以外的位置,例如另外一个服务器、活动硬盘、网络存储。
2691 0
|
1天前
|
存储 机器学习/深度学习 应用服务中间件
阿里云倚天云服务器实例:计算型c8y、通用型g8y、内存型r8y实例介绍
阿里云倚天云服务器是基于阿里云自研的倚天710 ARM架构CPU打造的高性能计算产品系列,它依托先进的第四代神龙架构,旨在为用户提供稳定可预期的超高效能体验。倚天云服务器在存储、网络性能及计算稳定性方面实现了显著提升,主要得益于其芯片级的快速路径加速技术。本文将深度解析阿里云倚天云服务器的计算型c8y、通用型g8y、内存型r8y实例,探讨其优势及适用场景,以供选择参考。
|
2天前
|
网络协议 应用服务中间件 网络安全
阿里云轻量应用服务器的使用限制
阿里云轻量应用服务器的使用限制
|
4天前
阿里云国际版购买了服务器后如何下载发票?
阿里云国际版购买了服务器后如何下载发票?
|
5天前
|
弹性计算 Linux 数据库
阿里云国际版如何迁移Linux云服务器系统盘中的数据
阿里云国际版如何迁移Linux云服务器系统盘中的数据
|
5天前
|
弹性计算 网络协议 Ubuntu
如何在阿里云国际版Linux云服务器中自定义配置DNS
如何在阿里云国际版Linux云服务器中自定义配置DNS
|
5天前
|
弹性计算 安全 Linux
阿里云国际版使用ping命令测试ECS云服务器不通的排查方法
阿里云国际版使用ping命令测试ECS云服务器不通的排查方法