WeBASE部署 - 搭建FISCO节点

参考文档

WeBASE官网:一键部署 — WeBASE v1.5.4 文档

部署环境

虚拟机:VMWare Workstation 15 Pro

虚拟机安装的操作系统:CentOS7.9(带可视化界面),官网推荐使用CentOS7.2+

前置条件

1、Java (Oracle JDK 8 至 14)

安装JDK8,参见:CentOS7 安装 Java JDK_ling1998的博客-CSDN博客

2、MySQL(MySQL5.6+)

注:之前没有安装过MySQL,若安装了MySQL5.5及以下版本,则需要先卸载,详情参见官网。

安装MariaDB10.2,参见:CentOS7 安装 MySql (MariaDB10.2)_ling1998的博客-CSDN博客

3、Python(Python3.6+)

(1)安装 

[root@localhost local]# yum install -y python36

(2)查看版本

[root@localhost local]# python3 --version
Python 3.6.8

4、PyMySQL

(1)git下载PyMySQL 

若没装git,可参见(超简单):Centos7 安装 git_ling1998的博客-CSDN博客_centos7安装git

[root@localhost local]# git clone https://github.com/PyMySQL/PyMySQL

(2)进入 PyMySQL目录

[root@localhost local]# cd PyMySQL/

 (3)安装PyMySQL

[root@localhost PyMySQL]# python3 setup.py install

开放端囗

开放端囗5000,开放方法参见:CentOS7 开放端囗(使用iptables)_ling1998的博客-CSDN博客

安装WeBASE

1、下载安装包

[root@localhost local]# wget https://osp-1257653870.cos.ap-guangzhou.myqcloud.com/WeBASE/releases/download/v1.5.4/webase-deploy.zip

2、解压安装包

[root@localhost local]# unzip webase-deploy.zip 

3、进入解压目录 

[root@localhost local]# cd webase-deploy
[root@localhost webase-deploy]# ls
comm               deploy.py  install.md  README-en.md      telnet.py  visual-deploy.properties
common.properties  docker     nodeconf    release_note.txt  upgrade    webase-upgrade.sh

4、修改配置文件

[root@localhost webase-deploy]# vi common.properties 

目前只修改数据库的用户名与密码即可,如下所示: 

......
# Mysql database configuration of WeBASE-Node-Manager 管理节点服务
mysql.ip=localhost
mysql.port=3306
mysql.user=root        #修改数据库用户名
mysql.password=root    #修改数据库密码
mysql.database=webasenodemanager

# Mysql database configuration of WeBASE-Sign  #签名服务
sign.mysql.ip=localhost
sign.mysql.port=3306
sign.mysql.user=root     #修改数据库用户名
sign.mysql.password=root #修改数据库密码
sign.mysql.database=webasesign
......

 按Esc退出编辑,输入:wq保存退出。

5、部署

[root@localhost webase-deploy]# python3 deploy.py installAll
============================================================

              _    _     ______  ___  _____ _____ 
             | |  | |    | ___ \/ _ \/  ___|  ___|
             | |  | | ___| |_/ / /_\ \ `--.| |__  
             | |/\| |/ _ | ___ |  _  |`--. |  __| 
             \  /\  |  __| |_/ | | | /\__/ | |___ 
              \/  \/ \___\____/\_| |_\____/\____/  
    
============================================================
==============      checking envrionment      ==============
check git...
check finished sucessfully.
check openssl...
check finished sucessfully.
check curl...
check finished sucessfully.

# 中间安装信息省略 ......

============================================================
==============      deploy  has completed     ==============
============================================================
==============    webase-web version  v1.5.4        ========
==============    webase-node-mgr version  v1.5.4   ========
==============    webase-sign version  v1.5.3       ========
==============    webase-front version  v1.5.4      ========
============================================================

 6、查看启动端囗

节点channel端口20200,webase-front端囗 5002,webase-node-mgr端囗 5001,webase-web端囗 5000,webase-sign端囗 5004

[root@localhost webase-deploy]# netstat -lntp
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name    
tcp        0      0 192.168.122.1:53        0.0.0.0:*               LISTEN      1577/dnsmasq        
tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN      1244/sshd           
tcp        0      0 127.0.0.1:631           0.0.0.0:*               LISTEN      1242/cupsd          
tcp        0      0 127.0.0.1:25            0.0.0.0:*               LISTEN      1582/master         
tcp        0      0 0.0.0.0:30300           0.0.0.0:*               LISTEN      68617/fisco-bcos    
tcp        0      0 0.0.0.0:30301           0.0.0.0:*               LISTEN      68619/fisco-bcos    
tcp        0      0 0.0.0.0:8545            0.0.0.0:*               LISTEN      68617/fisco-bcos    
tcp        0      0 0.0.0.0:8546            0.0.0.0:*               LISTEN      68619/fisco-bcos    
tcp        0      0 0.0.0.0:5000            0.0.0.0:*               LISTEN      69441/nginx: master 
tcp        0      0 0.0.0.0:20200           0.0.0.0:*               LISTEN      68617/fisco-bcos    
tcp        0      0 0.0.0.0:20201           0.0.0.0:*               LISTEN      68619/fisco-bcos    
tcp        0      0 0.0.0.0:111             0.0.0.0:*               LISTEN      719/rpcbind         
tcp6       0      0 :::22                   :::*                    LISTEN      1244/sshd           
tcp6       0      0 ::1:631                 :::*                    LISTEN      1242/cupsd          
tcp6       0      0 ::1:25                  :::*                    LISTEN      1582/master         
tcp6       0      0 :::9090                 :::*                    LISTEN      55192/main          
tcp6       0      0 :::5001                 :::*                    LISTEN      69314/java          
tcp6       0      0 :::5002                 :::*                    LISTEN      69133/java          
tcp6       0      0 :::3306                 :::*                    LISTEN      66096/mysqld        
tcp6       0      0 :::5004                 :::*                    LISTEN      69001/java          
tcp6       0      0 :::111                  :::*                    LISTEN      719/rpcbind   

 7、访问WeBASE管理平台

