FISCO BCOS 2.0 安装部署WeBASE与区块链浏览器-对应的官网地址:
WeBASE平台:https://webasedoc.readthedocs.io/zh-cn/latest/docs/WeBASE/install.html
区块链浏览器:https://fisco-bcos-documentation.readthedocs.io/zh-cn/latest/docs/browser/deploy.html
💡视频教程:Webase平台/区块链浏览器安装部署(环境配置包的)
1. 环境准备
系统要求
- 操作系统:CentOS 7.2+/Ubuntu 16.04+
- 个人实测2核2G服务器勉强运行宝塔+WeBASE
换源本地的vmware新建后一定要换源
bash <(curl -sSL https://linuxmirrors.cn/main.sh)
换源后验证更改
sudo yum repolist -y
前提条件(环境配置)
环境 | 版本 |
---|---|
Java | Oracle JDK 8 至 14 |
MySQL | MySQL-5.6及以上 |
Nginx | Nginx openresty(必须这个版本) |
Python | Python3.6及以上 |
PyMySQL | 需安装PyMySQL依赖包 pip3 install PyMySQL |
CentOS或Ubuntu不支持pip命令的话,可以使用以下方式:
git clone https://github.com/PyMySQL/PyMySQL
cd PyMySQL/
python3 setup.py install
这里我们通过安装 宝塔 / 小皮面板 来完成环境的安装配置 不进行单独安装了
if [ -f /usr/bin/curl ];then curl -sSO https://download.bt.cn/install/install_panel.sh;else wget -O install_panel.sh https://download.bt.cn/install/install_panel.sh;fi;bash install_panel.sh ed8484bec
配置 Nginx 环境
进入宝塔nginx 要通过编译安装(不要快速安装)
nginx 一定要用 Nginx openresty 并且要编译安装
配置 Java 环境
vim /root/.bashrc
# 打开以后将下面三句输入到文件里面并保存退出
export JAVA_HOME=/software/jdk-8u301 #这是一个文件目录,非文件
export PATH=$JAVA_HOME/bin:$PATH
# 生效profile
source /root/.bashrc
配置 Python 环境
安装一个Python3.6及以上版本然后点击 → 网站 → Python项目 → 命令行环境管理 →设置为
配置 MySQL 环境
修改MySQL的 root 密码
当Java - Nginx - MySQL -Python 都配置好后 - 最后:
source /etc/profile
依赖安装(非必要)
官网推荐使用CentOS 7.2+, Ubuntu 16.04及以上版本, 一键部署脚本将自动安装openssl, curl, wget, git, nginx, dos2unix相关依赖项。
其余系统可能导致安装依赖失败,可自行安装openssl, curl, wget, git, nginx, dos2unix依赖项后重试
# 安装基础工具
sudo apt-get install -y openssl curl wget git dos2unix
2. 部署WeBASE管理平台
下载安装包
wget https://github.com/WeBankBlockchain/WeBASELargeFiles/releases/download/v1.5.5/webase-deploy.zip
unzip webase-deploy.zip
cd webase-deploy
注意:如果下载网络不易可以通过GitHub文件加速进行下载,例如:
https://ghproxy.net/https://github.com/WeBankBlockchain/WeBASELargeFiles/releases/download/v1.5.5/webase-deploy.zip
配置修改
编辑 common.properties
:
[common]
# Webase Subsystem Version (v1.1.0 or above)
webase.web.version=v1.5.5
webase.mgr.version=v1.5.5
webase.sign.version=v1.5.5
webase.front.version=v1.5.5
#####################################################################
# if use [installDockerAll] to install WeBASE by docker
# if use [installAll] or [installWeBASE], ignore configuration here
# 1: enable mysql in docker
# 0: mysql run in host, required fill in the configuration of webase-node-mgr and webase-sign
docker.mysql=1
# if [docker.mysql=1], mysql run in host (only works in [installDockerAll])
# run mysql 5.6 by docker
docker.mysql.port=23306
# default user [root]
docker.mysql.password=123456
#####################################################################
# Mysql database configuration of WeBASE-Node-Manager
mysql.ip=localhost
mysql.port=3306
mysql.user=设置的MySQL用户
mysql.password=设置的MySQL用户的密码
mysql.database=webasenodemanager # 数据库名
# Mysql database configuration of WeBASE-Sign
sign.mysql.ip=localhost
sign.mysql.port=3306
sign.mysql.user=设置的MySQL用户
sign.mysql.password=设置的MySQL用户的密码
sign.mysql.database=webasesign # 数据库名
# if docker mysql disabled[docker.mysql=0] above
# H2 database name of WeBASE-Front (docker mode ignore this)
front.h2.name=webasefront
front.org=fisco
# WeBASE-Web service port
web.port=5000
# enable WeBASE-Web overview pages for mobile phone(docker mode not support h5 yet)
# (0: disable, 1: enable)
web.h5.enable=1
# WeBASE-Node-Manager service port
mgr.port=5001
# WeBASE-Front service port
front.port=5002
# WeBASE-Sign service port
sign.port=5004
# Node listening IP
node.listenIp=127.0.0.1
# Node p2p service port
node.p2pPort=30300
# Node channel service port
node.channelPort=20200
# Node rpc service port
node.rpcPort=8545
# Encrypt type (0: standard, 1: guomi)
encrypt.type=0
# ssl encrypt type (0: standard ssl, 1: guomi ssl)
# only guomi type support guomi ssl
encrypt.sslType=0
# Use existing chain or not (yes/no)
if.exist.fisco=no
### if build new chain, [if.exist.fisco=no]
# Configuration required when building a new chain
# Fisco-bcos version
fisco.version=2.9.1
# Number of building nodes (default value: 2)
# 构建节点个数 (default value: 2)
node.counts= 4 #修改位置
### if using exited chain, [if.exist.fisco=yes]
# The path of the existing chain, the path of the start_all.sh script
# Under the path, there should be a 'sdk' directory where the SDK certificates (ca.crt, sdk.crt, node.key and gm directory(gm ssl)) are stored
fisco.dir=/data/app/nodes/127.0.0.1
# Node directory in [fisco.dir] for WeBASE-Front to connect
# example: 'node.dir=node0' would auto change to '/data/app/nodes/127.0.0.1/node0'
# Under the path, there is a conf directory where node certificates (ca.crt, node.crt and node.key) are stored
node.dir=node0
执行部署
# 一键部署
部署并启动所有服务 python3 deploy.py installAll
停止一键部署的所有服务 python3 deploy.py stopAll
启动一键部署的所有服务 python3 deploy.py startAll
# 各子服务启停
启动FISCO-BCOS节点: python3 deploy.py startNode
停止FISCO-BCOS节点: python3 deploy.py stopNode
启动WeBASE-Web: python3 deploy.py startWeb
停止WeBASE-Web: python3 deploy.py stopWeb
启动WeBASE-Node-Manager: python3 deploy.py startManager
停止WeBASE-Node-Manager: python3 deploy.py stopManager
启动WeBASE-Sign: python3 deploy.py startSign
停止WeBASE-Sign: python3 deploy.py stopSign
启动WeBASE-Front: python3 deploy.py startFront
停止WeBASE-Front: python3 deploy.py stopFront
# 可视化部署
部署并启动可视化部署的所有服务 python3 deploy.py installWeBASE
停止可视化部署的所有服务 python3 deploy.py stopWeBASE
启动可视化部署的所有服务 python3 deploy.py startWeBASE
WeBASE验证
💡外网访问记得打开对应端口
bash <(curl -sL https://gitee.com/luobai-bg/warehouse-2/raw/master/network/firewall | sed 's/\r//g')
访问Webase平台 http://服务器IP:5000
,默认账号:
- 用户名:admin
- 密码:Abcd1234
访问节点控制台 http://服务器IP:5002/WeBASE-Front
,无需登录
3. 部署区块链浏览器
下载安装包
wget https://github.com/FISCO-BCOS/fisco-bcos-browser/releases/download/v2.2.5/browser-deploy.zip
unzip browser-deploy.zip
cd browser-deploy
配置文件修改
vi common.properties
服务端口不能小于1024
修改 common.properties
:
[browser]
package.url=https://ghproxy.net/https://github.com/FISCO-BCOS/fisco-bcos-browser/releases/download/v2.2.5/fisco-bcos-browser.zip # 使用了GitHub文件加速
mysql.ip=127.0.0.1 # 数据库IP
mysql.port=3306 # 数据库端口
mysql.user=root # 数据库用户名
mysql.password=123456 # 数据库密码
mysql.database=webasenodemanager #数据库名称
web.port=5100 # 前端服务端口
server.port=5101 # 后端服务端口
部署所有服务:
python3 deploy.py installAll
由于不是直接安装的Nginx,所以本地可能没有 /etc/nginx/mime.types
Traceback (most recent call last):
File "deploy.py", line 66, in <module>
do()
File "deploy.py", line 14, in do
commBuild.do()
File "/root/browser-deploy/comm/build.py", line 17, in do
startWeb()
File "/root/browser-deploy/comm/build.py", line 235, in startWeb
res2 = doCmd("sudo " + res["output"] + " -c " + nginx_config_dir)
File "/root/browser-deploy/comm/utils.py", line 91, in doCmd
raise Exception("execute cmd error ,cmd : {}, status is {} ,output is {}".format(cmd,status, output))
Exception: execute cmd error ,cmd : sudo /usr/bin/nginx -c /root/browser-deploy/comm/nginx.conf, status is 1 ,output is nginx: [emerg] open() "/etc/nginx/mime.types" failed (2: No such file or directory) in /root/browser-deploy/comm/nginx.conf:13
我们通过 find / -type f -name "mime.types"
查找nginx的这个文件位置
然后打开/root/browser-deploy/comm/nginx.conf
放到对应的位置后重启Nginx/usr/bin/nginx -c /root/browser-deploy/comm/nginx.conf
最后启动 python3 deploy.py startAll
即可(不要再安装了已经安装成功了)
部署服务
# 部署所有服务:
python3 deploy.py installAll
# 停止所有服务:
python3 deploy.py stopAll
# 启动所有服务:
python3 deploy.py startAll
浏览器验证
访问 http://服务器IP:5100/
,查看节点状态和区块信息。
4. 注意事项
-
确保防火墙开放端口:5000 5002(WeBASE)、5100(浏览器)、20200(P2P) … …
-
MySQL需提前创建对应数据库并配置权限
如果遇到相关错误和问题请先查看** 官方源部署文档 官方源部署文档 官方源部署文档**里可能会遇到的问题及解决方法!
bash <(curl -sL https://gitee.com/luobai-bg/warehouse-2/raw/master/network/firewall | sed 's/\r//g')