Build FISCO bcos 2.8.0 blockchain system for Ubuntu 20.04

0. Summary

This paper describes the installation process in detail according to the official documents of FISCO bcos and Webase. For some unclear places in the official documents, it has been supplemented to facilitate novice construction.

1. Preparation

1.1 system:

Ubuntu 20.04.3 Desktop / Server
Fisco-BCOS 2.8.0

1.2 virtual machine configuration:

Recommended hardware configurationActual configuration
CPU2.4GHz * 8 cores8 core
Memory8GB12GB
storage4TB128GB
network bandwidth 10Mbps1000Mbps

2. Build a single group FISCO BCOS alliance chain

2.1 configuration system

2.1.1 update the system

sudo apt update -y && sudo apt upgrade -y

2.1.2 configure SSH

Note: for Ubuntu Server 20.04, this step is not necessary because openSSH is installed and configured by default.

However, SSH is not configured for Ubuntu Desktop 20.04, which needs to be configured manually. The configuration commands are as follows:

sudo apt install openssh-server -y
sudo ufw allow ssh

2.2 installation dependency

2.2.1 installing dependency packages

All the dependent packages that need to be used are installed here.

sudo apt install -y openssl curl wget git nginx dos2unix vim python3-pip unzip software-properties-common dirmngr apt-transport-https

2.2.2 installation of Python and related libraries

Since Ubuntu 20.04 comes with Python version 3.8, which meets the installation requirements of FISCO bcos, there is no need to repeat the installation.

Install PyMySQL Library

sudo pip3 install PyMySQL

2.2.3 installing Java

Create a new folder and install Java 8 or above. JDK 8 - JDK 13 is recommended. Put the downloaded jdk in the / usr/local directory

