linux虚拟机中安装geth
生活随笔
收集整理的這篇文章主要介紹了
linux虚拟机中安装geth
小編覺(jué)得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.
linux環(huán)境下的geth安裝
git clone git://github.com/ethereum/go-ethereum出現(xiàn)以下信息
正克隆到 'go-ethereum'... remote: Enumerating objects: 101980, done. 接收對(duì)象中: 100% (101980/101980), 169.42 MiB | 108.00 KiB/s, done. remote: Total 101980 (delta 0), reused 0 (delta 0), pack-reused 101980 處理 delta 中: 100% (60878/60878), done.進(jìn)入到go-ethereum下
cd go-ethereum使用dir命令查看包下的東西
accounts COPYING ethstats Makefile rpc appveyor.yml COPYING.LESSER event metrics SECURITY.md AUTHORS core go.mod miner signer build crypto go.sum mobile swarm circle.yml Dockerfile graphql node tests cmd Dockerfile.alltools interfaces.go oss-fuzz.sh trie common docs internal p2p consensus eth les params console ethclient light README.md contracts ethdb log rlp我們直接使用make geth命令進(jìn)行安裝,出現(xiàn)以下的結(jié)果證明安裝成功
build/env.sh go run build/ci.go install ./cmd/geth >>> /usr/lib/golang/bin/go install -ldflags -X main.gitCommit=4bcc0a37ab70cb79b16893556cffdaad6974e7d8 -v ./cmd/geth github.com/ethereum/go-ethereum/vendor/golang.org/x/sys/unix github.com/ethereum/go-ethereum/vendor/github.com/elastic/gosigar github.com/ethereum/go-ethereum/common/math github.com/ethereum/go-ethereum/crypto/secp256k1 github.com/ethereum/go-ethereum/rlp github.com/ethereum/go-ethereum/crypto github.com/ethereum/go-ethereum/vendor/github.com/allegro/bigcache/queue github.com/ethereum/go-ethereum/vendor/github.com/allegro/bigcache github.com/ethereum/go-ethereum/common/prque github.com/ethereum/go-ethereum/vendor/github.com/go-stack/stack github.com/ethereum/go-ethereum/log github.com/ethereum/go-ethereum/metrics github.com/ethereum/go-ethereum/vendor/github.com/syndtr/goleveldb/leveldb/util github.com/ethereum/go-ethereum/vendor/github.com/syndtr/goleveldb/leveldb/cache github.com/ethereum/go-ethereum/vendor/github.com/syndtr/goleveldb/leveldb/comparer github.com/ethereum/go-ethereum/vendor/github.com/syndtr/goleveldb/leveldb/storage github.com/ethereum/go-ethereum/vendor/github.com/syndtr/goleveldb/leveldb/errors github.com/ethereum/go-ethereum/vendor/github.com/syndtr/goleveldb/leveldb/filter github.com/ethereum/go-ethereum/vendor/github.com/syndtr/goleveldb/leveldb/iterator github.com/ethereum/go-ethereum/vendor/github.com/syndtr/goleveldb/leveldb/journal github.com/ethereum/go-ethereum/vendor/github.com/syndtr/goleveldb/leveldb/memdb github.com/ethereum/go-ethereum/vendor/github.com/syndtr/goleveldb/leveldb/opt github.com/ethereum/go-ethereum/vendor/github.com/golang/snappy github.com/ethereum/go-ethereum/vendor/github.com/syndtr/goleveldb/leveldb/table github.com/ethereum/go-ethereum/vendor/github.com/syndtr/goleveldb/leveldb github.com/ethereum/go-ethereum/ethdb github.com/ethereum/go-ethereum/trie github.com/ethereum/go-ethereum/core/types github.com/ethereum/go-ethereum github.com/ethereum/go-ethereum/vendor/github.com/aristanetworks/goarista/monotime github.com/ethereum/go-ethereum/common/mclock github.com/ethereum/go-ethereum/event github.com/ethereum/go-ethereum/accounts github.com/ethereum/go-ethereum/vendor/github.com/deckarep/golang-set github.com/ethereum/go-ethereum/vendor/github.com/pborman/uuid github.com/ethereum/go-ethereum/vendor/github.com/rjeczalik/notify github.com/ethereum/go-ethereum/vendor/golang.org/x/crypto/pbkdf2 github.com/ethereum/go-ethereum/vendor/golang.org/x/crypto/scrypt github.com/ethereum/go-ethereum/accounts/keystore github.com/ethereum/go-ethereum/cmd/internal/browser github.com/ethereum/go-ethereum/common/fdlimit github.com/ethereum/go-ethereum/vendor/github.com/hashicorp/golang-lru/simplelru github.com/ethereum/go-ethereum/vendor/github.com/hashicorp/golang-lru github.com/ethereum/go-ethereum/core/state github.com/ethereum/go-ethereum/p2p/netutil github.com/ethereum/go-ethereum/vendor/golang.org/x/net/context github.com/ethereum/go-ethereum/vendor/github.com/rs/xhandler github.com/ethereum/go-ethereum/vendor/github.com/rs/cors github.com/ethereum/go-ethereum/vendor/golang.org/x/net/websocket github.com/ethereum/go-ethereum/rpc github.com/ethereum/go-ethereum/consensus github.com/ethereum/go-ethereum/consensus/misc github.com/ethereum/go-ethereum/consensus/clique github.com/ethereum/go-ethereum/vendor/github.com/edsrzf/mmap-go github.com/ethereum/go-ethereum/common/bitutil github.com/ethereum/go-ethereum/consensus/ethash github.com/ethereum/go-ethereum/core/rawdb github.com/ethereum/go-ethereum/vendor/golang.org/x/sys/cpu github.com/ethereum/go-ethereum/crypto/bn256/cloudflare github.com/ethereum/go-ethereum/crypto/bn256 github.com/ethereum/go-ethereum/vendor/golang.org/x/crypto/ripemd160 github.com/ethereum/go-ethereum/core/vm github.com/ethereum/go-ethereum/core github.com/ethereum/go-ethereum/crypto/ecies github.com/ethereum/go-ethereum/p2p/enr github.com/ethereum/go-ethereum/p2p/enode github.com/ethereum/go-ethereum/p2p/discover github.com/ethereum/go-ethereum/vendor/github.com/huin/goupnp/httpu github.com/ethereum/go-ethereum/vendor/github.com/huin/goupnp/scpd github.com/ethereum/go-ethereum/vendor/github.com/huin/goupnp/soap github.com/ethereum/go-ethereum/vendor/github.com/huin/goupnp/ssdp github.com/ethereum/go-ethereum/vendor/golang.org/x/net/html/atom github.com/ethereum/go-ethereum/vendor/golang.org/x/net/html github.com/ethereum/go-ethereum/vendor/golang.org/x/text/encoding/internal/identifier github.com/ethereum/go-ethereum/vendor/golang.org/x/text/transform github.com/ethereum/go-ethereum/vendor/golang.org/x/text/encoding github.com/ethereum/go-ethereum/vendor/golang.org/x/text/encoding/internal github.com/ethereum/go-ethereum/vendor/golang.org/x/text/encoding/charmap github.com/ethereum/go-ethereum/vendor/golang.org/x/text/encoding/japanese github.com/ethereum/go-ethereum/vendor/golang.org/x/text/encoding/korean github.com/ethereum/go-ethereum/vendor/golang.org/x/text/encoding/simplifiedchinese github.com/ethereum/go-ethereum/vendor/golang.org/x/text/encoding/traditionalchinese github.com/ethereum/go-ethereum/vendor/golang.org/x/text/internal/utf8internal github.com/ethereum/go-ethereum/vendor/golang.org/x/text/runes github.com/ethereum/go-ethereum/vendor/golang.org/x/text/encoding/unicode github.com/ethereum/go-ethereum/vendor/golang.org/x/text/internal/tag github.com/ethereum/go-ethereum/vendor/golang.org/x/text/language github.com/ethereum/go-ethereum/vendor/golang.org/x/text/encoding/htmlindex github.com/ethereum/go-ethereum/vendor/golang.org/x/net/html/charset github.com/ethereum/go-ethereum/vendor/github.com/huin/goupnp github.com/ethereum/go-ethereum/vendor/github.com/huin/goupnp/dcps/internetgateway1 github.com/ethereum/go-ethereum/vendor/github.com/huin/goupnp/dcps/internetgateway2 github.com/ethereum/go-ethereum/vendor/github.com/jackpal/go-nat-pmp github.com/ethereum/go-ethereum/p2p/nat github.com/ethereum/go-ethereum/p2p/discv5 github.com/ethereum/go-ethereum/p2p github.com/ethereum/go-ethereum/vendor/github.com/mohae/deepcopy github.com/ethereum/go-ethereum/dashboard github.com/ethereum/go-ethereum/core/bloombits github.com/ethereum/go-ethereum/eth/downloader github.com/ethereum/go-ethereum/eth/fetcher github.com/ethereum/go-ethereum/eth/filters github.com/ethereum/go-ethereum/vendor/github.com/davecgh/go-spew/spew github.com/ethereum/go-ethereum/internal/ethapi github.com/ethereum/go-ethereum/eth/gasprice github.com/ethereum/go-ethereum/eth/tracers/internal/tracers github.com/ethereum/go-ethereum/vendor/gopkg.in/olebedev/go-duktape.v3 github.com/ethereum/go-ethereum/eth/tracers github.com/ethereum/go-ethereum/miner github.com/ethereum/go-ethereum/vendor/github.com/golang/protobuf/proto github.com/ethereum/go-ethereum/vendor/github.com/golang/protobuf/protoc-gen-go/descriptor github.com/ethereum/go-ethereum/accounts/usbwallet/internal/trezor github.com/ethereum/go-ethereum/vendor/github.com/karalabe/hid github.com/ethereum/go-ethereum/accounts/usbwallet github.com/ethereum/go-ethereum/metrics/exp github.com/ethereum/go-ethereum/vendor/github.com/fjl/memsize github.com/ethereum/go-ethereum/vendor/github.com/fjl/memsize/memsizeui github.com/ethereum/go-ethereum/vendor/github.com/mattn/go-isatty github.com/ethereum/go-ethereum/vendor/github.com/mattn/go-colorable github.com/ethereum/go-ethereum/vendor/gopkg.in/urfave/cli.v1 github.com/ethereum/go-ethereum/internal/debug github.com/ethereum/go-ethereum/vendor/github.com/prometheus/prometheus/util/flock github.com/ethereum/go-ethereum/node github.com/ethereum/go-ethereum/eth github.com/ethereum/go-ethereum/les/flowcontrol github.com/ethereum/go-ethereum/light github.com/ethereum/go-ethereum/les github.com/ethereum/go-ethereum/ethstats github.com/ethereum/go-ethereum/vendor/github.com/influxdata/influxdb/pkg/escape github.com/ethereum/go-ethereum/vendor/github.com/influxdata/influxdb/models github.com/ethereum/go-ethereum/vendor/github.com/influxdata/influxdb/client github.com/ethereum/go-ethereum/metrics/influxdb github.com/ethereum/go-ethereum/vendor/golang.org/x/sync/syncmap github.com/ethereum/go-ethereum/whisper/whisperv6 github.com/ethereum/go-ethereum/cmd/utils github.com/ethereum/go-ethereum/internal/jsre/deps github.com/ethereum/go-ethereum/vendor/github.com/fatih/color github.com/ethereum/go-ethereum/vendor/gopkg.in/sourcemap.v1/base64vlq github.com/ethereum/go-ethereum/vendor/gopkg.in/sourcemap.v1 github.com/ethereum/go-ethereum/vendor/github.com/robertkrimen/otto/file github.com/ethereum/go-ethereum/vendor/github.com/robertkrimen/otto/token github.com/ethereum/go-ethereum/vendor/github.com/robertkrimen/otto/ast github.com/ethereum/go-ethereum/vendor/github.com/robertkrimen/otto/dbg github.com/ethereum/go-ethereum/vendor/github.com/robertkrimen/otto/parser github.com/ethereum/go-ethereum/vendor/github.com/robertkrimen/otto/registry github.com/ethereum/go-ethereum/vendor/github.com/robertkrimen/otto github.com/ethereum/go-ethereum/internal/jsre github.com/ethereum/go-ethereum/internal/web3ext github.com/ethereum/go-ethereum/vendor/github.com/peterh/liner github.com/ethereum/go-ethereum/console github.com/ethereum/go-ethereum/ethclient github.com/ethereum/go-ethereum/vendor/github.com/maruel/panicparse/stack github.com/ethereum/go-ethereum/vendor/github.com/mattn/go-runewidth github.com/ethereum/go-ethereum/vendor/github.com/mitchellh/go-wordwrap github.com/ethereum/go-ethereum/vendor/github.com/nsf/termbox-go github.com/ethereum/go-ethereum/vendor/github.com/gizak/termui github.com/ethereum/go-ethereum/vendor/github.com/naoina/go-stringutil github.com/ethereum/go-ethereum/vendor/github.com/naoina/toml/ast github.com/ethereum/go-ethereum/vendor/github.com/naoina/toml github.com/ethereum/go-ethereum/cmd/geth Done building. Run "/root/go-ethereum/build/bin/geth" to launch geth.接下來(lái)配置一下環(huán)境,我們需要在配置文件中將環(huán)境配置進(jìn)去,否則每次我們重新打開(kāi)終端時(shí)都需要配置,首先我們?cè)诮K端輸入vim /etc/profile,出現(xiàn)下面的界面:
/etc/profile# System wide environment and startup programs, for login setup # Functions and aliases go in /etc/bashrc# It's NOT a good idea to change this file unless you know what you # are doing. It's much better to create a custom.sh shell script in # /etc/profile.d/ to make custom changes to your environment, as this # will prevent the need for merging in future updates.pathmunge () {case ":${PATH}:" in*:"$1":*);;*)if [ "$2" = "after" ] ; thenPATH=$PATH:$1elsePATH=$1:$PATHfiesac } if [ -x /usr/bin/id ]; thenif [ -z "$EUID" ]; then# ksh workaroundEUID=`/usr/bin/id -u`UID=`/usr/bin/id -ru`fiUSER="`/usr/bin/id -un`"LOGNAME=$USERMAIL="/var/spool/mail/$USER" fi# Path manipulation if [ "$EUID" = "0" ]; thenpathmunge /usr/sbinpathmunge /usr/local/sbin elsepathmunge /usr/local/sbin afterpathmunge /usr/sbin after fiHOSTNAME=`/usr/bin/hostname 2>/dev/null` HISTSIZE=1000 elseexport HISTCONTROL=ignoredups fiexport PATH USER LOGNAME MAIL HOSTNAME HISTSIZE HISTCONTROL# By default, we want umask to get set. This sets it for login shell # Current threshold for system reserved uid/gids is 200 # You could check uidgid reservation validity in # /usr/share/doc/setup-*/uidgid file if [ $UID -gt 199 ] && [ "`/usr/bin/id -gn`" = "`/usr/bin/id -un`" ]; thenumask 002 elseumask 022 fifor i in /etc/profile.d/*.sh /etc/profile.d/sh.local ; doif [ -r "$i" ]; thenif [ "${-#*i}" != "$-" ]; then. "$i"else. "$i" >/dev/nullfifi doneunset i unset -f pathmunge export GOROOT=/go/work/go export GOPATT=/go/work/gopath export PATH=$PATH:$GOROOT/bin:$GOPATH/bin此時(shí)我們需要在配置的最后一行加入下面的配置信息
export PATH=$PATH:/root/go-ethereum/build/bin配置完了之后使用source /etc/profile命令使配置立即生效
這時(shí)候我們就可以查看下geth是否安裝成功了
geth version出現(xiàn)下面的結(jié)果則是證明安裝成功
Geth Version: 1.8.27-stable Git Commit: 4bcc0a37ab70cb79b16893556cffdaad6974e7d8 Architecture: amd64 Protocol Versions: [63 62] Network Id: 1 Go Version: go1.15.14 Operating System: linux GOPATH= GOROOT=/usr/lib/golang總結(jié)
以上是生活随笔為你收集整理的linux虚拟机中安装geth的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問(wèn)題。
- 上一篇: 【个推】后端java开发
- 下一篇: uniapp使用悬浮窗组件添加点击事件的