CentOS7(增加源)
yum repolist # 查看yum源列表
yum localinstall http://dl.fedoraproject.org/pub/epel/7/x86_64/Packages/e/epel-release-7-11.noarch.rpm -y
yum makecache # 将服务器上的软件包信息下载到本地缓存, 以提高搜索和安装软件的速度
yum repolist # 可以再次查看新加入的列表
yum install pptpd -y # 再次执行安装pptpd ------------------------------------或 yum install -y http://dl.fedoraproject.org/pub/epel/7/x86_64/Packages/e/epel-release-7-11.noarch.rpm
2、Payment-ID获取
在服务器上运行以下命令:
openssl rand -hex
即可获取Payment-ID
也就是支付ID
。
3、安装挖矿程序
这里建议使用Ubuntu
系统,听说效率更高。
#Ubuntu系统,在Ubuntu .04测试成功
add-apt-repository ppa:ubuntu-toolchain-r/test
apt update
apt install gcc- g++- make
update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc- --slave /usr/bin/g++ g++ /usr/bin/g++-
curl -L http://www.cmake.org/files/v3.4/cmake-3.4.1.tar.gz | tar -xvzf - -C /tmp/
cd /tmp/cmake-3.4./ && ./configure && make && sudo make install && cd -
update-alternatives --install /usr/bin/cmake cmake /usr/local/bin/cmake --force
apt install libmicrohttpd-dev libssl-dev libhwloc-dev
git clone https://github.com/fireice-uk/xmr-stak-cpu xmr-stak
cd xmr-stak
cmake .
make install #CentOS系统
yum install centos-release-scl cmake3 hwloc-devel libmicrohttpd-devel openssl-devel
yum install devtoolset--gcc*
scl enable devtoolset- bash
git clone https://github.com/fireice-uk/xmr-stak-cpu xmr-stak
cd xmr-stak
cmake3 .
make install #Debian系统,在Debian 8测试成功
echo "deb http://ftp.us.debian.org/debian unstable main contrib non-free" >> /etc/apt/sources.list.d/unstable.list
apt-get update
apt-get install -t unstable gcc- g++- make
update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc- --slave /usr/bin/g++ g++ /usr/bin/g++-
curl -L http://www.cmake.org/files/v3.4/cmake-3.4.1.tar.gz | tar -xvzf - -C /tmp/
cd /tmp/cmake-3.4./ && ./configure && make && make install && cd -
update-alternatives --install /usr/bin/cmake cmake /usr/local/bin/cmake --force
apt install libmicrohttpd-dev libssl-dev libhwloc-dev
git clone https://github.com/fireice-uk/xmr-stak-cpu xmr-stak
cd xmr-stak
cmake .
make install
4、设置CPU、钱包、Payment-ID
在/root/xmr-stak/bin/config.txt
设置CPU
、钱包、Payment-ID
。
#修改CPU信息
cpu_threads_conf部分,建议CPU核数的50%
#修改钱包、Payment-ID、矿工号和Email地址
wallet_address后面的。
#修改pool_address
改为自己服务器近的。
#修改httpd_port
改为自己喜欢的端口,然后使用IP:端口就可以查看运行情况
也可用以下代码替换:
"cpu_threads_conf" :
[
{ "low_power_mode" : false, "no_prefetch" : true, "affine_to_cpu" : },
{ "low_power_mode" : false, "no_prefetch" : true, "affine_to_cpu" : },
{ "low_power_mode" : false, "no_prefetch" : true, "affine_to_cpu" : },
{ "low_power_mode" : false, "no_prefetch" : true, "affine_to_cpu" : },
], "use_slow_memory" : "warn",
"nicehash_nonce" : false,
"aes_override" : null,
"use_tls" : false,
"tls_secure_algo" : true,
"tls_fingerprint" : "",
"pool_address" : "xmr-us-east1.nanopool.org:14444",
"wallet_address" : "钱包地址.Payment-ID.矿工编号/Email", #矿工编号可以随便填
"pool_password" : "x",
"call_timeout" : ,
"retry_time" : ,
"giveup_limit" : ,
"verbose_level" : ,
"h_print_time" : ,
"daemon_mode" : false,
"output_file" : "",
"httpd_port" : ,
"prefer_ipv4" : true,
Monero
矿池有很多,官网http://moneropools.com/
中列举了很多个矿池,可以选择想加入的矿池。我这里选择的是xmr.nanopool.org
。
5、开始挖矿
运行命令:
cd /root/xmr-stak/bin
screen -S mine
./xmr-stak-cpu
即可后台开始挖矿。
常见问题
#如何更改捐赠比例
编辑xmr-stak下的donate-level.h文件,把
constexpr double fDevDonationLevel = 2.0 / 100.0;
改为
constexpr double fDevDonationLevel = 0.5 / 100.0;
也可以改为其他比例。 #Linux下挖矿出现MEMORY ALLOC FAILED: mmap failed错误
运行命令:
sysctl -w vm.nr_hugepages=
然后编辑文件/etc/security/limits.conf, 在倒数第二行或者之前加入下面两行:
soft memlock
hard memlock
然后重启或者注销并重新登录。