Mining Monero On Centos

建站的时候租用了一台服务器,centos的操作系统。上面只放了两个网站, CPU使用率基本为零,偶尔操作的时候也只有40%,闲置是极大的浪费。资料说门罗币(monero)可以用cpu挖,那我也挖门罗币吧。
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
mkdir xmr-stak/build
cd xmr-stak/build
make install
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 LDFLAGS=”-Wl,-O1″
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/
但是有时会遇到MEMORY ALLOC FAILED: mmap failed的问题,停止运行后进入/etc/security/limits.conf,在文末添加
* soft memlock 262144
* hard memlock 262144
sysctl -w vm.nr_hugepages=128


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, and 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 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/
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.

Leave a Reply

Your email address will not be published. Required fields are marked *