首页 > 其他分享 >IPFS安装笔记

IPFS安装笔记

时间:2022-10-17 11:03:19浏览次数:80  
标签:IPFS 0.0 ipfs 笔记 tcp ip4 go root 安装

IPFS安装笔记

1.创建ipfs目录,并进入目录中

cd /home
mkdir ipfs 
cd ipfs/

2. 下载go-ipfs_v0.6.0_linux-amd64.tar.gz

进入https://github.com/ipfs/go-ipfs/releases下载相应的版本

http://139.159.188.90:8080/s/x2cieDBAqoHXgqJ

3. 解压

tar -xzvf go-ipfs_v0.6.0_linux-amd64.tar.gz

-x:解开压缩文件

-z:用Gzip压缩或解压

-v:显示压缩或解压的过程

-f:目标文件名

4. 查看当前目录

5. 安装

./install.sh

sudo bash install.sh

出现:

6. 查看是否安装成功

看到以上提示,不要理睬,ipfs help查看是否安装成功,再查看ipfs版本

7. 使用ipfs

(1)初始化ipfs

[root@localhost go-ipfs]# ipfs init
initializing IPFS node at /root/.ipfs
generating 2048-bit RSA keypair…done
peer identity: QmSrzE3Ry4t8craUHNuv78ib4ovTTQ3xdMbtPwCy75iPz7
to get started, enter:

ipfs cat /ipfs/QmQPeNsJPyVWPFDVHb77w8G42Fvo15z4bG2X8D2GhfbSXc/readme

[root@localhost ~]# ipfs cat /ipfs/QmQPeNsJPyVWPFDVHb77w8G42Fvo15z4bG2X8D2GhfbSXc/readme
Hello and Welcome to IPFS!

██╗██████╗    ███████╗███████╗
██║██╔══██╗██╔════╝ ██╔════╝
██║██████╔╝█████╗      ███████╗
██║██╔═══╝   ██╔══╝    ╚════██║
██║██║             ██║            ███████║
╚═╝╚═╝             ╚═╝           ╚══════╝

If you’re seeing this, you have successfully installed
IPFS and are now interfacing with the ipfs merkledag!

——————————————————-
| Warning: |
| This is alpha software. Use at your own discretion! |
| Much is missing or lacking polish. There are bugs. |
| Not yet secure. Read the security notes for more. |
——————————————————-

Check out some of the other files in this directory:
./about
./help
./quick-start <– usage examples
./readme <– this file
./security-notes

QmSrzE3Ry4t8craUHNuv78ib4ovTTQ3xdMbtPwCy75iPz7为该结点ID,也可通过命令查看:ipfs id

[root@localhost go-ipfs]# ipfs id
{
“ID”: “QmSrzE3Ry4t8craUHNuv78ib4ovTTQ3xdMbtPwCy75iPz7”,
“PublicKey”: “CAASpgIwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCso3EZfeELK9NE5yQP/VxV8o3BzeYewCM+DOa2ZvOX0WyT/ZtrMpDSQXMRotADANdGDqqUe0tnqjcXh/X+Esf1h6PE0QOXpP3aukdr2OdZFh3b7rlIbIilUmlNMJ6WTmcd9TtsFHuEF8QgXg3pVSeb5LRpxGU2ZQPIMXg7CN8fMrE6j4TH1Jc2lIZKlyOGIN/408hCy3+1vn+a7BVSxJzQi/0fTKV8tNiGNJt/ewfTaDel6X7RRCJpm/I3njphfThjdehyewbpDy8uBppDTEDCpS695z0NCty1vNji+vkk3956n1/EyPVBb9LodEEiTYWMfLGcowRU6djiB36FA9yTAgMBAAE=”,
“Addresses”: null,
“AgentVersion”: “go-ipfs/0.6.0/”,
“ProtocolVersion”: “ipfs/0.1.0”
}

(2)查看配置

ipfs config show

(3)修改配置

