LoginSignup
1
2

More than 5 years have passed since last update.

CentOSにGethをインストールする際の注意点

Last updated at Posted at 2018-04-26

Geth(go-ethereum)のインストールは各OSごとに
・Windowsの場合:ここから「.exeファイル」をインストール
・macの場合:「Homebrew」を利用してインストール
・Ubuntu(Debian系Linux)の場合:「apt-get」を利用してインストール
上記の方法で比較的簡単にインストールが可能ですが、CentOS(RedHat系Linux)の場合は「yum」がGethに対応しておらずソースコードからコンパイルする必要があり、また、依存関係やミドルウェアのバージョンが対応外等の問題があり、なかなか大変だったのではないのでしょうか?

そこで、新規にインストールしたCentOSにGethをインストールする際に起こりうる注意点やエラーを纏めてみました。

基本的方針は
〇〇がインストールされてなければyumを利用(remi epel等のリポジトリを適用)してインストール、
・yumでインストールされたミドルウェアのバージョンが古い場合は、ソースからコンパイル

になります。

システム要件(20180426現在の最新版):
・CentOS 最新版:7.4-1708
・Geth 最新版:1.8.6
・Go言語 最新版:1.10.1(Gethのインストールには1.9以上が必要)
・Git 最新版:2.17.0(Gethのインストールには2.0以上が必要)

・空き容量:約1.5GB必要

参考:epelリポジトリ及びremiリポジトリのインストール

yumをアップデート
# yum update

epelリポジトリのインストール
# yum install epel-release

remiリポジトリのインストール
# rpm -ivh http://rpms.famillecollet.com/enterprise/remi-release-7.rpm /

Gethのインストール方法

Gethをインストールする前にGo言語をインストール
# yum install golang

Gethのインストール
# git clone https://github.com/ethereum/go-ethereum
# cd go-ethereum
# make geth
# cp build/bin/geth /usr/local/bin

起こりうるエラー一覧

1. gethのインストール時

# git clone https://github.com/ethereum/go-ethereum 
の実行時:

エラーメッセージ:
bash: git: command not found

エラー内容:
gitがインストールされていない

対応方法:
gitをインストール
# yum install git
エラーメッセージ:
gmp: command not found

エラー内容:
gmpがインストールされていない

対応方法:
gmpをインストール
# yum install gmp-devel

# make geth
の実行時:

エラーメッセージ:
make: command not found

エラー内容:
makeがインストールされていない

対応方法:
makeをインストール
# yum install make
エラーメッセージ:
build/env.sh go run build/ci.go install ./cmd/geth
ci.go:190: You have Go version go1.8.*
ci.go:191: go-ethereum requires at least Go version 1.9 and cannot
ci.go:192: be compiled with an earlier version. Please upgrade your Go installation.

エラー内容:
(yumでインストールされる)Goバージョンが古い
Goのソースコードをダウンロードして展開する
下記URL参照:
https://tecadmin.net/install-go-on-centos/

対応方法:
下記URLから最新版のGoソースコードを確認
(20180427時点では「go1.10.1.linux-amd64.tar.gz」が最新版)
https://golang.org/dl/
yumでインストールしたGoを一旦削除
# yum remove golang
Goのソースコードをダウンロードして展開する
# wget https://dl.google.com/go/{最新版のGoソースコード.tar.gz}
# tar -xzf {最新版のGoソースコード.tar.gz}
# mv go /usr/local
# export GOROOT=/usr/local/go
# export GOPATH=$HOME/{ホームディレクトリ配下のワークディレクトリ}
# export PATH=$GOPATH/bin:$GOROOT/bin:$PATH
エラーメッセージ:
No package golang available.

エラー内容:
(yumでGoをインストールする場合)Goがyumに対応していない

