最近在研究区块链技术,首先要从开发环境的搭建搞起,本人用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能够第一时间看到个人分享,也能够直接搜索“程序视野”添加,谢谢支持!