最近在研究區塊鏈技術,首先要從開發環境的搭建搞起,本人用docker在Ubuntu16.04下搭建以太坊的開發環境,作一下記錄,但願對後來者有所參考幫助。node
由於我在docker下安裝,因此默認爲管理員權限,接下來的命令都不會加sudo,若是後來者是直接在ubuntu下搭建的話,須要用到管理員權限。python
1.安裝npm和NodeJSlinux
apt-get update //因爲從container hub上pull下來的ubuntu16.04比較單一,須要update一下apt;docker
apt-get install npm //安裝npmshell
apt-get install curl //安裝curl,command line tool and library for transferring data with urls,http 命令行工具,通常linux髮型版本都會自帶,可是docker的鏡像沒有自帶,因此這裏須要安裝;數據庫
curl -sL https://deb.nodesource.com/setup_6.x | -E bash - //讓curl使用地址重定向,此時會查詢https://deb.nodesource.com站點npm
apt-get install -y nodejs //安裝nodejsubuntu
2.用npm安裝solc和solc的命令行工具solc-cli;(solc是以太坊智能合約開發語言solidity的編譯器)bash
npm install -g solc solc-cli --save-dev //安裝solc和socl-cli框架
此步驟後運行solcjs測試是否安裝成功,若是沒有輸出則嘗試從新啓動shell或者從新安裝
3.安裝 software-properties-common
apt-get install software-properties-common //第四步和第六步的add-apt-repository 命令是由python-software-properties 這個工具包提供的
4.安裝solc二進制包
add-apt-repository ppa:ethereum/ethereum
apt-get instal solc
5.安裝testrpc和truffle框架,這兩個均可以直接經過npm安裝
npm install -g ethereumjs-testrpc
npm install -g truffle
安裝完成能夠輸入testrpc測試一下,若是生成十個私鑰和對應的十個私鑰則安裝成功
6.安裝Geth客戶端(go-ethereum)
add-apt-repository -y ppa:ethereum/ethereum
apt-get install ethereum
安裝成功後測試一下效果,輸入geth後,該機器就成爲以太坊的一個p2p節點,會不斷更新本機的以太坊分佈式帳本數據庫。
7.大功告成,小夥伴本就能夠在此平臺上作後續的進一步開發學習了。
8.docker鏡像提供,已經搭建好的docker鏡像爲kfpa/ubuntu16.04已經上傳到公共hub上,後來者能夠直接pull下來作後續操做。
9.支持,你們以爲我寫的文章還不錯能夠關注個人公衆號,kfpandaling能夠第一時間看到個人分享,也能夠直接搜索「程序視野」添加,謝謝支持!