赞
踩
搭建进度
- sudo yum install -y openssl openssl-devel
-
- 使用以下命令来安装 unzip 工具:
- sudo yum install unzip
- ## 创建操作目录
- cd ~ && mkdir -p fisco && cd fisco
-
- ## 下载脚本
- curl -#LO https://github.com/FISCO-BCOS/FISCO-BCOS/releases/download/v2.9.1/build_chain.sh && chmod u+x build_chain.sh
-
-
- 如果因为网络问题导致长时间无法下载build_chain.sh脚本
- 请尝试 curl -#LO https://osp-1257653870.cos.ap-guangzhou.myqcloud.com/FISCO-BCOS/FISCO-BCOS/releases/v2.9.1/build_chain.sh && chmod u+x build_chain.sh
bash build_chain.sh -l 127.0.0.1:4 -p 30300,20200,8545
命令执行成功会输出All completed
。如果执行出错,请检查nodes/build.log
文件中的错误信息
- 提示[WARN] /root/fisco/nodes DIR exists,please clean old DIR! 执行以下命令清除已有旧数据
- rm -rf /root/fisco/nodes
bash nodes/127.0.0.1/start_all.sh
启动成功会输出类似下面内容的响应。否则请使用netstat -an | grep tcp
检查机器的30300~30303,20200~20203,8545~8548
端口是否被占用。
- 使用以下命令进行查找端口是否被占用
-
- netstat -anp | grep 30300
- try to start node0
- try to start node1
- try to start node2
- try to start node3
- node1 start successfully
- node2 start successfully
- node0 start successfully
- node3 start successfully
提示报错,如果docker启动失败的话请使用以下命令:
- 提示信息如:ERROR:Cannot connect to the Docker daemon at unix:///var/run/docker.sock.
- Is the docker daemon running?
-
- 如何提示docker启动失败的话,执行以下命令:
- sudo systemctl start docker
ps -ef | grep -v grep | grep fisco-bcos
正常情况会有类似下面的输出; 如果进程数不为4,则进程没有启动(一般是端口被占用导致的)
- fisco 5453 1 1 17:11 pts/0 00:00:02 /home/ubuntu/fisco/nodes/127.0.0.1/node0/../fisco-bcos -c config.ini
- fisco 5459 1 1 17:11 pts/0 00:00:02 /home/ubuntu/fisco/nodes/127.0.0.1/node1/../fisco-bcos -c config.ini
- fisco 5464 1 1 17:11 pts/0 00:00:02 /home/ubuntu/fisco/nodes/127.0.0.1/node2/../fisco-bcos -c config.ini
- fisco 5476 1 1 17:11 pts/0 00:00:02 /home/ubuntu/fisco/nodes/127.0.0.1/node3/../fisco-bcos -c config.ini
- ## 如下,查看节点node0链接的节点数
- tail -f nodes/127.0.0.1/node0/log/log* | grep connected
-
- ## 正常情况会不停地输出连接信息,从输出可以看出node0与另外3个节点有连接。
- info|2019-01-21 17:30:58.316769| [P2P][Service] heartBeat,connected count=3
- info|2019-01-21 17:30:58.316769| [P2P][Service] heartBeat,connected count=3
- info|2019-01-21 17:31:18.317105| [P2P][Service] heartBeat,connected count=3
-
-
-
- ## 执行下面指令,检查是否在共识
- tail -f nodes/127.0.0.1/node0/log/log* | grep +++
-
- ## 正常情况会不停输出++++Generating seal,表示共识正常。
- info|2020-12-22 17:24:43.729402|[g:1][CONSENSUS][SEALER]++++++++++++++++ Generating seal on,blkNum=1,tx=0,nodeIdx=1,hash=2e133146...
- info|2020-12-22 17:24:47.740603|[g:1][CONSENSUS][SEALER]++++++++++++++++ Generating seal on,blkNum=1,tx=0,nodeIdx=1,hash=eb199760...
-
- !!! 必须安装java14才可以
- 本人安装时是2.9.2的控制台
-
- // 下载java14安装包
- jdk-14.0.2_linux-x64_bin.tar.gz
- https://www.oracle.com/cn/java/technologies/javase/jdk14-archive-downloads.html
- // 下载保存到
- cd /usr/local/source/java
-
- // 解压命令
- tar -zxvf jdk-14.0.2_linux-x64_bin.tar.gz
-
- // 将解压后的包移动到路径下
- mv jdk-14.0.2 /usr/local/soft/
- // 配置环境变量
- vi /etc/profile
-
- // 将以下命令复制到最后一行
- export JAVA_HOME=/usr/local/soft/jdk-14.0.2
- export JRE_HOME=${JAVA_HOME}/jre
- export CLASSPATH=.:$JAVA_HOME/lib:$JRE_HOME/lib
- export PATH=$PATH:$JAVA_HOME/bin:$JRE_HOME/bin
-
- // 刷新环境变量
- source /etc/profile
- 切换路径
- cd /usr/lib
-
- 使用 yum 命令安装 Java 开发包:
- sudo yum install java-devel
-
- 下载并解压 Maven 安装包
- wget https://mirror-hk.koddos.net/apache/maven/maven-3/3.8.4/binaries/apache-maven-3.8.4-bin.tar.gz
- tar -zxvf apache-maven-3.8.4-bin.tar.gz
-
- 配置 Maven 环境变量
- sudo vi /etc/profile
-
- 将以下内容添加到 /etc/profile 文件末尾:
- export M2_HOME=[your-maven-directory]
- export PATH=$PATH:$M2_HOME/bin
-
- 重新加载 /etc/profile 文件并应用更改:
- source /etc/profile
-
- 检查 Maven 是否正确安装
- mvn -version
-
- 之后,使用 Maven 在 CentOS 系统上下载 netty-tcnative
- 例如,您可以使用以下命令从 Maven 中央仓库下载 netty-tcnative(版本为2.0.32.Final):
- mvn dependency:get -Dartifact=io.netty:netty-tcnative:2.0.32.Final
- 安装 netty-tcnative
- sudo yum install apr-devel openssl-devel
- wget http://repo.maven.apache.org/maven2/io/netty/netty-tcnative/2.0.21.Final/netty-tcnative-2.0.21.Final-linux-x86_64.jar
-
- 创建一个名为 netty-tcnative-2.0.21.Final-linux-x86_64.so 的链接文件,该文件指向 netty-tcnative-2.0.21.Final-linux-x86_64.jar 文件中的本机库
- ln -s <path_to_jar_file>/netty-tcnative-2.0.21.Final-linux-x86_64.jar \
- /usr/local/lib/libnetty-tcnative-2.0.21.Final-linux-x86_64.so
-
- 在启动 FISCO BCOS 控制台之前,请确保将 /usr/local/lib 目录添加到系统路径中
- export LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH
- cd ~/fisco && curl -LO https://github.com/FISCO-BCOS/console/releases/download/v2.9.2/download_console.sh && bash download_console.sh
-
- 如果因为网络问题导致长时间无法下载,请尝试
- cd ~/fisco && curl -#LO https://gitee.com/FISCO-BCOS/console/raw/master-2.0/tools/download_console.sh && bash download_console.sh
- # 最新版本控制台使用如下命令拷贝配置文件
- cp -n console/conf/config-example.toml console/conf/config.toml
- # 最新版本控制台使用如下命令拷贝配置文件
- cp -n console/conf/config-example.toml console/conf/config.tom
cd ~/fisco/console && bash start.sh
- centos 中启动fisco控制台时提示
- [root@gen-173-168-063-126 fisco]# cd console && bash start.sh
- create BcosSDK failed, error info: init channel network error!
- org.fisco.bcos.sdk.network.NetworkException:
- * TRACE INFORMATION:
- ----------------------------
- ====> STEP1: try to connect nodes with ecdsa context...
- <==== STEP1-1: Load certificates for ecdsa context success...
- <==== connect nodes failed, reason:
- Failed to connect to all the nodes!
- * connect to 127.0.0.1:20200 failed! Please make sure the nodes have been started, and the network between the SDK and the nodes are connected normally.reason: 拒绝连接: /127.0.0.1:20200
-
- * connect to 127.0.0.1:20201 failed! Please make sure the nodes have been started, and the network between the SDK and the nodes are connected normally.reason: 拒绝连接: /127.0.0.1:20201
-
-
- 如果提示这个,那么就是docker安装和原生安装发生了冲突,请从网络搭建重新进行操作
- 输出下述信息表明启动成功 否则请检查conf/config.toml中节点端口配置是否正确
-
- =============================================================================================
- Welcome to FISCO BCOS console(2.6.0)!
- Type 'help' or 'h' for help. Type 'quit' or 'q' to quit console.
- ________ ______ ______ ______ ______ _______ ______ ______ ______
- | \| \ / \ / \ / \ | \ / \ / \ / \
- | $$$$$$$$ \$$$$$$| $$$$$$\| $$$$$$\| $$$$$$\ | $$$$$$$\| $$$$$$\| $$$$$$\| $$$$$$\
- | $$__ | $$ | $$___\$$| $$ \$$| $$ | $$ | $$__/ $$| $$ \$$| $$ | $$| $$___\$$
- | $$ \ | $$ \$$ \ | $$ | $$ | $$ | $$ $$| $$ | $$ | $$ \$$ \
- | $$$$$ | $$ _\$$$$$$\| $$ __ | $$ | $$ | $$$$$$$\| $$ __ | $$ | $$ _\$$$$$$\
- | $$ _| $$_ | \__| $$| $$__/ \| $$__/ $$ | $$__/ $$| $$__/ \| $$__/ $$| \__| $$
- | $$ | $$ \ \$$ $$ \$$ $$ \$$ $$ | $$ $$ \$$ $$ \$$ $$ \$$ $$
- \$$ \$$$$$$ \$$$$$$ \$$$$$$ \$$$$$$ \$$$$$$$ \$$$$$$ \$$$$$$ \$$$$$$
-
- =============================================================================================
- #为了方便用户快速体验,HelloWorld合约已经内置于控制台中,位于控制台目录下contracts/solidity/HelloWorld.sol,参考下面命令部署即可。
- # 在控制台输入以下指令 部署成功则返回合约地址
- [group:1]> deploy HelloWorld
- transaction hash: 0xd0305411e36d2ca9c1a4df93e761c820f0a464367b8feb9e3fa40b0f68eb23fa
- contract address:0xb3c223fc0bf6646959f254ac4e4a7e355b50a344
-
- # 查看当前块高
- [group:1]> getBlockNumber
- 1
-
- # 调用get接口获取name变量 此处的合约地址是deploy指令返回的地址
- [group:1]> call HelloWorld 0xb3c223fc0bf6646959f254ac4e4a7e355b50a344 get
- ---------------------------------------------------------------------------------------------
- Return code: 0
- description: transaction executed successfully
- Return message: Success
- ---------------------------------------------------------------------------------------------
- Return values:
- [
- "Hello,World!"
- ]
- ---------------------------------------------------------------------------------------------
-
- # 查看当前块高,块高不变,因为get接口不更改账本状态
- [group:1]> getBlockNumber
- 1
-
- # 调用set设置name
- [group:1]> call HelloWorld 0xb3c223fc0bf6646959f254ac4e4a7e355b50a344 set "Hello, FISCO BCOS"
- transaction hash: 0x7e742c44091e0d6e4e1df666d957d123116622ab90b718699ce50f54ed791f6e
- ---------------------------------------------------------------------------------------------
- transaction status: 0x0
- description: transaction executed successfully
- ---------------------------------------------------------------------------------------------
- Output
- Receipt message: Success
- Return message: Success
- ---------------------------------------------------------------------------------------------
- Event logs
- Event: {}
-
- # 再次查看当前块高,块高增加表示已出块,账本状态已更改
- [group:1]> getBlockNumber
- 2
-
- # 调用get接口获取name变量,检查设置是否生效
- [group:1]> call HelloWorld 0xb3c223fc0bf6646959f254ac4e4a7e355b50a344 get
- ---------------------------------------------------------------------------------------------
- Return code: 0
- description: transaction executed successfully
- Return message: Success
- ---------------------------------------------------------------------------------------------
- Return values:
- [
- "Hello,FISCO BCOS"
- ]
- ---------------------------------------------------------------------------------------------
-
- # 退出控制台
- [group:1]> quit
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。