zoukankan      html  css  js  c++  java
  • centos 系统 以太坊客户端 geth 安装记录

    <本实验是在 腾讯云服务器 centos 环境 上进行的>

    1. 配置 GO 语言环境

       参考 菜鸟教程 go

    2. 下载 编译 go-ethereum

      git clone https://github.com/ethereum/go-ethereum

      之后进入 go-ethereum 目录下,执行

      make geth

    [root@VM_0_15_centos go-ethereum]# make geth
    env GO111MODULE=on go run build/ci.go install ./cmd/geth
    >>> /usr/local/go/bin/go install -ldflags -X main.gitCommit=8045504abf64a865be4b1dbc780b796a9f5d11cc -X main.gitDate=20200211 -v ./cmd/geth
    github.com/ethereum/go-ethereum/internal/web3ext
    github.com/peterh/liner
    github.com/ethereum/go-ethereum/console
    github.com/naoina/go-stringutil
    github.com/naoina/toml/ast
    github.com/naoina/toml
    github.com/ethereum/go-ethereum/cmd/geth
    Done building.
    Run "./build/bin/geth" to launch geth.

      此时,容易出现 time out 错误。就是需要的包什么的具体也不太清楚,反正就是有东西被墙了。解决办法就是在自己的电脑上为服务器做代理(参考务器代理),服务器通过自己的电脑网络进行上网。自己的电脑实现了可以google,这时服务器通过自己电脑的代理,再次执行 make geth 就不会出现 time out 的问题了。

    3. 配置环境变量

      第二步执行后,出现 Run "./build/bin/geth" to launch geth. 就说明成功了,但是 geth version 的时候会出错,提示没有此命令。 ./build/bin/geth 表示当前目录即相对路径<坑了我一天>

    [root@VM_0_15_centos go-ethereum]# geth version
    -bash: geth: command not found

      我们需要配置环境变量:

      export PATH=$PATH:/root/go-ethereum/build/bin

    4. 安装成功

      geth version  查看 geth 安装版本信息

    [root@VM_0_15_centos ~]# geth version
    Geth
    Version: 1.9.11-unstable
    Git Commit: 5f2002bbcc1ad21818d9b08badea84acac6d0481
    Git Commit Date: 20200212
    Architecture: amd64
    Protocol Versions: [64 63]
    Go Version: go1.13.7
    Operating System: linux
    GOPATH=/root/go
    GOROOT=/usr/local/go

    5. tips

      有时候退出控制终端后再次进入,geth version 的时候会找不到 geth 命令(go一样)。编辑 ~/.bashrc 

      [root@VM_0_15_centos ~]# vi ~/.bashrc  输入以下内容(根据自己的路径)

    #go env
    export GOPATH=$HOME/go
    export GOROOT=/usr/local/go
    export PATH=$PATH:/usr/local/go/bin
    
    # geth env
    export PATH=$PATH:/root/go-ethereum/build/bin

      [root@VM_0_15_centos ~]# source ~/.bashrc

    这样就完成了 geth 客户端的安装! 

    参考 :

    以太坊私有链搭建指南

  • 相关阅读:
    OpenCV4学习笔记(1.0)换一种方式从源码编译、安装 | OpenCV4.3.0以及Contrib | Win10 | CMakeGUI | VS2019 | HTTP代理
    Dapr初体验之服务调用
    Dapr初体验之Hello World
    adb shell input text 中文输入方法
    记一次Mongodb数据库查询之包含所有指定元素的数组或者都在指定元素的数组中 du
    CentOS 7.2 内核3升级到4或者5
    pv
    静态 pv 和动态 pv
    k8s 编写 yaml 文件格式
    把刚升级完成的内核设置成默认启动
  • 原文地址:https://www.cnblogs.com/xsmile/p/12303947.html
Copyright © 2011-2022 走看看