EOS源码编译安装

参考:https://github.com/EOSIO/eos/wiki/Local-Environment#2-building-eosio

安装环境:ubuntu 16.04

下载代码:

git clone https://github.com/EOSIO/eos--recursive

时间有点长

完成之后如下提示:


编译:

要求:

Centos 7 或 ubuntu 16.04(官网推荐ubuntu 16.10以上

8G 内存, 20G硬盘

// 编译过程比较漫长,由于每台机器的环境不一样,以下出现的问题不一定会出现

cd eos

./eosio_build.sh

若软硬件达不到要求执行编译脚本会提示:

Beginning build version:1.2

FriApr2708:02:24 UTC 2018

User: ky

git headid:5abf3060734f2973567bbacdd3e8af7cc1fc802e

Current branch:* master

ARCHITECTURE:Linux

OS name:Ubuntu

OS Version:16.04

CPU speed:2194Mhz

CPU cores:1

PhysicalMemory:962Mgb

Disk install:/dev/sda1

Disk space total:18G

Disk space available:10G

Your system must have 7or more Gigabytes ofphysical memory installed

编译过程中出现:

...updated 15266 targets...

         CheckingMongoDB installation.

         InstallingMongoDB 3.6.3.

  %Total    % Received % Xferd  Average Speed   Time   Time     Time  Current

                                 Dload  Upload  Total   Spent    Left Speed

 0     0    0    0    0     0     0      0 --:--:--  0:00:30 --:--:--     0

curl: (28) Operation timed out after 0milliseconds with 0 out of 0 bytes received

         Unableto download MongoDB at this time.

         Exitingnow.

原因:下载MongoDB超时,由于网络原因无法从github.com下载

mongo-c-driver-1.9.3.tar.gz  放到 /tmp,将mongo-3.6.3.tar.gz放到 /opt下

Vim eos/scripts/eosio_build_ubuntu.sh

将以下脚本注解

// 下载mongo-c-driver-1.9.3.tar.gz脚本

#STATUS=$(curl -LO -w '%{http_code}'--connect-timeout 30https://github.com/mongodb/mongo-c-driver/releases/download/1.9.3/mongo-c-driver-1.9.3.tar.gz)

#if [ "${STATUS}" -ne 200 ]; then

#      rm -f ${TEMP_DIR}/mongo-c-driver-1.9.3.tar.gz

#      printf "\tUnable to download MongoDB C driver at this time.\n"

#      printf "\tExiting now.\n\n"

#      exit;

#fi

// 下载mongodb脚本

#STATUS=$(curl -LO -w '%{http_code}'--connect-timeout 30 https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-3.6.3.tgz)

#if [ "${STATUS}" -ne 200 ]; then

#       printf"\tUnable to download MongoDB at this time.\n"

#       printf"\tExiting now.\n\n"

#       exit;

#fi

//////////////////////解压文件mongodb-linux-x86_64-3.6.3.tgz出错:

         Norequired dpkg dependencies to install.

         Checkingboost library installation.

         Boost1.66.0 found at /root/opt/boost_1_66_0.

         CheckingMongoDB installation.

         InstallingMongoDB 3.6.3.

tar:/root/opt/mongodb-linux-x86_64-3.6.3.tgz: Cannot open: No such file ordirectory

tar: Error is not recoverable: exiting now

         Unableto unarchive file /root/opt/mongodb-linux-x86_64-3.6.3.tgz.

         Exitingnow.

root@ubuntu:~/eos_dev/eos_code/eos#

解决办法:

mongo-3.6.3.tar.gz拷贝到/root/opt/目录改名为mongodb-linux-x86_64-3.6.3.tgz

继续执行编译脚本

// 出现以下错误:

         CheckingMongoDB installation.

         InstallingMongoDB 3.6.3.

mkdir: cannot create directory?.root/opt/mongodb/data?. No such file or directory

         Unableto create directory /root/opt/mongodb/data.

         Exitingnow.

解决办法:cd /root/opt

root@ubuntu:~/opt# rm -f mongodb

mv mongo-3.6.3 mongodb-linux-x86_64-3.6.3

出现LLVM无法下载问题:

         Checkingfor LLVM with WASM support.

         InstallingLLVM & WASM

fatal: destination path 'llvm' alreadyexists and is not an empty directory.

         Unableto clone llvm repo @ https://github.com/llvm-mirror/llvm.git.

         Exitingnow.

解决办法:

cd /opt 
rm -rf llvm
cd /tmp
root@DESKTOP-H6EG47U:/tmp# rm -rf llvm-compiler/

成功会有如下提示



~/opt/mongodb/bin/mongod -f ~/opt/mongodb/mongod.conf &   // 这个不执行节点也可以启动

启动可以参照:

https://github.com/EOSIO/eos/wiki/Local-Environment#2-building-eosio

节点启动要启动2次,否则不能同步数据

eos RPC接口

eos 命令大全

EOS官方文档中文版

启动节点:(注意此处的坑)
/root/eos/eos/build/programs/nodeos/nodeos -e -p eosio --plugin eosio::chain_api_plugin --plugin eosio::wallet_api_plugin --plugin eosio::history_api_plugin 
//带有--plugin eosio::wallet_api_plugin参数才可以调用钱包相关RPC接口
// 而官网说要在/root/.local/share/eosio/nodeos/config/config.ini
添加:
plugin = eosio::chain_api_plugin // Enable Chain API
plugin = eosio::wallet_api_plugin // Enable Wallet API
//而经过测试添加了之后无法启动,只有将 eosio::chain_api_plugin ,eosio::wallet_api_plugin在启动节点时添加
就可以启动也可以调用钱包相关RPC接口

EOS官方文档中文版

猜你喜欢

转载自blog.csdn.net/lys07962000/article/details/80371944