Hyperledger

[Hyperledger] p.20 개발 환경 설정 (unbuntu 18.04)

bocoder
728x90
반응형

아래 책을 따라하면서 기록해 보았다.

 

[실전! 하이퍼레저 패브릭 - 따라 하며 배우는 기업형 블록체인 시스템 개발과 운영]

https://wikibook.co.kr/practical-hlf/

 

실전! 하이퍼레저 패브릭: 따라 하며 배우는 기업형 블록체인 시스템 개발과 운영

기업형 블록체인 프로젝트를 위한 훌륭한 가이드를 만날 수 있습니다! 이 책에서는 하이퍼레저 패브릭(Hyperledger Fabric)의 개념을 비롯해 다양한 유형의 패브릭 네트워크를 구축하는 내용을 다룬

wikibook.co.kr

 

열심히 따라서 환경 셋팅을 하는데 계속 막힌다.

처음엔 Windows 10 에서 지원하는 ubuntu 18.04 LTS App (WLS)에 개발 환경을 구성하는데, 결국 Host PC와 docker 연동이 안되서 포기.

(참고로 google에 검색하면 나오는 상세한 설명은 가능하면 생략했다.)

VMware 설치 > unbuntu 18.04 설치 > 그리고 아래 명령어를 따라하면 된다.

책 따라서 하다보면 에러가 계속 발생하고.. 구글링을 통해 조금씩 해결해가며, 많은 정보를 조합하여 아래 명령어 순서를 만들었다.

(나는 다양한 에러 때문에 ubuntu를 지우고 다시 셋팅하는 반복을 했기 때문에.. )

그럼 page.37 까지는 끝.

 

----------------------------------------------------

* 참고사항

블로그의 source를 그대로 드래그하여 넣을 경우 명령어를 찾을 수 없다거나 에러가 발생한다.

해당 에러 발생 시 명령어의 맨 앞 글자를 지우고 다시 타이핑 치거나, 직접 소스를 모두 타이핑 치면 해결된다.​

----------------------------------------------------

 

1. node js 설치

sudo apt-get install -y curl
curl -sL https://deb.nodesource.com/setup_8.x | sudo -E bash -
sudo apt-get install -y nodejs
sudo apt-get install -y gcc g++ make

 

2. (option) 이건 추가로 미리 설치 (To install the Yarn package manager, run:)

curl -sL https://dl.yarnpkg.com/debian/pubkey.gpg | sudo apt-key add -
echo "deb https://dl.yarnpkg.com/debian/ stable main" | sudo tee /etc/apt/sources.list.d/yarn.list
sudo apt-get update && sudo apt-get install yarn

3. golang 설치

sudo apt-get update
sudo apt-get -y upgrade
cd /tmp
wget https://dl.google.com/go/go1.10.linux-amd64.tar.gz
sudo tar -xvf go1.10.linux-amd64.tar.gz
sudo mv go /usr/local

 

4. go path 잡아주자

=========vim 설치 =============

sudo apt-get install vim

=============================

vi ~/.profile
<golang setting>
export GOROOT="/usr/local/go"
export GOPATH="$HOME/go"
export GOBIN="$HOME/go/bin"
export PATH="$GOPATH/bin:$GOROOT/bin:$PATH"
export PATH="$GOPATH:$PATH"
source ~/.profile

 

5. go 도구 설치

===========git 설치=============

sudo add-apt-repository ppa:git-core/ppa
sudo apt-get update && sudo apt-get dist-upgrade
sudo apt-get install git-core

==============================

go get golang.org/x/tools/cmd/...

6. Docker 설치 (refere to -->> https://nickjanetakis.com/blog/setting-up-docker-for-windows-and-wsl-to-work-flawlessly)

curl -fsSL https://get.docker.com/ | sudo sh
sudo apt-get update -y

sudo apt-get install -y \
apt-transport-https \
ca-certificates \
curl \
software-properties-common

curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
sudo apt-key fingerprint 0EBFCD88

sudo add-apt-repository \
"deb [arch=amd64] https://download.docker.com/linux/ubuntu \
$(lsb_release -cs) \
stable"

sudo apt-get update -y
sudo apt-get install docker-ce docker-ce-cli containerd.io
sudo usermod -aG docker asd --->>> 'asd'는 본인 사용자이름 입력 // 앞으로의 내용에도 참고

 

7. docker-compose 설치

sudo apt-get install -y python python-pip
pip install --user docker-compose

8. docker path 추가

vi ~/.profile
<docker setting>
export PATH="$PATH:$HOME/.local/bin"
source ~/.profile

9. Hyperledger fabric 환경 구성

​mkdir -p $GOPATH/src/github.com/hyperledger
FABRIC=$GOPATH/src/github.com/hyperledger/fabric
git clone -b release-1.4 http://github.com/hyperledger/fabric $FABRIC
cd $FABRIC
export PATH=$GOPATH/bin:$PATH
make dist-clean all

10. (option) Hyperledger fabric 동작 테스트

cd $GOPATH/src/github.com/hyperledger
git clone -b master https://github.com/hyperledger/fabric-samples.git
​
cd fabric-samples
git checkout v1.1.0
git branch
​
sudo curl -sSL https://goo.gl/6wtTN5 | sudo bash -s 1.1.0
cd first-network
​
./byfn.sh -m generate
./byfn.sh -m up

11. Hyperledger fabric image file 설치 (#10. fabric-samples 폴더를 지운뒤 실행)

curl -sSL http://bit.ly/2ysbOFE | bash -s 1.4.0

 

12. ~/fabric-samples/first-network 위치에서 아래 명령어를 실행하면 테스트 완료!!!!!!

 

./byfn.sh -m generate ./byfn.sh -m up
728x90
반응형