CITA环境配置与部署(Ubuntu18.04)
1.安装Rust
sudo apt-get install curl
curl https://sh.rustup.rs -sSf | sh
sudo apt-get install rustc
检查rustc安装是否成功
rustc --version
2.下载CITA源码
git clone -b v0.25.2 https://github.com/citahub/cita
cd cita
git submodule init
遇到Submodule ‘cita-bft’(…)registered for path 'cita-bft’报错时:
git submodule sync
git submodule update --init --recursive
git submodule update
3.编译
调试模式编译./env.sh make debug
遇到docker find no command报错
sudo apt install docker.io
再次编译遇到get permission denied报错
sudo groupadd docker
#添加docker用户组
sudo gpasswd -a 用户名 docker
#用户名为当前用户用户名
newgrp docker
docker ps
发行模式编译./env.sh make release
#未测试
4.配置CITA
cita-cli key create
返回address,private,public
若cita-cli命令不存在,下载cita-cli安装包
https://docs.citahub.com/zh-CN/cita/getting-started/setup 下载在cita文件夹中
进入编译好的结果目录cita/target/install,初始化链
bin/cita create --super_admin "0x37d1c7449bfe76fe9c445e626da06265e9377601" --nodes "127.0.0.1:4000,127.0.0.1:4001,127.0.0.1:4002,127.0.0.1:4003" --chain_name "test-chain01"
#super_admin地址用上面返回的address
5.启动CITA
第一次启动 CITA 时需要使用 setup 命令初始化每个节点,之后重新启动不需要再次操作。(也在install下操作)
bin/cita setup test-chain01/0
#test-chain01/节点编号
bin/cita start test-chain01/0
启动0-3四个节点后,检查节点是否运行正常
bin/cita top test-chain01/0
#test-chain01/节点编号
通过端口localhost:15672访问rabbitmq通信可视化
CITA在vscode中运行问题
cargo build error:failed to run custom build command for 'openssl-sys v0.9.39’
sudo apt install libssl-dev
安装最新的libssl包
sudo rm -rf Cargo.lock target/
清除之前build failed的文件