Cài cpuminer cho linux

Tổng hợp lệnh đào Monero XMR trên Linux - Ubuntu

Sau khi mình chia sẽ bài viết hướng dẫn đào monero ở đây và bên diễn đàn mmo4me (https://mmo4me.com/threads/huong-dan-dao-monero-cho-nguoi-co-nhieu-vps-free.323842/) thì có rất nhiều lão làng quay lại theo trào lưu đào coin và những bạn mới bước vào nghề đào coin này, một số bạn đã tìm được bug vcc để reg vps đào coin free và kiếm vài k$/ngay...

Cài cpuminer cho linux
Mining monero ubuntu


Tuy nhiên trong bài viết hướng dẫn đào coin mình chỉ hướng dẫn đào trên GUI (Graphical user interface) mà quên hướng dẫn đào coin bằng lệnh console mining cho các bạn sử dụng hệ điều lành linux.
Hôm nay mình xin chia sẽ lại bài hướng dẫn đào monero trên linux (Debian, Centos, Ubuntu) chỉ cần cho lệnh vào Startup Script sau khi tạo VPS sẽ không cần Remote VPS để chạy lệnh bằng tay nữa.
-------- Trích lại hướng dẫn của bạn wormiit bên mmo4me.com--------

Giải thích các lệnh Linux cơ bản để đào coin​

#!/bin/bash // giúp linux nhận ra đây là một đoạn bash script 

  • sudo apt-get update // cập nhật hệ điều hành 
  • sudo apt-get install -y automake build-essential autoconf pkg-config libcurl4-openssl-dev libjansson-dev libssl-dev libgmp-dev // cài đặt các thư viện cần thiết 
  • sudo sysctl -w vm.nr_hugepages=$((`grep -c ^processor /proc/cpuinfo` * 3)) // tunning cơ bản nhận 20% luck có cơ hội tăng hash/s 
  • git clone https://github.com/tpruvot/cpuminer-multi && cd cpuminer-multi && ./autogen.sh // tải tool đào và tạo môi trường build tool 
  • if [ ! "0" = `cat /proc/cpuinfo | grep -c avx2` ]; // nhận diện vps có hỗ trợ avx2 hay không 
  • then CFLAGS="-O2 -mavx2" ./configure --with-crypto --with-curl // thiết lập môi trường build tool đào với cpu hỗ trợ avx2 
  • elif [ ! "0" = `cat /proc/cpuinfo | grep -c avx` ]; // nhận diện vps có hỗ trợ avx hay không 
  • then CFLAGS="-O2 -mavx" ./configure --with-crypto --with-curl // thiết lập môi trường build tool đào với cpu hỗ trợ avx 
  • else CFLAGS="-march=native" ./configure --with-crypto --with-curl // thiết lập môi trường build tool đào với cpu bình thường 
  • fi make clean && make && ./cpuminer -a cryptonight -o stratum+tcp://fcn-xmr.pool.minergate.com:45590 -u -p x --thread=7 // build tool đào và chạy cpuminer theo cấu hình config dual XMR và FCN trên pool Minergate với số core cpu là 7

Các bạn có thể copy nguyên lệnh trên 

123456789101112131415#!/bin/bash 
sudo apt-get update
sudo apt-get install -y automake build-essential autoconf pkg-config libcurl4-openssl-dev libjansson-dev libssl-dev libgmp-dev 
sudo sysctl -w vm.nr_hugepages=$((`grep -c ^processor /proc/cpuinfo` * 3)) 
git clone https://github.com/tpruvot/cpuminer-multi && cd cpuminer-multi && ./autogen.sh 
if [ ! "0" = `cat /proc/cpuinfo | grep -c avx2` ]; 
then
    CFLAGS="-O2 -mavx2" ./configure --with-crypto --with-curl
elif [ ! "0" = `cat /proc/cpuinfo | grep -c avx` ]; 
then
    CFLAGS="-O2 -mavx" ./configure --with-crypto --with-curl 
else
    CFLAGS="-march=native" ./configure --with-crypto --with-curl 
fi
make clean && make && ./cpuminer -a cryptonight -o stratum+tcp://fcn-xmr.pool.minergate.com:45590 -u  -p x --thread=7 

Các lệnh bổ sung nếu cần

get -y upgrade && apt-get -y autoremove
// Cập nhật hệ điều hành & gỡ bỏ các thư viện cũ sudo apt-get update && apt-


Lưu ý:- Muốn chạy 1 lệnh thì copy tất cả và thêm vào giữa các lệnh dấu &&- Có nhiều cách để chạy lệnh đào như dùng screen, nohup, cpulimit
Vd:cpulimit -l 98 /root/cpuminer-opt/cpuminer -- -a zcoin -o stratum+tcp://stratum0.maxminers.net:3756 -u mai.d01 -p x --syslog screen: screen -d -m ./cpuminer -a lyra2z -o stratum+tcp://stratum0.maxminers.net:3757 -u mai.gg01 -p x nohup: nohup ./cpuminer -a zcoin -o stratum+tcp://xzc.pool.mn:2428 -u meoit.v08 -p x

Tunning VPS +20% may mắn để tăng số h/s , lệnh này tinh chỉnh hệ thống Linux giúp tool đào chạy hiệu quả hơn

sudo sysctl -w vm.nr_hugepages=$((`grep -c ^processor /proc/cpuinfo` * 3)) // số core cpu x 3


Các đoạn code bash script đào coin phổ biến

Debian-cli với tool đào Minergate-cli, lệnh này phổ biến, đơn giản nhất

#!/bin/bash wget https://minergate.com/download/deb-cli sudo dpkg -i deb-cli nohup minergate-cli -user mail_của_bạn -xmr số_core_để_đào

Vidu
#!/bin/bash wget https://minergate.com/download/deb-cli sudo dpkg -i deb-cli nohup minergate-cli -user -xmr 7

*** Ubuntu 16.04, đào XMR, XZC, dual XMR-FCN, nên dùng bản này sẽ chạy ok hơn các bản Ubuntu khác ***
Đây là những code mình đang dùng, ưu điểm là các tool được cập nhật mới, hỗ trợ cấu hình cpu có AVX2Bản tool của wolf0 hay lucas không build được, đã thử và lỗi
Khi copy về nhớ thay đổi phần mail_của_bạn và số_core_để_đào
* Code chạy cpuminer-multi của tpruvot - pool Minergate - dual XMR-FCN

#!/bin/bash 
sudo apt-get update 
sudo apt-get install -y automake build-essential autoconf pkg-config libcurl4-openssl-dev libjansson-dev libssl-dev libgmp-dev sudo sysctl -w vm.nr_hugepages=$((`grep -c ^processor /proc/cpuinfo` * 3)) 
git clone https://github.com/tpruvot/cpuminer-multi && cd cpuminer-multi && ./autogen.sh 
if [ ! "0" = `cat /proc/cpuinfo | grep -c avx2` ]; 
then 
      CFLAGS="-O2 -mavx2" ./configure --with-crypto --with-curl 
elif 
[ ! "0" = `cat /proc/cpuinfo | grep -c avx` ]; 
then 
CFLAGS="-O2 -mavx" ./configure --with-crypto --with-curl 
else 
 CFLAGS="-march=native" ./configure --with-crypto --with-curl 
fi make clean && make && ./cpuminer -a cryptonight -o stratum+tcp://fcn-xmr.pool.minergate.com:45590 -u mail_của_bạn -p x --thread=số_core_để_đào

Code chạy cpuminer-multi của tpruvot - pool Minergate - đào XMR
#!/bin/bash

1234567891011121314sudo apt-get update
sudo apt-get install -y automake build-essential autoconf pkg-config libcurl4-openssl-dev libjansson-dev libssl-dev libgmp-dev
sudo sysctl -w vm.nr_hugepages=$((`grep -c ^processor /proc/cpuinfo` * 3))
git clone https://github.com/tpruvot/cpuminer-multi && cd cpuminer-multi && ./autogen.sh
if [ ! "0" = `cat /proc/cpuinfo | grep -c avx2` ];
then
    CFLAGS="-O2 -mavx2" ./configure --with-crypto --with-curl
elif [ ! "0" = `cat /proc/cpuinfo | grep -c avx` ];
then
    CFLAGS="-O2 -mavx" ./configure --with-crypto --with-curl
else
    CFLAGS="-march=native" ./configure --with-crypto --with-curl
fi
make clean && make && ./cpuminer -a cryptonight -o stratum+tcp://xmr.pool.minergate.com:45560 -u mail_của_bạn -p x --thread=số_core_để_đào

Các bạn có thể theo dõi tại: https://mmo4me.com/threads/tong-hop-lenh-dao-xmr-xzc-tren-linux.332923/https://mmo4me.com/threads/tong-hop-lenh-dao-xmr-xzc-tren-linux.332923/