一、安装配置Go环境
IPFS是基于GO语言的项目,环境要求go version 1.12+
安装过程及环境变量配置参考:https://blog.csdn.net/weixin_42310458/article/details/98610050
二、更新apt-get 并安装 git
在terminal执行以下语句
sudo apt-get update
sudo apt-get install git
三、下载go-ipfs源码
go get -u github.com/ipfs/go-ipfs
四、切换到下载目录下
go get 下载路径为Go语言配置的PATH变量的位置,这里位置为:
$GOPATH/src/github.com/ipfs/go-ipf
直接进行编译安装是无法通过的,因为国内无法从 golang.org 获取相关的依赖包
因此要对依赖包进行 rediret,指向GitHub上的镜像文件
修改 go.mod 文件,在最后加入以下语句:
replace (
bazil.org/fuse => github.com/bazil/fuse v0.0.0-20180421153158-65cc252bf669
cloud.google.com/go => github.com/googleapis/google-cloud-go v0.26.0
go.uber.org/atomic => github.com/uber-go/atomic v1.4.0
go.uber.org/goleak => github.com/uber-go/goleak v0.10.0
go.uber.org/multierr => github.com/uber-go/multierr v1.1.0
golang.org/x/build => github.com/golang/build v0.0.0-20190416225751-b5f252a0a7dd
golang.org/x/crypto => github.com/golang/crypto v0.0.0-20190411191339-88737f569e3a
golang.org/x/exp => github.com/golang/exp v0.0.0-20190413192849-7f338f571082
golang.org/x/image => github.com/golang/image v0.0.0-20190417020941-4e30a6eb7d9a
golang.org/x/lint => github.com/golang/lint v0.0.0-20190409202823-959b441ac422
golang.org/x/mobile => github.com/golang/mobile v0.0.0-20190415191353-3e0bab5405d6
golang.org/x/net => github.com/golang/net v0.0.0-20190415214537-1da14a5a36f2
golang.org/x/oauth2 => github.com/golang/oauth2 v0.0.0-20190402181905-9f3314589c9a
golang.org/x/perf => github.com/golang/perf v0.0.0-20190312170614-0655857e383f
golang.org/x/sync => github.com/golang/sync v0.0.0-20190412183630-56d357773e84
golang.org/x/sys => github.com/golang/sys v0.0.0-20190416152802-12500544f89f
golang.org/x/text => github.com/golang/text v0.3.0
golang.org/x/time => github.com/golang/time v0.0.0-20190308202827-9d24e82272b4
golang.org/x/tools => github.com/golang/tools v0.0.0-20190417005754-4ca4b55e2050
golang.org/x/xerrors => github.com/golang/xerrors v0.0.0-20190410155217-1f06c39b4373
google.golang.org/api => github.com/googleapis/google-api-go-client v0.3.2
google.golang.org/appengine => github.com/golang/appengine v1.5.0
google.golang.org/genproto => github.com/google/go-genproto v0.0.0-20190415143225-d1146b9035b9
google.golang.org/grpc => github.com/grpc/grpc-go v1.20.0
)
五、编译安装
make install
遇到问题:
原因:文件夹访问权限问题
解决:sudo chmod 777 /usr/local/go/bin
测试:ipfs version
安装成功!
安装位置为:/home/test/.ipfs
创建桌面快捷方式:ln -s /home/test/.ipfs/ ~/桌面/IPFS
六、IPFS的初始化和连接
初始化IPFS节点:ipfs init
可以看到节点的ID
按提示输入 ipfs cat /ipfs/QmS4ustL54uo8FzR9455qaxZwuMiUhyvMcX9Ba8nUH4uVv/readme
查看已经存储的readme文件
启动守护进程并连接到IPFS网络:ipfs daemon
可以在浏览器中输入:http://127.0.0.1:5001/webui 打开webui界面
参考博客:
https://blog.csdn.net/wufudejob/article/details/80847014