From Oracle official website( https://www.oracle.com/java/technologies/downloads/#java8 )Select Java 8 or above to download, for example, jdk-8u311-linux-x64 tar. gz

# Move the JDK package to the / usr/local directory
cp ./jdk-8u311-linux-x64.tar.gz /usr/local/

# Unzip jdk
sudo tar -zxvf jdk-8u311-linux-x64.tar.gz

#Modify the file name of the extracted file
mv jdk1.8.0_311 jdk-8u311

# Configure the Java environment and edit the / etc/profile file
sudo vim /etc/profile

# After opening, input the following three sentences into the file and save to exit
export JAVA_HOME=/usr/local/jdk-8u311  #This is a file directory, not a file
export PATH=$JAVA_HOME/bin:$PATH
export CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar

# Effective profile
# Note that there is no need to add sudo before the following command
source /etc/profile

# Query the Java version. If the version appears to be the version you downloaded, the installation is successful.
java -version
javac -version

2.2.4 install MariaDB 10.3 (equivalent to MySQL 5.7)

Configure the installation source and install MariaDB 10.3

sudo apt-key adv --fetch-keys 'https://mariadb.org/mariadb_release_signing_key.asc'
sudo add-apt-repository 'deb [arch=amd64] https://mirrors.aliyun.com/mariadb/repo/10.3/ubuntu focal main'
sudo apt update -y
sudo apt install -y mariadb-server mariadb-client
sudo systemctl enable mariadb.service

If MariaDB appears_ release_ signing_ key. If ASC cannot be downloaded, you can download MariaDB with wget first_ release_ signing_ key. ASC, and then import it into repo. The specific commands are as follows:

wget https://mariadb.org/mariadb_release_signing_key.asc
sudo apt-key add mariadb_release_signing_key.asc 
sudo add-apt-repository 'deb [arch=amd64] https://mirrors.aliyun.com/mariadb/repo/10.3/ubuntu focal main'
sudo apt update -y
sudo apt install -y mariadb-server mariadb-client
sudo systemctl enable mariadb.service

During installation, the root account password will be configured

Log in to MySQL with root account

mysql -u root -p -h localhost -P 3306

Authorize root user to remotely access and create test user and authorize local access

mysql > GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY '123456' WITH GRANT OPTION;
mysql > GRANT ALL PRIVILEGES ON *.* TO 'test'@localhost IDENTIFIED BY '123456' WITH GRANT OPTION;
mysql > flush PRIVILEGES;
mysql > create database webasenodemanager;
mysql > exit

2.3 build a single group 4-node alliance chain

2.3.1 create operation directory

cd ~ && mkdir -p fisco && cd fisco

2.3.2 download script

curl -#LO https://github.com/FISCO-BCOS/FISCO-BCOS/releases/download/v2.8.0/build_chain.sh && chmod u+x build_chain.sh

If you can't download build for a long time due to network problems_ chain. SH script, please try

curl -#LO https://osp-1257653870.cos.ap-guangzhou.myqcloud.com/FISCO-BCOS/FISCO-BCOS/releases/v2.8.0/build_chain.sh && chmod u+x build_chain.sh

2.3.3 build a single group 4-node alliance chain

bash ~/fisco/build_chain.sh -l 127.0.0.1:4 -p 30300,20200,8545

## Start all nodes
bash ~/fisco/nodes/127.0.0.1/start_all.sh

## *Close all nodes
bash ~/fisco/nodes/127.0.0.1/stop_all.sh

2.3.4 inspection process

Check whether the process is started

ps -ef | grep -v grep | grep fisco-bcos

Check log output

tail -f ~/fisco/nodes/127.0.0.1/node0/log/log*  | grep connected

Check whether there is consensus

tail -f ~/fisco/nodes/127.0.0.1/node0/log/log*  | grep +++

3. Configure console

Get the console and go back to the fisco directory

cd ~/fisco && curl -#LO https://gitee.com/FISCO-BCOS/console/raw/master-2.0/tools/download_console.sh && bash download_console.sh && bash download_console.sh

Copy configuration files and certificates

cp -n ~/fisco/console/conf/config-example.toml ~/fisco/console/conf/config.toml
cp -r ~/fisco/nodes/127.0.0.1/sdk/* ~/fisco/console/conf/,

Note: the console can only be started after the blockchain is started here, otherwise an error will be reported

bash ~/fisco/console/start.sh

4. Configure WeBase

cd ~/fisco/ && wget https://osp-1257653870.cos.ap-guangzhou.myqcloud.com/WeBASE/releases/download/v1.5.3/webase-deploy.zip

Note here that normal accounts should be used for decompression and other operations, not sudo

unzip webase-deploy.zip

Modify common properties

vi ~/webase-deploy/common.properties

# ----------common.properties are as follows:

# Latest version of WeBASE subsystem (v1.1.0 or above)
webase.web.version=v1.5.3
webase.mgr.version=v1.5.3
webase.sign.version=v1.5.3
webase.front.version=v1.5.3

#####################################################################
## To enable Mysql service using Docker, you need to configure the following values

# 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

#####################################################################
## If you do not use Docker to start Mysql, you need to configure the following values

# mysql database configuration of node management subsystem
mysql.ip=127.0.0.1
mysql.port=3306
mysql.user=dbUsername                  <-------It needs to be changed here
mysql.password=dbPassword              <-------It needs to be changed here
mysql.database=webasenodemanager

# mysql database configuration of signature service subsystem
sign.mysql.ip=localhost
sign.mysql.port=3306
sign.mysql.user=dbUsername                  <-------It needs to be changed here
sign.mysql.password=dbPassword              <-------It needs to be changed here
sign.mysql.database=webasesign



# Node front subsystem h2 database name and organization
front.h2.name=webasefront
front.org=fisco

# WeBASE management platform service port
web.port=5000
# Enable mobile management platform (0: disable, 1: enable)
web.h5.enable=1

# Node management subsystem service port
mgr.port=5001
# Node front subsystem port
front.port=5002
# Signature service subsystem port
sign.port=5004


# Node monitoring Ip
node.listenIp=127.0.0.1
# Node p2p port
node.p2pPort=30300
# Node chain up and down ports
node.channelPort=20200
# Node rpc port
node.rpcPort=8545

# Encryption type (0: ECDSA algorithm, 1: state secret algorithm)
encrypt.type=0
# SSL connection encryption type (0: ECDSA SSL, 1: state secret SSL)
# Only the state secret chain can use state secret SSL
encrypt.sslType=0

# Whether to use the existing chain (yes/no)
if.exist.fisco=no              <-------It needs to be changed here

# Configuration is required when using an existing chain
# Path of existing chain, start_all.sh script path
# There should be an SDK directory under the path (the SDK directory contains the certificates required for SSL, i.e. ca.crt, sdk.crt, sdk.key and gm directory (including state secret SSL certificates, gmca.crt, gmsdk.crt, gmsdk.key, gmensdk.crt and gmensdk.key)
fisco.dir=/data/app/nodes/127.0.0.1              <-------It needs to be changed here
# The pre connected node is one of the nodes in the 127.0.0.1 directory
# There should be a conf folder under the node path, where node certificates (ca.crt, node.crt and node.key) are stored
node.dir=node0

# Configuration required when building a new chain
# FISCO-BCOS version
fisco.version=2.7.2
# Number of construction nodes (two by default)
node.counts=nodeCounts

Deploy and start all services

cd ~/webase-deploy/ && python3 deploy.py installAll

After service deployment, you need to start and stop each service. You can use the following commands:

# One click deployment
 Deploy and start all services        python3 deploy.py installAll
 Stop all services deployed with one click    python3 deploy.py stopAll
 Start all services of one click deployment    python3 deploy.py startAll
# Start and stop of each sub service
 start-up FISCO-BCOS node:      python3 deploy.py startNode
 stop it FISCO-BCOS node:      python3 deploy.py stopNode
 start-up WeBASE-Web:          python3 deploy.py startWeb
 stop it WeBASE-Web:          python3 deploy.py stopWeb
 start-up WeBASE-Node-Manager: python3 deploy.py startManager
 stop it WeBASE-Node-Manager: python3 deploy.py stopManager
 start-up WeBASE-Sign:        python3 deploy.py startSign
 stop it WeBASE-Sign:        python3 deploy.py stopSign
 start-up WeBASE-Front:        python3 deploy.py startFront
 stop it WeBASE-Front:        python3 deploy.py stopFront
# Visual deployment
 Deploy and start all services for visual deployment  python3 deploy.py installWeBASE
 Stop all services for visual deployment  python3 deploy.py stopWeBASE
 Start all services for visual deployment  python3 deploy.py startWeBASE

Access to WeBASE management platform:

http://{deployIP}:{webPort}
Example: http://localhost:5000

reference:

https://fisco-bcos-documentation.readthedocs.io/zh_CN/latest/docs/installation.html#fisco-bcos
https://fisco-bcos-documentation.readthedocs.io/zh_CN/latest/docs/webase/webase.html

Keywords: Linux Blockchain Ubuntu

Added by Kurrel on Fri, 04 Feb 2022 09:32:47 +0200