centos 6.3 64位下cpuminer +mining_proxy 挖掘莱特币(LTC)教程

1.下载软件:

cpuminer:

http://sourceforge.net/projects/cpuminer/files/

找到对应的版本,我的服务器是centos64的,找了个当前最高版本:http://sourceforge.net/projects/cpuminer/files/pooler-cpuminer-2.3.2-linux-x86_64.tar.gz/download

mining_proxy:

项目主页:https://github.com/slush0/stratum-mining-proxy

按照readme里介绍的,访问:https://github.com/slush0/stratum-mining-proxy/tarball/master  下载最新版。

我下载到的版本是:slush0-stratum-mining-proxy-d0f1f9e.tar.gz

2.系统环境安装:

安装bz2::

yum install bzip2-devel

 

安装openssl:

 yum install openssl

 yum install openssl-devel

 

升级Python到2.7.3:

下载Python2.7.3并编译:

http://python.org/ftp/python/2.7.3/Python-2.7.3.tgz

把2.7.3下载下来解压缩:

tar -xzvf Python-2.7.3.tgz

cd Python-2.7.3

cd Modules/

vim Setup.dist 

 

找到ssl(大概495行左右),取消以下部分的注释:

SSL=/usr/local/ssl
_ssl _ssl.c \
-DUSE_SSL -I$(SSL)/include -I$(SSL)/include/openssl \
-L$(SSL)/lib -lssl -lcrypto

找到zlib(大概463行左右),取消下面部分的注释:

zlib zlibmodule.c -I$(prefix)/include -L$(exec_prefix)/lib -lz

保存文件并退出。

回到Python根目录:

cd ~/Python-2.7.3

编译并安装python2.7.3:

./configure
make all          
make install
make clean
make distclean

建立软连接,使系统默认的python指向python2.7
正常情况下即使python2.7安装成功后,系统默认指向的python仍然是2.6.6版本,考虑到yum是基于python2.6.6才能正常工作,不敢轻易卸载。

如何实现将系统默认的python指向到2.7版本呢?

mv /usr/bin/python /usr/bin/python2.6.6
ln -s /usr/local/bin/python2.7 /usr/bin/python

检验python指向是否成功:

python -V

解决系统python软链接指向python2.7版本后,yum不能正常工作:

vi /usr/bin/yum

将文件头部的
#!/usr/bin/python
改成
#!/usr/bin/python2.6.6

安装easy_install和pip(不是必须,如果说缺少argparse,可以在安装好下列软件后使用命令:easy_install argparse来安装argparse):

curl https://bitbucket.org/pypa/setuptools/raw/bootstrap/ez_setup.py | python -
curl https://raw.github.com/pypa/pip/master/contrib/get-pip.py | python -

 

 

整个升级过程完成,可以使用Python2.7.3版本了。

3.安装cpuminer+mining_proxy :

tar -xzvf pooler-cpuminer-2.3.2-linux-x86_64.tar.gz
tar -xzvf slush0-stratum-mining-proxy-d0f1f9e.tar.gz 
mv slush0-stratum-mining-proxy-d0f1f9e minerd_all
mv minerd minerd_all/
cd minerd_all/
python setup.py install

4.编写sh脚本,启动mining_proxy和cpuminer:

vim run.sh

将下列内容放入run.sh中保存并退出:

#!/bin/sh
# 第一次写脚本,比较烂,能运行就中
echo "starting proxy..."
date >> proxy.log
#把此处的矿池地址和端口号换成你自己的 nohup .
/mining_proxy.py -o stratum.f2pool.com -p 8888 &>proxy.log & echo "starting minerd..." date >> minerd.log
#把此处的矿工用户名和密码换成你自己的 nohup .
/minerd -o http://127.0.0.1:8332 -O sixiweb.4:1234 &>minerd.log &

将run.sh改为可执行文件:

chmod 777 run.sh 

运行挖矿脚本:

./run.sh

查看挖矿软件工作是否正常:

tail -100f proxy.log 
tail -100f minerd.log 

如果在proxy.log中出现下列内容则表示proxy工作正常:

