1.下载源码
go get -u -d github.com/ipfs/go-ipfs
2.编译
make install
3.编译过程中运动的问题
设置代理(前提是你的电脑已经通过ss开始了科学sw)
(1)如果提示gx_v0.14.0_linux-amd64.tar.gz和gx-go_v1.9.0_linux-amd64.tar.gz下载不下来,需要设置代理
修改源码go-ipfs下的bin/dist_get文件
将通过curl下载的地方改为
//1080:是你配置在ss的本地端口
try_download "$dl_url" "$dl_output" "curl --socks5-hostname 127.0.0.1:1080 --silent --fail --output '$dl_output' '$dl_url'" && return
(2)继续make install会提示下面的依赖包找不到
gx install --global
[get ] [fetch] QmdxUuburamoF6zF9qjeQC4WYcWGbWuRmdLacMEsW8ioD8 gogo-protobuf
......
[get ] [fetch] QmRBaUEQEeFWywfrZJ64QgsmvcqgLSK3VbvGMR2NM2Edpf go-libp2p
需要设置全局代理
步骤1:下载polipo
sudo apt install polipo
步骤2:
sudo vim /etc/polipo/config
将原来的内容覆盖为以下内容
# This file only needs to list configuration variables that deviate
# from the default values. See /usr/share/doc/polipo/examples/config.sample
# and "polipo -v" for variables you can tweak and further information.
#logSyslog = true
#logFile = /var/log/polipo/polipo.log
# This file only needs to list configuration variables that deviate
# from the default values. See /usr/share/doc/polipo/examples/config.sample
# and "polipo -v" for variables you can tweak and further information.
logSyslog = false
logFile = "/var/log/polipo/polipo.log"
socksParentProxy = "127.0.0.1:1080"
socksProxyType = socks5
chunkHighMark = 50331648
objectHighMark = 16384
serverMaxSlots = 64
serverSlots = 16
serverSlots1 = 32
proxyAddress = "0.0.0.0"
proxyPort = 8123
设置代理
export http_proxy="http://127.0.0.1:8123/"
export https_proxy="http://127.0.0.1:8123/"
重启polipo
/etc/init.d/polipo restart
不要切换终端,直接在这个终端进行make install(代理只是临时的)
这样就发现gx install --global终于可以往下走了
gx install --global
[done] [fetch] 6.98s QmZmmuAXgX73UQmX1jRKjTGmjzq24Jinqkq8vzkBtno4uX go-is-domain
[get ] [fetch] QmdxUuburamoF6zF9qjeQC4WYcWGbWuRmdLacMEsW8ioD8 gogo-protobuf
不过后面又再下,又一直下不下来,不知原因。。。
ERROR: from shell.Get(): Post https://ipfs.io/api/v0/get?arg=QmPJUtEJsm5YLUWhF6imvyCH8KZXRJa9Wup7FDMwTy5Ufz&create=true: dial tcp 31.13.78.66:443: connect: connection timed out
因为编译需要在sudo下执行,而上面设置的代理在sudo下是不生效的,所以sudo make install会因为gopath改变而重新下载依赖包。在编译的时候把/etc/sudoers 里面的
Defaults env_reset
改为
Defaults !env_reset
这样sudo make install不会提示找不到go,也不会提示你的go-ipfs不在gopath目录
网友评论