Fabric ubuntu16虚拟机环境搭建
Ubuntu16镜像
ubuntu-16.04.3-server-amd64.iso (如有需要,私信我)
激活root用户
su -s
passwd root
修改软件源
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.154.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
sudoip addr flush ens32 # 刷新IP
sudo systemctl restart networking.service
如果出现虚拟机连不上网,请将vmnet8网卡删除,再次添加,后执行
sudoip addr flush ens32 # 刷新IP
sudo systemctl restart networking.service
并如实际情况修改 sudo vi /etc/network/interfaces
即可。
开启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安装
上传go1.15.11.linux-amd64.tar.gz
cp/home/jornici/go1.15.11.linux-amd64.tar.gz /usr/local/share/
cd/usr/local/share/
tar-C /usr/local/ -zxf go1.15.11.linux-amd64.tar.gz
mkdir-p /root/go/bin
mkdir-p /root/go/src
mkdir-p /root/go/pkg
cat/etc/profile
vim/etc/profile
export GOROOT=/usr/local/go
export GOPATH=/root/go
export PATH=$PATH:$GOROOT/bin:$GOPATH/bin
source/etc/profile
git 安装
sudo apt install -y git
Fabric安装以及E2E执行
#当前路径为/root
mkdir -p go/src/github.com/hyperledger/
cd go/src/github.com/hyperledger/
git clone -b v1.4.4 https://github.com/hyperledger/fabric
git clone -b v1.4.4 https://github.com/hyperledger/fabric-samples
cd fabric
apt-get install -y make
apt-get install -y gcc
make cryptogen
make configtxgen
make configtxlator
cd.build/
cd bin/
ls
cp * /usr/bin/
cd /root/go/src/github.com/hyperledger/fabric
ls
make peer
make orderer
make peer-docker
make orderer-docker
make tools-docker
cd ../fabric-samples/first-network/
docker rm -f $(docker ps -aq) && docker rmi -f $(docker images | grep dev |awk ‘{print $3}’) && docker volume prune
./byfn.sh generate
./byfn.sh up
./byfn.sh down