打开Chrome与Firefox浏览器,输入地址 http://部署WeBASE机器的ip地址:5000 

WeBASE部署 - 搭建FISCO节点_第1张图片

(1)登录

默认账号为admin,默认密码为Abcd1234

(2)重置密码(首次登录)

WeBASE部署 - 搭建FISCO节点_第2张图片

(3)创建用户

Menu > Private Key Mgmt > Add User

WeBASE部署 - 搭建FISCO节点_第3张图片

WeBASE部署 - 搭建FISCO节点_第4张图片

(4)合约IDE

智能合约代码如下:

pragma solidity^0.6.0;

contract hello {
    string name;
    
    constructor(string memory _name) public {
        name = _name;
    }
    
    function getName() public view returns(string memory) {
        return name;
    }
    
    function setName(string memory _name) public {
        name = _name;
    }
}

在合约IDE中编写、编译及部署 

WeBASE部署 - 搭建FISCO节点_第5张图片

8、启动与停止

可以执行python3 deploy.py命令查看所有指令

[root@localhost webase-deploy]# python3 deploy.py 

Usage: python deploy [Parameter]

Parameter:
    check:          check the environment [one-click mode]
    installAll:     check the environment, deploy FISCO-BCOS and all service [one-click mode] 
    startAll:       check service port, start all service [one-click mode] 
    stopAll:        stop all service [one-click mode] 
    installWeBASE:  check the environment, deploy without FISCO-BCOS nodes and WeBASE-Front service [visual mode] 
    startWeBASE:    check service port, start all service deploy under visual deploy model [visual mode] 
    stopWeBASE:     stop all service deploy under visual deploy model [visual mode] 
    startNode:      start FISCO-BCOS nodes [one-click mode or docker mode]
    stopNode:       stop FISCO-BCOS nodes [one-click mode or docker mode]
    startWeb:       start WeBASE-Web service [one-click mode or visual mode]
    stopWeb:        stop WeBASE-Web service [one-click mode or visual mode]
    startManager:   start WeBASE-Node-Manager service [one-click mode or visual mode]
    stopManager:    stop WeBASE-Node-Manager service [one-click mode or visual mode]
    startFront:     start WeBASE-Front service [one-click mode]
    stopFront:      stop WeBASE-Front service [one-click mode]
    startSign:      start WeBASE-Sign service [one-click mode or visual mode]
    stopSign:       stop WeBASE-Sign service [one-click mode or visual mode]
    installDockerAll    check dependency, deploy FISCO-BCOS nodes and all service, start by docker
    startDockerAll      check docker container, start FISCO-BCOS nodes and all service by docker
    stopDockerAll       stop FISCO-BCOS nodes and all service in docker
    pullDockerAll       pull FISCO-BCOS, WeBASE and mysql images from dockerhub
    startDocker         check docker container, start all webase service by docker
    stopDocker          stop all webase service in docker

Attention:
    1. Need to install python3.6, jdk, mysql, PyMySQL first
    2. Need to ensure a smooth network
    3. You need to install git,openssl,curl,wget,nginx,dos2unix; if it is not installed, the installation script will automatically install these components, but this may fail.

启动指令以start开头,可以启动所有服务,也可以启动指定服务,下面是启动所有指令:

[root@localhost webase-deploy]# python3 deploy.py startAll
==============      checking    port          ==============
check WeBASE-Web port...
check finished sucessfully.
check WeBASE-Node-Manager port...
check finished sucessfully.
check WeBASE-Sign port...
check finished sucessfully.
check WeBASE-Front port...
check finished sucessfully.
==============        port    available       ==============
==============      Starting FISCO-BCOS       ==============
try to start node0
try to start node1
 node1 start successfully
 node0 start successfully
==============      FISCO-BCOS  Started       ==============
==============      Starting WeBASE-Sign      ==============
============== WeBASE-Sign starting. Please check through the log file (default path:./webase-sign/log/). ==============
==============      WeBASE-Sign  Started      ==============
==============     Starting WeBASE-Front      ==============
============== WeBASE-Front starting. Please check through the log file (default path:./webase-front/log/). ==============
==============     WeBASE-Front  Started.     ==============
==============  Starting WeBASE-Node-Manager  ==============
============== WeBASE-Node-Manager starting. Please check through the log file (default path:./webase-node-mgr/log/). ==============
==============  WeBASE-Node-Manager  Started  ==============
==============      Starting WeBASE-Web       ==============
==============      WeBASE-Web Started        ==============

停止指令以stop开头,可以停止所有服务,也可以停止指定服务,下面是停止所有指令:

[root@localhost webase-deploy]# python3 deploy.py stopAll
=======      WeBASE-Web     stop  success!  =======
======= WeBASE-Node-Manager stop  success!  =======
=======     WeBASE-Front    stop  success!  =======
=======     WeBASE-Sign     stop  success!  =======
try to stop node0
try to stop node1
 stop node1 success.
 stop node0 success.

你可能感兴趣的:(区块链,智能合约,区块链,智能合约)