1.安装go 1.14.4+
略
2.下载、安装ipfs
参考:https://docs.ipfs.io/how-to/command-line-quick-start/#install-ipfs
下载:
wget -c -t 0 --no-check-certificate https://github.com/ipfs/go-ipfs/releases/download/v0.6.0/go-ipfs_v0.6.0_linux-amd64.tar.gz解压:
tar -xvzf go-ipfs_v0.6.0_linux-amd64.tar.gz安装:
./install.sh验证:
ipfs version2.节点初始化
ipfs init ipfs cat /ipfs/QmQPeNsJPyVWPFDVHb77w8G42Fvo15z4bG2X8D2GhfbSXc/readme3.修改默认配置使:该ipfs webui和该ipfs节点网关均可从公网访问
查看默认配置:
修改配置
ipfs config Addresses.API /ip4/0.0.0.0/tcp/5001
ipfs config Addresses.Gateway /ip4/0.0.0.0/tcp/8080
ipfs daemon4.将该ipfs点与ipfs网络连接起来
ipfs daemon &5.访问本ipfs节点的webui
根据红框处提示修改跨域(CORS)设置并重启ipfs daemon
再次查看:
6.文件添加到ipfs并用ipns访问
https://docs.ipfs.io/concepts/ipns/#example-ipns-setup添加logo.ico到ipfs
ipfs add /home/forge/abtworld/src/static/images/logo.ico将logo.ico的hash发布到ipns
ipfs name publish QmdbCuwc7xWKYB4rVewU6tostM8n6NYYYCd1txY4qL2xmB验证peerID的解析
ipfs name resolve QmXoNST9bjKNoUuGs4cGroLdpsW8XtCyNv8rRsuyogFrRo访问logo.ico
本节点ipfs网关:
https://hashnews.k1ic.com/ipfs/QmdDTor6dWzknFJPJuhJgrUYqd56WkFXYAxyxpEY7kUrEb
参考:
使用ipfs完成一个图片上传的案例
https://segmentfault.com/a/1190000016895739
IPFS Doc
https://docs.ipfs.io/how-to/command-line-quick-start/#initialize-the-repository
Running IPFS inside Docker
https://hub.docker.com/r/ipfs/go-ipfs/#running-ipfs-inside-docker
网友评论