linux下编译geth源码

以太坊有两个主要的客户端软件 Geth和Parity
Go Ethereum is one of the three original implementations (along with C++ and Python) of the Ethereum protocol. It is written in Go, fully open source and licensed under the GNU LGPL v3.
geth官网:https://geth.ethereum.org
parity官网:https://www.parity.io/

1.安装go环境

$ curl -O https://storage.googleapis.com/golang/go1.9.linux-amd64.tar.gz  
$ tar -C /usr/local -zxvf go1.9.linux-amd64.tar.gz  
$ mkdir -p ~/go/src  
$ echo "export GOPATH=$HOME/go" >> ~/.bashrc  
$ echo "export PATH=$PATH:$GOPATH/bin:/usr/local/go/bin" >> ~/.bashrc  
$ source ~/.bashrc  
$ go version

2.Go和C的编译器

Ethereum Go是使用Go语言开发的,需要Go和C的编译器

$ sudo apt-get install -y build-essential golang
注:centos下使用下面命令
$ yum apt-get install -y build-essential golang

3.下载源码

$ git clone https://github.com/ethereum/go-ethereum
或下载压缩包软后解压
$ tar -xzf go-ethereum-1.8.3.tar.gz

4.编译

$ cd go-ethereum
$ make geth

make会执行build目录下的编译脚本,编译脚本会调用go语言编译器进行编译。等待十几秒,编译就完成了,此时会在?go-ethereum-1.8.3/build/bin?中生成geth可执行文件。

5.测试编译后的geth

输入?geth help?命令,会显示geth所有的命令和选项:

$ cd build/bin
$ ./geth help

你可能感兴趣的:(linux下编译geth源码)