以太坊测试环境搭建

在部署以太坊之前需要安装go 

go安装

     安装 

       我的操作系统是debian,使用apt-get install golang命令安装go工具,由于go代码需要保存在workspace,所有可以在home目录下创建一个workspace,该目录将被go工具用于保存和编辑二进制,命令如下;

      mkdir ~/workspace
      echo 'export GOPATH="$HOME/workspace"' >> ~/.bashrc
      source ~/.bashrc
      安装工具包 
     根据不同的需要,我们可以使用 apt-get 安装 Go tools:
     apt-cache search golang

     go升级

      有时候历史安装的go版本过低,无法支持geth的安装,可以对go进行升级,升级方式如下:

       下载最新的go源码包 go1.9.2.linux-amd64.tar.gz
       tar -zxf go1.9.2.linux-amd64.tar.gz
       cd go/src 目录
      执行 ./all.bash

geth安装

        配置环境变量
       vi .bashrc
       增加
       export GOROOT_BOOTSTRAP=/root/go    # go安装目录
       export GOROOT=/root/go    #go安装目录
       source .bashrc
        安装go-ethereum
       git clone  https://github.com/ethereum/go-ethereum.git    #获取源码
       cd go-ethereum                 
       git checkout v1.7.2                             #升级版本
       make geth                                          #编译
       make all                                              #安装
       我的geth安装目录是  /root/ethereum/go-ethereum/build/bin/geth
       ln -s /root/ethereum/go-ethereum/build/bin/geth /usr/bin/geth
       通过 geth version 查看版本。

你可能感兴趣的:(以太坊)