[root@localhost go-ipfs]# ipfs config edit
Error: ENV variable $EDITOR not set

此时,需要为ipfs指定编辑器,本人指定vi

[root@bigdata1 go-ipfs]# export EDITOR=vi
[root@bigdata1 go-ipfs]# export EDITOR=/usr/bin/vim
[root@bigdata1 go-ipfs]# ipfs config edit

{
“Identity”: {
“PeerID”: “QmSrwirNYh8MEH4XsN5zNS5yepuSbRkswqrs6vQSmwhpxV”,
“PrivKey”: “CAASqAkwggSkAgEAAoIBAQDKYsH0fYoeVGgpFeRjMV0CxqPOpu3trvH1y9/sGHgrq89zWjfO9RH5Ev95Xq4vPTTjwaUzBMtwztomq/17QDQPCBO7ssiGm+z9ZitIsKUubkC2cJhHzgfWhLhjm/zx9hAjzU7EUt6TpsYM0UB3t+gdn6ikvZJSSLhFyJ4eutAXaE/gvET3serS5qjLovvaoLLkg/WKRX3bUn
R8badlbj37NpwNPNqQi4K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kM+x3cE1Tz1GCgLleik6YrRDuSRU0VBb/sSN79zRRemzl8Nq76p30JArXHtEQsRXQE/1zESCktK3wf3KjTDLIAiVyslWWrAoGBAM67pS1B90vqGME6WvLi1NkSOTFDcB/rYk13uMYpp+qg0Tf+udG3ja23hYTjKcSlKY4cOENZyrbXHSjqP/msLEYsAuy0Jo0XxjihBlY/wWJWhiAy0nljjWb7QxnGnJDY9a+V9S1hEUEYB4dDDACK9bVob2Xf3h1hbv/BeZXQgRij”
},

修改配置:

[root@bigdata1 go-ipfs]# ipfs config Addresses.API /ip4/0.0.0.0/tcp/5001
[root@bigdata1 go-ipfs]# ipfs config Addresses.Gateway /ip4/0.0.0.0/tcp/8080

8. 创建一个hello.txt文件,并添加该文件

[root@bigdata1 go-ipfs]# ipfs add hello.txt
added QmTLQVM77LytzM2NtJEHfgJVZDMmc74EreyehDAjfSbLaN hello.txt
19 B / 19 B [=============================================] 100.00%

9. 查看文件内容

[root@bigdata1 go-ipfs]# ipfs cat QmTLQVM77LytzM2NtJEHfgJVZDMmc74EreyehDAjfSbLaN
ipfs add hello.txt

10. 上传文件到网络

[root@bigdata1 go-ipfs]# ipfs daemon
Initializing daemon…
go-ipfs version: 0.6.0
Repo version: 10
System version: amd64/linux
Golang version: go1.14.4
Swarm listening on /ip4/127.0.0.1/tcp/4001
Swarm listening on /ip4/127.0.0.1/udp/4001/quic
Swarm listening on /ip4/192.168.85.101/tcp/4001
Swarm listening on /ip4/192.168.85.101/udp/4001/quic
Swarm listening on /ip6/::1/tcp/4001
Swarm listening on /ip6/::1/udp/4001/quic
Swarm listening on /p2p-circuit
Swarm announcing /ip4/127.0.0.1/tcp/4001
Swarm announcing /ip4/127.0.0.1/udp/4001/quic
Swarm announcing /ip4/192.168.85.101/tcp/4001
Swarm announcing /ip4/192.168.85.101/udp/4001/quic
Swarm announcing /ip6/::1/tcp/4001
Swarm announcing /ip6/::1/udp/4001/quic
API server listening on /ip4/0.0.0.0/tcp/5001
WebUI: http://0.0.0.0:5001/webui
Gateway (readonly) server listening on /ip4/0.0.0.0/tcp/8080
Daemon is ready

 

 

 

 

[root@bigdata1 go-ipfs]# ipfs config –json API.HTTPHeaders.Access-Control-Allow-Origin ‘[“http://192.168.85.101:5001”, “http://127.0.0.1:5001”, “https://webui.ipfs.io”]’
[root@bigdata1 go-ipfs]# ipfs config –json API.HTTPHeaders.Access-Control-Allow-Methods ‘[“PUT”, “POST”]’
[root@bigdata1 go-ipfs]# ipfs daemon

注意:其中 Gateway (readonly) server listening on /ip4/127.0.0.1/tcp/8080 网关地址配置为127.0.0.1,只能本地访问,如果想远程访问,需要将其修改为0.0.0.0,修改方法,运行命令:

ipfs config edit

同时也可以修改8080端口。

“Addresses”: {
“Swarm”: [
“/ip4/0.0.0.0/tcp/4001”,
“/ip6/::/tcp/4001”
],
“Announce”: [],
“NoAnnounce”: [],
“API”: “/ip4/0.0.0.0/tcp/5001”,
“Gateway”: “/ip4/0.0.0.0/tcp/8080”
},

 

参考资料:

1、https://github.com/ipfs/kubo/releases

2、https://www.jianshu.com/p/d555f785ac10

标签:IPFS,0.0,ipfs,笔记,tcp,ip4,go,root,安装
From: https://www.cnblogs.com/Horsonce/p/16798425.html

相关文章

  • Docker安装个人博客
    我的个人博客第一步:准备镜像dockerpullwordpressdockerpullmysqldockerimages|egrep‘wordpress|mysql’第二步:创建mysql容器[root@fabric/]#mkdir/data[......
  • Docker安装笔记
    Docker安装笔记1.卸载旧版本sudoyumremovedocker\        docker-client\        docker-client-latest\    ......
  • Google已将”XXX”标记为恶意扩展程序并已阻止系统安装它
    在Chrome浏览器中安装扩展程序时报错;Google已将”XXX”标记为恶意扩展程序并已阻止系统安装它 解决方法:1)将下载的扩展插件文件 *.crx,文件名crx后缀改为zip2)并用RA......
  • Xshell安装
    xshell破解版链接:https://pan.baidu.com/s/15A6gimNYPiSzROBjNBzImw提取码:xxk8 软件介绍Xshell6是由国外NetSarang公司开发的一款功能强大、并且非常出色......
  • 树莓派docker安装homeassistant container
    树莓派docker安装homeassistantcontainer1.docker1.1.docker安装#更新一下软件sudoaptupdate-ysudoaptupgrade-y#下载Docker安装脚本sudocurl-fsSLhtt......
  • skyler实战渗透笔记(十一)—Kioptrix-1
    skyler实战渗透笔记:笔记是为了记录实战渗透学习过程,分享渗透过程思路与方法。请注意:对于所有笔记中复现的终端或服务器,都是自行搭建环境或已获授权渗透的。使用的技术仅......
  • python安装与python、pip的环境变量配置
    进入官网在你常用的搜索引擎中输入python官网然后进入。可直接点击本链接python官网进入;也可在浏览器地址栏输入www.python.org回车进入官网。下载将鼠标放到菜......
  • docker安装tomcat、mysql、redis
    一、tomcat1.下载tomcat8dockerpulltomcat:8.5.612.启动容器(-d后台启动)dockerrun-d-p8080:8080tomcat:8.5.61 3.访问首页http://ip:8080/访问不到......
  • 计算机视觉笔记
    计算机视觉笔记:内容包含深度学习、图像处理、图像特征、图像分类、目标检测、图像分割等基础知识。Tensorflow:深度学习开源框架,封装了大量深度学习函数。tensorflow系统......
  • mysql安装教程-window操作系统
    1、下载安装包(官网下载)直达链接:https://dev.mysql.com/downloads/mysql/       下载后放到指定目录下解压即可(给电脑新手忠告:注意不要放在C盘,养成好习惯......