Fabric ubuntu16虚拟机环境搭建
Ubuntu16镜像
ubuntu-16.04.3-server-amd64.iso (如有需要,私信我)
修改软件源
cd /etc/apt/
sudo cp sources.list sources.list.bak
sudo gedit sources.list
deb-src http://mirror.neu.edu.cn/ubuntu/ xenial main restricted #Added by software-properties deb http://mirror.neu.edu.cn/ubuntu/ xenial main restricted deb-src http://mirror.neu.edu.cn/ubuntu/ xenial restricted multiverse universe #Added by software-properties deb http://mirror.neu.edu.cn/ubuntu/ xenial-updates main restricted deb-src http://mirror.neu.edu.cn/ubuntu/ xenial-updates main restricted multiverse universe #Added by software-properties deb http://mirror.neu.edu.cn/ubuntu/ xenial universe deb http://mirror.neu.edu.cn/ubuntu/ xenial-updates universe deb http://mirror.neu.edu.cn/ubuntu/ xenial multiverse deb http://mirror.neu.edu.cn/ubuntu/ xenial-updates multiverse deb http://mirror.neu.edu.cn/ubuntu/ xenial-backports main restricted universe multiverse deb-src http://mirror.neu.edu.cn/ubuntu/ xenial-backports main restricted universe multiverse #Added by software-properties deb http://archive.canonical.com/ubuntu xenial partner deb-src http://archive.canonical.com/ubuntu xenial partner deb http://mirror.neu.edu.cn/ubuntu/ xenial-security main restricted deb-src http://mirror.neu.edu.cn/ubuntu/ xenial-security main restricted multiverse universe #Added by software-properties deb http://mirror.neu.edu.cn/ubuntu/ xenial-security universe deb http://mirror.neu.edu.cn/ubuntu/ xenial-security multiverse |
sudo apt-get update
sudo apt-get upgrade
sudo apt install net-tools -y
设置固定ip
虚拟机环境下需要看dhcp的范围,再设置静态ip
sudo vi /etc/network/interfaces
auto lo
iface lo inet loopback
auto ens33 //注意自己的网卡名称
iface ens33 inet static address 192.168.1.106 netmask 255.255.255.0 gateway 192.168.1.2 #虚拟机环境下网关1 则连不上网,需要配置2 |
#永久修改
sudo vi /etc/resolvconf/resolv.conf.d/base
#插入内容
nameserver 114.114.114.114 nameserver 8.8.8.8
|
sudo resolvconf -u
sudo /etc/init.d/networking restart
sudo ip addr flush ens32 # 刷新IP
sudo systemctl restart networking.service
开启SSH 链接
sudo apt-get install openssh-server
sudo ps -e |grep ssh
sudo service ssh start
Ubuntu 安装Docker
docker version 18.09
sudo apt install -y docker.io
systemctl enable docker.service
安装docker-compose
docker-compose version 1.22
sudo curl -Lhttps://github.com/docker/compose/releases/download/1.22.0/docker-compose-`uname-s`-`uname -m` -o /usr/local/bin/docker-compose
sudo chmod +x /usr/local/bin/docker-compose
docker-compose --version
Go Ubuntu安装
cd /opt
sudo mkdir golang
sudo wgethttps://storage.googleapis.com/golang/go1.15.11.linux-amd64.tar.gz
tar -xvf go1.15.11.linux-amd64.tar.gz -C
mv go /opt/golang
sudo vim /etc/profile
export GOPATH=/opt/gopath export GOROOT=/opt/golang/go export PATH=$ GOROOT/bin:$PATH |
source /etc/profile
git 安装
sudo apt install -y git
Fabric安装
sudo mkdir -p$GOPATH/src/github.com/hyperkedger/
cd $GOPATH/src/github.com/hyperkedger/
sudo git clone https://github.com/hyperledger/fabric.git
sudo git checkout v1.4.0
mkdir -p /etc/docker
sudo vim /etc/docker/daemon.json
{ "registry-mirrors":["https://8w1wqmsz.mirror.aliyuncs.com"]
} |
“Job fordocker.service failed because the control process exited with error code. See"systemctl status docker.service" and "journalctl -xe" fordetails.” 检查daemon.json的正确性
sudo systemctl daemon-reload
sudo systemctl restart docker
sudo docker pull hyperledger/fabric-peer:latest
sudo docker pull hyperledger/fabric-orderer:latest
sudo docker pull hyperledger/fabric-tools:latest
sudo docker pull hyperledger/fabric-ccenv:latest
sudo docker pull hyperledger/fabric-baseos:latest
sudo docker pull hyperledger/fabric-kafka:latest
sudo docker pull hyperledger/fabric-couchdb:latest
sudo docker pull hyperledger/fabric-ca:latest