EOS官方文档:https://developers.eos.io/eosio-nodeos/docs/getting-the-code
本地环境:
Ubuntu 16.4+2核+8G
1.下载源码
git clone https://github.com/EOSIO/eos --recursive
遇到的问题以及解决方案如下:
问题:
正克隆到 'test/emscripten'...
remote: Counting objects: 109999, done.
remote: Compressing objects: 100% (49/49), done.
error: RPC failed; curl 56 GnuTLS recv error (-110): The TLS connection was non-properly terminated.
fatal: The remote end hung up unexpectedly
fatal: 过早的文件结束符(EOF)
fatal: index-pack failed
fatal: 无法克隆 'https://github.com/kripken/emscripten.git' 到子模组路径 'test/emscripten'
无法递归进子模组路径 'externals/binaryen'
解决方案:
造成无法克隆的原因是没有赋予root权限,执行命令
cd eos
sudo git submodule update --init --recursive
正确克隆结果:
正克隆到 'test/emscripten'...
remote: Counting objects: 109999, done.
remote: Compressing objects: 100% (49/49), done.
remote: Total 109999 (delta 31), reused 35 (delta 19), pack-reused 109929
接收对象中: 100% (109999/109999), 159.40 MiB | 1.22 MiB/s, 完成.
处理 delta 中: 100% (76465/76465), 完成.
检查连接... 完成。
子模组路径 'externals/binaryen/test/emscripten':检出 '1d979a75722a513b586e6705d662ff4ee0ea832b'
正克隆到 'test/spec'...
remote: Counting objects: 989, done.
remote: Total 989 (delta 0), reused 0 (delta 0), pack-reused 989
接收对象中: 100% (989/989), 605.07 KiB | 354.00 KiB/s, 完成.
处理 delta 中: 100% (663/663), 完成.
检查连接... 完成。
子模组路径 'externals/binaryen/test/spec':检出 '668281b3d7dfe9be6cbc3c4500b537c49d6449b9'
正克隆到 'test/waterfall'...
remote: Counting objects: 2738, done.
remote: Compressing objects: 100% (3/3), done.
remote: Total 2738 (delta 0), reused 1 (delta 0), pack-reused 2735
接收对象中: 100% (2738/2738), 680.70 KiB | 358.00 KiB/s, 完成.
处理 delta 中: 100% (1993/1993), 完成.
检查连接... 完成。
子模组路径 'externals/binaryen/test/waterfall':检出 '900646fc880d526160b0df9b78bc9dd4f02dc1ab'
正克隆到 'externals/magic_get'...
remote: Counting objects: 2499, done.
remote: Total 2499 (delta 0), reused 0 (delta 0), pack-reused 2499
接收对象中: 100% (2499/2499), 532.04 KiB | 253.00 KiB/s, 完成.
处理 delta 中: 100% (1775/1775), 完成.
检查连接... 完成。
子模组路径 'externals/magic_get':检出 '89fda1da702e6c76a22bfb6233e9e3d0641708ec'
正克隆到 'libraries/appbase'...
remote: Counting objects: 240, done.
remote: Compressing objects: 100% (3/3), done.
remote: Total 240 (delta 0), reused 1 (delta 0), pack-reused 237
接收对象中: 100% (240/240), 62.12 KiB | 0 bytes/s, 完成.
处理 delta 中: 100% (112/112), 完成.
检查连接... 完成。
子模组路径 'libraries/appbase':检出 '44d7d88e561cc9708bcac9453686c8d0f0ffa41e'
正克隆到 'libraries/chainbase'...
remote: Counting objects: 325, done.
remote: Compressing objects: 100% (7/7), done.
remote: Total 325 (delta 2), reused 8 (delta 2), pack-reused 315
接收对象中: 100% (325/325), 68.23 KiB | 111.00 KiB/s, 完成.
处理 delta 中: 100% (131/131), 完成.
检查连接... 完成。
子模组路径 'libraries/chainbase':检出 '94c54460bfa391aef6cadf1e3f8a4eb384c8b58e'
正克隆到 'libraries/fc'...
remote: Counting objects: 1652, done.
remote: Compressing objects: 100% (3/3), done.
remote: Total 1652 (delta 0), reused 1 (delta 0), pack-reused 1649
接收对象中: 100% (1652/1652), 913.58 KiB | 107.00 KiB/s, 完成.
处理 delta 中: 100% (850/850), 完成.
检查连接... 完成。
子模组路径 'libraries/fc':检出 'df5a17ef0704d7dd96c444bfd9a70506bcfbc057'
正克隆到 'libraries/softfloat'...
remote: Counting objects: 2579, done.
remote: Total 2579 (delta 0), reused 0 (delta 0), pack-reused 2579
接收对象中: 100% (2579/2579), 751.02 KiB | 150.00 KiB/s, 完成.
处理 delta 中: 100% (2361/2361), 完成.
检查连接... 完成。
子模组路径 'libraries/softfloat':检出 '9dff375a6e3a9728a024b30afa127c88fcb40ea2'
2.编译
cd eos (若已经在eos目录,可省去这一步)
./eosio_build.sh
一路通畅未遇到任何问题
编译完成,如图所示
3.环境验证(可不做)
请参照安装完成的图,执行验证的相关命令,
export PATH=${HOME}/opt/mongodb/bin:$PATH
/home/guiren/opt/mongodb/bin/mongod -f /home/guiren/opt/mongodb/mongod.conf &
cd /home/guiren/eos/build
make test
验证结果
4.安装eos到系统环境
当期目录:eos
cd build
sudo make install
截图如下,
5.启动测试节点
当前目录:eos/build
cd programs/nodeos/
./nodeos -e -p eosio --plugin eosio::chain_api_plugin --plugin eosio::history_api_plugin
启动成功文案如下
2018-07-24T10:07:21.999 thread-0 chain_plugin.cpp:271 plugin_initialize ] initializing chain plugin
2018-07-24T10:07:22.000 thread-0 chain_plugin.cpp:508 plugin_initialize ] Starting up fresh blockchain with default genesis state.
CHAINBASE: Failed to pin chainbase shared memory (of size 1024 MB) in RAM. Performance degradation is possible.
CHAINBASE: Failed to pin chainbase shared memory (of size 340 MB) in RAM. Performance degradation is possible.
2018-07-24T10:07:22.201 thread-0 http_plugin.cpp:344 plugin_initialize ] configured http to listen on 127.0.0.1:8888
2018-07-24T10:07:22.201 thread-0 net_plugin.cpp:2941 plugin_initialize ] Initialize net plugin
2018-07-24T10:07:22.201 thread-0 net_plugin.cpp:2966 plugin_initialize ] host: 0.0.0.0 port: 9876
2018-07-24T10:07:22.202 thread-0 net_plugin.cpp:3036 plugin_initialize ] my node_id is e76f8b8955b7944588c11d4c97fbd649c5e18bb1f5adddc306797ba4a2f3cdc8
2018-07-24T10:07:22.202 thread-0 main.cpp:105 main ] nodeos version 75635168
2018-07-24T10:07:22.202 thread-0 main.cpp:106 main ] eosio root is /home/guiren/.local/share
2018-07-24T10:07:22.202 thread-0 controller.cpp:1252 startup ] No head block in fork db, perhaps we need to replay
2018-07-24T10:07:22.202 thread-0 controller.cpp:319 initialize_fork_db ]
出现和上面类似的文案,说明已经在生产块了。
6.执行cleos命令查看相关信息
重新打开一个终端(之前生产节点的终端不要关闭)
当前目录:eos
cd build/programs/cleos
./cleos get info (查看网络信息)
网络信息如下,
cleos命令官方文档:https://developers.eos.io/eosio-cleos/reference#cleos-version
生成的块和配置信息默认在当前登录用户目录,
cd .local/share/eosio/nodeos/
删除这个目录,重启nodeos即可重置账号,智能合约等。
笔者建议各位开发人员将已经搭建好的eos压缩一份保存起来,下次可直接拿来使用,毕竟搭建环境也是个费时的过程。
打包到root目录命令,
tar -zcvf ~/eos_nodes_backup.tar.gz eos
如果搭建过程中遇到任何问题,请发送问题致邮件:[email protected],我会尽我所能帮您解答。
打赏(加密货币)
BTC地址:1MHAPXoydTMTXi9r5mHYp3kGFYkKGcpXf
ETH地址:0x8d345c08805c1e0d21f518bb301640e937b8c2c6
ADA地址:DdzFFzCqrhsqmBCy6zTcdy1bshH3p5LtfmssqvL8AUcPjf55q7LteaJtx7eztaayftSj3aKWS4qWqUPJVt3ZiPVmtoKHdRYrfMHDzwGn
EOS地址:0x8d345c08805c1e0d21f518bb301640e937b8c2c6