Linux下的Swarm测试节点部署教程

前期准备工具

  • 操纵系统:Ubuntu 20.04.2 LTS/CentOS 8 x64
  • 远程连接工具:FinalShell

Linux环境部署

Ubuntu更新系统命令

apt-get update
apt-get upgrade

CentOS更新系统命令

yum update
yum upgrade

创建并进入bee文件夹

依次输入命令:

mkdir bees
cd bees

下载安装clef

Ubuntu下载安装bee clef命令

wget https://github.com/ethersphere/bee-clef/releases/download/v0.4.12/bee-clef_0.4.12_amd64.deb
sudo dpkg -i bee-clef_0.4.12_amd64.deb

CentOS下载安装bee clef命令

wget https://github.com/ethersphere/bee-clef/releases/download/v0.4.12/bee-clef_0.4.12_amd64.rpm
sudo rpm -i bee-clef_0.4.12_amd64.rpm

下载安装bee

Ubuntu下载安装bee命令

wget https://github.com/ethersphere/bee/releases/download/v0.6.2/bee_0.6.2_amd64.deb
sudo dpkg -i bee_0.6.2_amd64.deb

CentOS下载安装bee命令

wget https://github.com/ethersphere/bee/releases/download/v0.6.2/bee_0.6.2_amd64.rpm
sudo rpm -i bee_0.6.2_amd64.rpm

安装screen

Ubuntu安装命令

apt-get install -y screen

CentOS安装命令

yum install -y screen

安装并在后台运行clef-service

screen -S clef

(确保路径是在/bees下)

新建clef-service文件

vim clef-service

按”i”键将如下代码全部复制粘贴到新建的文件

#!/usr/bin/env bash
start() {
    KEYSTORE=/var/lib/bee-clef/keystore
    CONFIGDIR=/var/lib/bee-clef
    CHAINID=5
    SECRET=$(cat /var/lib/bee-clef/password)
    # clef with every start sets permissions back to 600
    (while [ ! -f /var/lib/bee-clef/clef.ipc ]; do sleep 1; done && chmod 660 /var/lib/bee-clef/clef.ipc) &
    rm /var/lib/bee-clef/stdin /var/lib/bee-clef/stdout || true
    mkfifo /var/lib/bee-clef/stdin /var/lib/bee-clef/stdout
    (
    exec 3>/var/lib/bee-clef/stdin
    while read < /var/lib/bee-clef/stdout
    do
        if [[ "$REPLY" =~ "enter the password" ]]; then
            echo '{ "jsonrpc": "2.0", "id":1, "result": { "text":"'"$SECRET"'" } }' > /var/lib/bee-clef/stdin
            break
        fi
    done
    ) &
    clef --stdio-ui --keystore $KEYSTORE --configdir $CONFIGDIR --chainid $CHAINID --rules /etc/bee-clef/rules.js --nousb --4bytedb-custom /etc/bee-clef/4byte.json --pcscdpath "" --auditlog "" --loglevel 3 --ipcpath /var/lib/bee-clef < /var/lib/bee-clef/stdin | tee /var/lib/bee-clef/stdout
}
stop() {
    echo "STOP! Systemd will stop the service!"
}
case $1 in
    start|stop) "$1"
esac

按”:wq”保存退出编辑!

赋予clef-service文件可执行权限

chmod a+x clef-service

启动clef

./clef-service start

界面无报错即标代表启动完成

关掉当前窗口

按住ctrl不松,分别按a、d,关掉当前子窗口(注意是快速同时按一次就可以)

原创文章,作者:朋远方,如若转载,请注明出处:https://caovan.com/linuxxiadeswarmceshijiedianbushujiaocheng/.html

(0)
打赏 微信扫一扫 微信扫一扫
朋远方的头像朋远方
上一篇 2021年3月21日 上午11:05
下一篇 2021年6月12日 下午1:36

相关推荐

发表回复

登录后才能评论