hyperledger fabric中blockchain-explorer的部署安装

部署环境:Ubuntu 18.04,fabric 1.4

准备工作

安装nodejs

// 安装nodejs
sudo apt-get update #更新apt包索引
sudo apt-get install nodejs #安装nodejs
sudo apt install nodejs-legacy
node -v
sudo npm config set registry https://registry.npm.taobao.org

在这里插入图片描述检查是否安装成功(版本最好在8.0以上)

安装npm

npm是nodejs的包管理工具。

// 安装npm
sudo apt-get update #更新apt包索引
sudo apt install libssl1.0-dev nodejs-dev node-gyp npm #安装npm
npm -v

在这里插入图片描述检查是否安装成功

安装jq

jq是一种轻量级且灵活的命令行JSON解析器。

// 安装jq
sudo apt-get update #更新apt包索引
sudo apt-get install jq #安装jq
jq -V

在这里插入图片描述检查是否安装成功

安装postgreSQL

// 安装postgreSQL
sudo apt-get update #更新apt包索引

sudo apt-get install  #postgresql#安装数据库

sudo -u postgres psql  #打开客户端工具pspl

postgres=# ALTER USER postgres WITH PASSWORD '123456';  # 修改 postgres 数据库用户的密码为123456

postgres=# \q #退出
// 修改配置实现远程访问
vi /etc/postgresql/9.5/main/postgresql.conf 
listen_addresses = 'localhost' 改为 listen_addresses = '*'
// 设置所有用户可连接
vi /etc/postgresql/9.5/main/pg_hba.conf
在最后一行插入一下内容(注意要对齐)
host all all 0.0.0.0/0 md5
// 重启服务
/etc/init.d/postgresql restart

拉取blockchain-explorer 项目

// 拉取项目
cd go/src/github.com/hyperledger/
git clone https://github.com/hyperledger/blockchain-explorer.git
#修改文件夹权限
sudo chmod -R 777 blockchain-explorer

创建数据库

进入数据库文件目录

cd persistence/fabric/postgreSQL/db

创建数据库

 sudo ./createdb.sh

说明创建成功

查看是否创建成功

 sudo -u postgres psql #连接postgreSQL

在这里插入图片描述
执行\l的时候显示以下内容
在这里插入图片描述
(图片转载自http://cigod.blog.csdn.net)
执行\q退出

启动first-network

#打开新的终端进入文件目录
cd go/src/github.com/hyperledger/fabric/fabric-samples/first-network/ 
#启动网络
./byfn.sh up

结果如下代表运行成功:
在这里插入图片描述

修改blockchain-explorer fabric 配置

#进入文件目录
cd go/hyperledger/blockchain-explorer/app/platform/fabric/connection-profile/
#修改配置文件
vi first-network.json

将adminPrivateKey,signedCert,tlsCACerts这三个路径全部改为自己first-network的绝对路径。保存。

构建 blockchain-explorer

#进入目录
cd go/src/github.com/hyperledger/blockchain-explorer/
#执行以下语句
./main.sh install
./main.sh test

运行blockchain-explorer

#进入目录
cd go/src/github.com/hyperledger/blockchain-explorer/
./start.sh

打开日志文件,如果出现以下内容,则代表运行成功。
在这里插入图片描述
在网页中打开http://localhost:8080/,出现以下页面。
(可能有登录页面,默认用户名和密码分别是admin,adminpw)
在这里插入图片描述
完成。

  • 2
    点赞
  • 8
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值