対応方法:
上記Goの「ソースコードをダウンロードしてコンパイルする」方法で対応
エラーメッセージ:
build/env.sh go run build/ci.go install ./cmd/geth
util.go:87: git tag -l --points-at HEAD: exit status 129
error: unknown option `points-at'
usage: git tag [-a|-s|-u <key-id>] [-f] [-m <msg>|-F <file>] <tagname> [<head>]
   or: git tag -d <tagname>...
   or: git tag -l [-n[<num>]] [<pattern>]
   or: git tag -v <tagname>...
...

エラー内容:
(yumでインストールされる)Gitバージョンが古い
Gitのソースコードをダウンロードしてコンパイルする
下記URL参照:
https://qiita.com/soeda_jp/items/e9ed5f7d145a15aad496

対応方法:
下記URLから最新版のGitソースコードを確認
(20180427時点では「git-2.17.0.tar.gz」が最新版)
https://mirrors.edge.kernel.org/pub/software/scm/git/
yumでインストールしたGitを一旦削除
# yum remove git
Gitのソースコードをダウンロードしてコンパイルする
# wget https://www.kernel.org/pub/software/scm/git/{最新版のGoソースコード.tar.gz}
# tar vfxz {最新版のGoソースコード.tar.gz}
# cd {最新版のGoソースコードディレクトリ(例:git-2.17.0)}
# make configure
# ./configure --prefix=/usr
# make all
# make install

注:Gitは依存関係が多くmake及びinstall作業で複数のファイルをインストールする必要があります。
具体的な対応方法については
下記URL参照:
(下記の「3. Gitのインストール時」はこのURLからの抜粋になります)
https://qiita.com/soeda_jp/items/e9ed5f7d145a15aad496

2. Goのインストール時

# wget https://dl.google.com/go/{最新版のGoソースコード}
の実行時:

エラーメッセージ:
bash: wget: command not found

エラー内容:
wgetがインストールされていない

対応方法:
wgetをインストール
# yum install wget

3. Gitのインストール時

# wget https://dl.google.com/go/{最新版のGoソースコード}
の実行時のエラー「bash: wget: command not found」は
2. Goのインストール時と同様に「# yum install wget」で対応

# make configure
の実行時:

エラーメッセージ:
/bin/sh: autoconf: command not found

エラー内容:
wgetがインストールされていない

対応方法:
autoconfをインストール
# yum install autoconf

# ./configure --prefix=/usr
の実行時:

エラーメッセージ:
configure: Setting lib to 'lib' (the default)
configure: Will try -pthread then -lpthread to enable POSIX Threads.
configure: CHECKS for site configuration
checking for gcc... no
checking for cc... no
checking for cl.exe... no

エラー内容:
gccがインストールされていない

対応方法:
gccをインストール
# yum install gcc

# make all
の実行時:

エラーメッセージ:
    * new build flags
    CC credential-store.o
In file included from credential-store.c:1:0:
cache.h:40:18: fatal error: zlib.h: No such file or directory
...

エラー内容:
zlibがインストールされていない

対応方法:
zlibをインストール
# yum install zlib-devel
エラーメッセージ:
GITGUI_VERSION = 0.21.GITGUI
    * new locations or Tcl/Tk interpreter
    GEN git-gui
    INDEX lib/
    * tclsh failed; using unoptimized loading
    MSGFMT    po/bg.msg make[1]: *** [po/bg.msg] Error 127
make: *** [all] Error 2

エラー内容:
Tcl/Tkが最適化されていない

対応方法:
Tcl/Tkをインストール
# yum install tcl*.x86_64
エラーメッセージ:
/bin/sh: msgfmt: command not found

エラー内容:
msgfmtがインストールされていない

対応方法:
msgfmtをインストール
# yum install -y gettext-devel
エラーメッセージ:
Can't locate ExtUtils/MakeMaker.pm

エラー内容:
Makefile.PLエラー

対応方法:
perl-ExtUtils-MakeMakerをインストール
# yum install perl-ExtUtils-MakeMaker
1
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
2