Hyperledger fabric1.1.0(一):基本環(huán)境整理

操作系統(tǒng)為:centos7距淫。

整理包括:linux內(nèi)核升級(若升級失敗月劈,可參考https://blog.csdn.net/tianshuhao521/article/details/84021064),jdk安裝,docker(docker ce,docker-compose)安裝,go語言環(huán)境安裝唇辨。

1、Docker要求的linux內(nèi)核版本最低為3.10能耻,故需將linux內(nèi)核升級到4.x赏枚,并更新本地依賴亡驰,一般執(zhí)行以下命令即可:

<pre spellcheck="false" class="md-fences md-end-block ty-contain-cm modeLoaded" cid="n5" mdtype="fences" style="box-sizing: border-box; overflow: visible; font-family: var(--monospace); font-size: 0.9em; display: block; break-inside: avoid; text-align: left; white-space: normal; background-image: inherit; background-position: inherit; background-size: inherit; background-repeat: inherit; background-attachment: inherit; background-origin: inherit; background-clip: inherit; background-color: rgb(248, 248, 248); position: relative !important; border: 1px solid rgb(231, 234, 237); border-radius: 3px; padding: 8px 4px 6px; margin-bottom: 15px; margin-top: 15px; width: inherit; color: rgb(51, 51, 51); font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;" lang="">sudo yum update</pre>

20181109085750923.png

最后complete!表示更新成功。

2饿幅、安裝jdk(我用的1.8):

(2.1)官網(wǎng)下載tar.gz安裝包凡辱,上傳至自己的目錄,我這里是/home/develop/java/jdk

(2.2)進(jìn)入/home/develop/java/jdk目錄并解壓安裝包:

<pre spellcheck="false" class="md-fences md-end-block ty-contain-cm modeLoaded" cid="n11" mdtype="fences" style="box-sizing: border-box; overflow: visible; font-family: var(--monospace); font-size: 0.9em; display: block; break-inside: avoid; text-align: left; white-space: normal; background-image: inherit; background-position: inherit; background-size: inherit; background-repeat: inherit; background-attachment: inherit; background-origin: inherit; background-clip: inherit; background-color: rgb(248, 248, 248); position: relative !important; border: 1px solid rgb(231, 234, 237); border-radius: 3px; padding: 8px 4px 6px; margin-bottom: 15px; margin-top: 15px; width: inherit; color: rgb(51, 51, 51); font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;" lang=""> cd /home/develop/java/jdk
?
tar -zxvf jdk-8u181-linux-x64.tar.gz</pre>

(2.3)配置環(huán)境變量:

(2.3.1)輸入命令:vim /etc/profile

(2.3.2)點擊i或者o進(jìn)入編輯模式

(2.3.3)在最后添加以下內(nèi)容(JAVA_HOME為自己的安裝目錄):

<pre spellcheck="false" class="md-fences md-end-block ty-contain-cm modeLoaded" cid="n16" mdtype="fences" style="box-sizing: border-box; overflow: visible; font-family: var(--monospace); font-size: 0.9em; display: block; break-inside: avoid; text-align: left; white-space: normal; background-image: inherit; background-position: inherit; background-size: inherit; background-repeat: inherit; background-attachment: inherit; background-origin: inherit; background-clip: inherit; background-color: rgb(248, 248, 248); position: relative !important; border: 1px solid rgb(231, 234, 237); border-radius: 3px; padding: 8px 4px 6px; margin-bottom: 15px; margin-top: 15px; width: inherit; color: rgb(51, 51, 51); font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;" lang=""> java environment
export JAVA_HOME=/home/develop/java/jdk/jdk1.8.0_181
export CLASSPATH=.:{JAVA_HOME}/jre/lib/rt.jar:{JAVA_HOME}/lib/dt.jar:{JAVA_HOME}/lib/tools.jar export PATH=PATH:${JAVA_HOME}/bin</pre>

(2.3.4)按esc鍵進(jìn)入命令模式栗恩,輸入:wq保存并退出vim透乾。

(2.3.5)輸入命令source /etc/profile使文件生效。

(2.3.6)輸入命令java -version查看jdk版本磕秤,如圖:

20181109094446239.png

3乳乌、安裝Docker

(3.1)如果以前安裝過Docker,需要先卸載市咆,命令如下:

<pre spellcheck="false" class="md-fences md-end-block ty-contain-cm modeLoaded" cid="n23" mdtype="fences" style="box-sizing: border-box; overflow: visible; font-family: var(--monospace); font-size: 0.9em; display: block; break-inside: avoid; text-align: left; white-space: normal; background-image: inherit; background-position: inherit; background-size: inherit; background-repeat: inherit; background-attachment: inherit; background-origin: inherit; background-clip: inherit; background-color: rgb(248, 248, 248); position: relative !important; border: 1px solid rgb(231, 234, 237); border-radius: 3px; padding: 8px 4px 6px; margin-bottom: 15px; margin-top: 15px; width: inherit; color: rgb(51, 51, 51); font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;" lang=""> sudo yum remove docker docker-client docker-client-latest docker-common docker-latest docker-latest-logrotate docker-logrotate docker-selinux docker-engine-selinux docker-engine</pre>

(3.2)在線安裝docker ce

(3.2.1)安裝yum-utils提供的yum-config-manager汉操,device-mapper-persistent-data和lvm2,命令如下:

<pre spellcheck="false" class="md-fences md-end-block ty-contain-cm modeLoaded" cid="n26" mdtype="fences" style="box-sizing: border-box; overflow: visible; font-family: var(--monospace); font-size: 0.9em; display: block; break-inside: avoid; text-align: left; white-space: normal; background-image: inherit; background-position: inherit; background-size: inherit; background-repeat: inherit; background-attachment: inherit; background-origin: inherit; background-clip: inherit; background-color: rgb(248, 248, 248); position: relative !important; border: 1px solid rgb(231, 234, 237); border-radius: 3px; padding: 8px 4px 6px; margin-bottom: 15px; margin-top: 15px; width: inherit; color: rgb(51, 51, 51); font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;" lang=""> sudo yum install -y yum-utils device-mapper-persistent-data lvm2</pre>

最后complete!

(3.2.2)設(shè)置穩(wěn)定存儲庫:

20181109091638190.png

<pre spellcheck="false" class="md-fences md-end-block ty-contain-cm modeLoaded" cid="n30" mdtype="fences" style="box-sizing: border-box; overflow: visible; font-family: var(--monospace); font-size: 0.9em; display: block; break-inside: avoid; text-align: left; white-space: normal; background-image: inherit; background-position: inherit; background-size: inherit; background-repeat: inherit; background-attachment: inherit; background-origin: inherit; background-clip: inherit; background-color: rgb(248, 248, 248); position: relative !important; border: 1px solid rgb(231, 234, 237); border-radius: 3px; padding: 8px 4px 6px; margin-bottom: 15px; margin-top: 15px; width: inherit; color: rgb(51, 51, 51); font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;" lang=""> sudo yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo</pre>

(3.2.3)可以選擇性的啟用edge和測試存儲庫蒙兰,這些存儲庫包含在Docker中磷瘤,默認(rèn)是禁用的,命令如下:

<pre spellcheck="false" class="md-fences md-end-block ty-contain-cm modeLoaded" cid="n32" mdtype="fences" style="box-sizing: border-box; overflow: visible; font-family: var(--monospace); font-size: 0.9em; display: block; break-inside: avoid; text-align: left; white-space: normal; background-image: inherit; background-position: inherit; background-size: inherit; background-repeat: inherit; background-attachment: inherit; background-origin: inherit; background-clip: inherit; background-color: rgb(248, 248, 248); position: relative !important; border: 1px solid rgb(231, 234, 237); border-radius: 3px; padding: 8px 4px 6px; margin-bottom: 15px; margin-top: 15px; width: inherit; color: rgb(51, 51, 51); font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;" lang=""> sudo yum-config-manager --enable docker-ce-edge
?
sudo yum-config-manager --enable docker-ce-test</pre>

(3.2.4)以下命令為禁用edgecunc存儲庫:

<pre spellcheck="false" class="md-fences md-end-block ty-contain-cm modeLoaded" cid="n34" mdtype="fences" style="box-sizing: border-box; overflow: visible; font-family: var(--monospace); font-size: 0.9em; display: block; break-inside: avoid; text-align: left; white-space: normal; background-image: inherit; background-position: inherit; background-size: inherit; background-repeat: inherit; background-attachment: inherit; background-origin: inherit; background-clip: inherit; background-color: rgb(248, 248, 248); position: relative !important; border: 1px solid rgb(231, 234, 237); border-radius: 3px; padding: 8px 4px 6px; margin-bottom: 15px; margin-top: 15px; width: inherit; color: rgb(51, 51, 51); font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;" lang=""> sudo yum-config-manager --disable docker-ce-edge</pre>

(3.2.5)安裝最新版的Docker CE:

<pre spellcheck="false" class="md-fences md-end-block ty-contain-cm modeLoaded" cid="n36" mdtype="fences" style="box-sizing: border-box; overflow: visible; font-family: var(--monospace); font-size: 0.9em; display: block; break-inside: avoid; text-align: left; white-space: normal; background-image: inherit; background-position: inherit; background-size: inherit; background-repeat: inherit; background-attachment: inherit; background-origin: inherit; background-clip: inherit; background-color: rgb(248, 248, 248); position: relative !important; border: 1px solid rgb(231, 234, 237); border-radius: 3px; padding: 8px 4px 6px; margin-bottom: 15px; margin-top: 15px; width: inherit; color: rgb(51, 51, 51); font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;" lang=""> sudo yum install docker-ce</pre>

20181109092258401.png

最后complete!

(3.2.6)查看docker版本癞己,如圖表示安裝成功:

20181109092415265.png

<pre spellcheck="false" class="md-fences md-end-block ty-contain-cm modeLoaded" cid="n41" mdtype="fences" style="box-sizing: border-box; overflow: visible; font-family: var(--monospace); font-size: 0.9em; display: block; break-inside: avoid; text-align: left; white-space: normal; background-image: inherit; background-position: inherit; background-size: inherit; background-repeat: inherit; background-attachment: inherit; background-origin: inherit; background-clip: inherit; background-color: rgb(248, 248, 248); position: relative !important; border: 1px solid rgb(231, 234, 237); border-radius: 3px; padding: 8px 4px 6px; margin-bottom: 15px; margin-top: 15px; width: inherit; color: rgb(51, 51, 51); font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;" lang=""> docker --version</pre>

(3.2.7)啟動docker:systemctl start docker (有些版本的啟動命令為service docker start)

(3.2.8)設(shè)置docker開機自啟:chkconfig docker on

(3.3)安裝Docker-Compose(離線安裝)

(3.3.1)若是在線安裝docker-compose需要先安裝curl膀斋,離線安裝雖然這里用不到,但也可以安裝一下痹雅,以后會有用,命令:

<pre spellcheck="false" class="md-fences md-end-block ty-contain-cm modeLoaded" cid="n46" mdtype="fences" style="box-sizing: border-box; overflow: visible; font-family: var(--monospace); font-size: 0.9em; display: block; break-inside: avoid; text-align: left; white-space: normal; background-image: inherit; background-position: inherit; background-size: inherit; background-repeat: inherit; background-attachment: inherit; background-origin: inherit; background-clip: inherit; background-color: rgb(248, 248, 248); position: relative !important; border: 1px solid rgb(231, 234, 237); border-radius: 3px; padding: 8px 4px 6px; margin-bottom: 15px; margin-top: 15px; width: inherit; color: rgb(51, 51, 51); font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;" lang=""> yum install curl</pre>

(3.3.2)下載最新版的docker-compose-Linux-x86_64糊识,下載地址為https://github.com/docker/compose/releases绩社。下載完后上傳至/tmp/docker/docker-compose文件夾下,若無此文件夾赂苗,創(chuàng)建即可愉耙。

(3.3.3)進(jìn)入文件所在目錄:cd /tmp/docker/docker-compose

(3.3.4)將其移動至/usr/local/bin安裝目錄:mv docker-compose-Linux-x86_64 /usr/local/bin/docker-compose

(3.3.5)賦予可執(zhí)行權(quán)限:chmod +x /usr/local/bin/docker-compose

(3.3.6)查看版本信息:docker-compose --version

20181109101112115.png

如圖表示安裝成功。

注意:若安裝不成功拌滋,嘗試一下以下命令:cp /usr/local/bin/docker-compose /usr/bin

4朴沿、安裝Go語言環(huán)境

(4.1)下載go語言包:https://studygolang.com/dl

(4.2)將下載的語言包go1.11.linux-amd64.tar.gz上傳至文件夾/tmp/docker

(4.3)進(jìn)入/tmp/docker:cd /tmp/docker

(4.4)解壓至/usr/local目錄下:tar -C /usr/local -zxvf go1.11.linux-amd64.tar.gz

(4.5)配置go語言環(huán)境變量,參照配置jdk環(huán)境變量败砂,在/etc/profile文件后加以下內(nèi)容(別忘了使文件生效):

go環(huán)境變量 export PATH=$PATH:/usr/local/go/bin export GOPATH=/opt/gopath

(4.6)查看go版本:go version

20181109103402262.png

至此赌渣,hyperledger fabric所需的基本環(huán)境即整理完成。

?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者
  • 序言:七十年代末昌犹,一起剝皮案震驚了整個濱河市坚芜,隨后出現(xiàn)的幾起案子,更是在濱河造成了極大的恐慌斜姥,老刑警劉巖鸿竖,帶你破解...
    沈念sama閱讀 207,113評論 6 481
  • 序言:濱河連續(xù)發(fā)生了三起死亡事件沧竟,死亡現(xiàn)場離奇詭異,居然都是意外死亡缚忧,警方通過查閱死者的電腦和手機悟泵,發(fā)現(xiàn)死者居然都...
    沈念sama閱讀 88,644評論 2 381
  • 文/潘曉璐 我一進(jìn)店門脐彩,熙熙樓的掌柜王于貴愁眉苦臉地迎上來日矫,“玉大人浦辨,你說我怎么就攤上這事茵休〈剐唬” “怎么了苇经?”我有些...
    開封第一講書人閱讀 153,340評論 0 344
  • 文/不壞的土叔 我叫張陵理卑,是天一觀的道長大年。 經(jīng)常有香客問我芜果,道長鞠呈,這世上最難降的妖魔是什么? 我笑而不...
    開封第一講書人閱讀 55,449評論 1 279
  • 正文 為了忘掉前任右钾,我火速辦了婚禮蚁吝,結(jié)果婚禮上,老公的妹妹穿的比我還像新娘舀射。我一直安慰自己窘茁,他們只是感情好,可當(dāng)我...
    茶點故事閱讀 64,445評論 5 374
  • 文/花漫 我一把揭開白布脆烟。 她就那樣靜靜地躺著山林,像睡著了一般。 火紅的嫁衣襯著肌膚如雪邢羔。 梳的紋絲不亂的頭發(fā)上驼抹,一...
    開封第一講書人閱讀 49,166評論 1 284
  • 那天,我揣著相機與錄音拜鹤,去河邊找鬼框冀。 笑死,一個胖子當(dāng)著我的面吹牛敏簿,可吹牛的內(nèi)容都是我干的明也。 我是一名探鬼主播,決...
    沈念sama閱讀 38,442評論 3 401
  • 文/蒼蘭香墨 我猛地睜開眼惯裕,長吁一口氣:“原來是場噩夢啊……” “哼温数!你這毒婦竟也來了?” 一聲冷哼從身側(cè)響起轻猖,我...
    開封第一講書人閱讀 37,105評論 0 261
  • 序言:老撾萬榮一對情侶失蹤帆吻,失蹤者是張志新(化名)和其女友劉穎,沒想到半個月后咙边,有當(dāng)?shù)厝嗽跇淞掷锇l(fā)現(xiàn)了一具尸體猜煮,經(jīng)...
    沈念sama閱讀 43,601評論 1 300
  • 正文 獨居荒郊野嶺守林人離奇死亡次员,尸身上長有42處帶血的膿包…… 初始之章·張勛 以下內(nèi)容為張勛視角 年9月15日...
    茶點故事閱讀 36,066評論 2 325
  • 正文 我和宋清朗相戀三年,在試婚紗的時候發(fā)現(xiàn)自己被綠了王带。 大學(xué)時的朋友給我發(fā)了我未婚夫和他白月光在一起吃飯的照片淑蔚。...
    茶點故事閱讀 38,161評論 1 334
  • 序言:一個原本活蹦亂跳的男人離奇死亡,死狀恐怖愕撰,靈堂內(nèi)的尸體忽然破棺而出刹衫,到底是詐尸還是另有隱情,我是刑警寧澤搞挣,帶...
    沈念sama閱讀 33,792評論 4 323
  • 正文 年R本政府宣布带迟,位于F島的核電站,受9級特大地震影響囱桨,放射性物質(zhì)發(fā)生泄漏仓犬。R本人自食惡果不足惜,卻給世界環(huán)境...
    茶點故事閱讀 39,351評論 3 307
  • 文/蒙蒙 一舍肠、第九天 我趴在偏房一處隱蔽的房頂上張望搀继。 院中可真熱鬧,春花似錦翠语、人聲如沸叽躯。這莊子的主人今日做“春日...
    開封第一講書人閱讀 30,352評論 0 19
  • 文/蒼蘭香墨 我抬頭看了看天上的太陽点骑。三九已至,卻和暖如春们童,著一層夾襖步出監(jiān)牢的瞬間畔况,已是汗流浹背。 一陣腳步聲響...
    開封第一講書人閱讀 31,584評論 1 261
  • 我被黑心中介騙來泰國打工慧库, 沒想到剛下飛機就差點兒被人妖公主榨干…… 1. 我叫王不留,地道東北人馋嗜。 一個月前我還...
    沈念sama閱讀 45,618評論 2 355
  • 正文 我出身青樓齐板,卻偏偏與公主長得像,于是被迫代替她去往敵國和親葛菇。 傳聞我的和親對象是個殘疾皇子甘磨,可洞房花燭夜當(dāng)晚...
    茶點故事閱讀 42,916評論 2 344

推薦閱讀更多精彩內(nèi)容