2013-12-02 18:49:33,203 WARNING proxy mining_proxy.main # Stratum proxy version: 1.5.2
2013-12-02 18:49:33,206 WARNING proxy mining_proxy.test_update # Checking for updates...
2013-12-02 18:49:33,838 WARNING proxy mining_proxy.main # Trying to connect to Stratum pool at stratum.f2pool.com:8888
2013-12-02 18:49:33,908 INFO stats stats.print_stats # 1 peers connected, state changed 1 times
2013-12-02 18:49:33,908 INFO proxy mining_proxy.on_connect # Connected to Stratum pool at stratum.f2pool.com:8888
2013-12-02 18:49:33,909 INFO proxy mining_proxy.on_connect # Subscribing for mining jobs
2013-12-02 18:49:34,081 WARNING proxy mining_proxy.main # -----------------------------------------------------------------------
2013-12-02 18:49:34,081 WARNING proxy mining_proxy.main # PROXY IS LISTENING ON ALL IPs ON PORT 3333 (stratum) AND 8332 (getwork)
2013-12-02 18:49:34,081 WARNING proxy mining_proxy.main # -----------------------------------------------------------------------
2013-12-02 18:50:03,467 WARNING proxy getwork_listener._on_authorized # Getworkmaker is waiting for a job...

 

如果在minerd.log中出现如下日志,则说明工作正常:

[2013-12-02 18:49:32] Binding thread 1 to cpu 1
[2013-12-02 18:49:32] Binding thread 2 to cpu 2
[2013-12-02 18:49:32] Binding thread 3 to cpu 3
[2013-12-02 18:49:32] Binding thread 4 to cpu 4
[2013-12-02 18:49:32] Binding thread 5 to cpu 5
[2013-12-02 18:49:32] Binding thread 6 to cpu 6
[2013-12-02 18:49:32] Binding thread 7 to cpu 7
[2013-12-02 18:49:32] Binding thread 0 to cpu 0
[2013-12-02 18:49:32] 8 miner threads started, using 'scrypt' algorithm.
[2013-12-02 18:49:32] HTTP request failed: Failed connect to 127.0.0.1:8332; Connection refused
[2013-12-02 18:49:32] json_rpc_call failed, retry after 30 seconds
[2013-12-02 18:50:03] Starting Stratum on stratum+tcp://127.0.0.1:3333
[2013-12-02 18:50:03] JSON-RPC call failed: {
"message": "Getworkmake is waiting for a job...",
"code": -1
}
[2013-12-02 18:50:06] thread 2: 4104 hashes, 5.25 khash/s
[2013-12-02 18:50:06] thread 0: 4104 hashes, 4.98 khash/s
[2013-12-02 18:50:47] thread 7: 4104 hashes, 0.10 khash/s
[2013-12-02 18:50:47] thread 6: 4104 hashes, 0.10 khash/s
[2013-12-02 18:50:47] thread 5: 4104 hashes, 0.10 khash/s
[2013-12-02 18:50:47] thread 3: 4104 hashes, 0.10 khash/s
[2013-12-02 18:50:48] thread 1: 4104 hashes, 0.10 khash/s
[2013-12-02 18:50:48] thread 4: 4104 hashes, 0.10 khash/s
[2013-12-02 18:51:01] thread 2: 314760 hashes, 5.67 khash/s
[2013-12-02 18:51:02] thread 0: 299040 hashes, 5.36 khash/s
[2013-12-02 18:51:36] thread 5: 5832 hashes, 0.12 khash/s
[2013-12-02 18:51:37] thread 3: 5820 hashes, 0.12 khash/s
[2013-12-02 18:51:38] thread 5: 7116 hashes, 5.65 khash/s
[2013-12-02 18:51:38] thread 3: 7104 hashes, 5.60 khash/s
[2013-12-02 18:51:45] thread 4: 5772 hashes, 0.10 khash/s
[2013-12-02 18:51:46] thread 7: 5940 hashes, 0.10 khash/s
[2013-12-02 18:51:48] thread 1: 5784 hashes, 0.10 khash/s
[2013-12-02 18:51:49] thread 6: 5928 hashes, 0.10 khash/s
[2013-12-02 18:52:31] thread 5: 298248 hashes, 5.64 khash/s
[2013-12-02 18:52:31] accepted: 1/1 (100.00%), 22.66 khash/s (yay!!!)

 

 

 

 

 

 

 

 

 

 

你可能感兴趣的:(centos)