背景:听说IPFS=bittorrent+bitcoin+git+afs,有可能取代http,好像厉害的不行,所以要研究一下。

编译参考:https://github.com/ipfs/go-ipfs  结果各种墙都翻好了,一切基础设施都到位了,还是没编译成功shit(最后还是编过了)。

退而求其次,直接用官方提供的先试验一下吧。

下载地址:https://ipfs.io/docs/install/

1.上传安装

下载相应的版本,我下载的是:go-ipfs_v0.4.14_linux-amd64.tar.gz,上传到服务器,解压。

someone@ipfs:~$ tar -zxvf go-ipfs_v0.4.14_linux-amd64.tar.gz
someone@ipfs:~$ cd go-ipfs/
someone@ipfs:~$ ./install.sh
someone@ipfs:~/package/go-ipfs$ ipfs

显示的结果如下:

USAGE
ipfs - Global p2p merkle-dag filesystem. ipfs [--config=<config> | -c] [--debug=<debug> | -D] [--help=<help>] [-h=<h>] [--local=<local> | -L] [--api=<api>] <command> ... SUBCOMMANDS
BASIC COMMANDS
init Initialize ipfs local configuration
add <path> Add a file to IPFS
cat <ref> Show IPFS object data
get <ref> Download IPFS objects
ls <ref> List links from an object
refs <ref> List hashes of links from an object DATA STRUCTURE COMMANDS
block Interact with raw blocks in the datastore
object Interact with raw dag nodes
files Interact with objects as if they were a unix filesystem
dag Interact with IPLD documents (experimental) ADVANCED COMMANDS
daemon Start a long-running daemon process
mount Mount an IPFS read-only mountpoint
resolve Resolve any type of name
name Publish and resolve IPNS names
key Create and list IPNS name keypairs
dns Resolve DNS links
pin Pin objects to local storage
repo Manipulate the IPFS repository
stats Various operational stats
p2p Libp2p stream mounting
filestore Manage the filestore (experimental) NETWORK COMMANDS
id Show info about IPFS peers
bootstrap Add or remove bootstrap peers
swarm Manage connections to the p2p network
dht Query the DHT for values or peers
ping Measure the latency of a connection
diag Print diagnostics TOOL COMMANDS
config Manage configuration
version Show ipfs version information
update Download and apply go-ipfs updates
commands List all available commands Use 'ipfs <command> --help' to learn more about each command. ipfs uses a repository in the local file system. By default, the repo is
located at ~/.ipfs. To change the repo location, set the $IPFS_PATH
environment variable: export IPFS_PATH=/path/to/ipfsrepo EXIT STATUS The CLI will exit with one of the following values: Successful execution.
Failed executions.

 2. 初始化

someone@ipfs:~$ mkdir -p /ipfs/ /*很明显,根本不用执行这个命令,下面的/ipfs也不是指本地文件系统的/ipfs.*/
someone@ipfs:~$ ipfs init
initializing IPFS node at /home/someone/.ipfs
generating 2048-bit RSA keypair...done
peer identity: QmSuUJKAfxYamzekBT2ePfyypyTXP3DgEsGKPxiedUneGh
to get started, enter: ipfs cat /ipfs/QmS4ustL54uo8FzR9455qaxZwuMiUhyvMcX9Ba8nUH4uVv/readme someone@ipfs:~/.ipfs$ ipfs cat /ipfs/QmS4ustL54uo8FzR9455qaxZwuMiUhyvMcX9Ba8nUH4uVv/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

至此,所有的ipfs的内容都在 ~/.ipfs目录下了

someone@ipfs:~/.ipfs$ ls
api blocks config datastore datastore_spec keystore repo.lock version

 3. 修改配置文件

可以使用如下命令

someone@ipfs:export EDITOR=/usr/bin/vim
someone@ipfs:ipfs config edit

查看节点ID

someone@ipfs:~$ ipfs id
{
"ID": "QmSuUJKAfxYamzekBT2ePfyypyTXP3DgEsGKPxiedUneGh",
"PublicKey": "CAASpgIwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQDBTEUgY8FCDbZeV8+h1XdRivlUVRlVlNmwr0oFP1ceoBnbMXP5IJ9GSXXLVVwl4IPwFBEscMo1wo6NRz3oMDeQWEgi9x5wuEOYvlNUAzVbwFWb77AmW10oZpGz7oo45Fd37/jdU+6JcDKPc4o5sR9pJo8PddP3g7rphF7nHncf3vh4vNeCsu0DylxPh6CGHf6+8c50Vjl9iAwBZ9zES+QYT4kYHF3icX63p2B8B5C+7ZC9ISfD4ZiKTYBHDob/XLQc7g7gdEbGuxmXJE/iFzju2PoEe+Ob1QXCAabWq80F/oxCAdX+wLisgHE6FbeYp5RV7IRi7s3L3xpFnQPukswtAgMBAAE=",
"Addresses": null,
"AgentVersion": "go-ipfs/0.4.14/",
"ProtocolVersion": "ipfs/0.1.0"
}

跨域资源共享CORS配置

someone@ipfs:~$ ipfs config --json API.HTTPHeaders.Access-Control-Allow-Methods '["PUT", "GET", "POST", "OPTIONS"]'
someone@ipfs:~$ ipfs config --json API.HTTPHeaders.Access-Control-Allow-Origin '["*"]'

  

4. 启动服务器

someone@ipfs:~/.ipfs$ ipfs daemon
Initializing daemon...
Successfully raised file descriptor limit to 2048.
Swarm listening on /ip4/127.0.0.1/tcp/4001
Swarm listening on /ip4/192.168.15.129/tcp/4001
Swarm listening on /ip6/::1/tcp/4001
Swarm listening on /p2p-circuit/ipfs/QmSuUJKAfxYamzekBT2ePfyypyTXP3DgEsGKPxiedUneGh
Swarm announcing /ip4/127.0.0.1/tcp/4001
Swarm announcing /ip4/192.168.15.129/tcp/4001
Swarm announcing /ip6/::1/tcp/4001
API server listening on /ip4/127.0.0.1/tcp/5001
Gateway (readonly) server listening on /ip4/127.0.0.1/tcp/8080
Daemon is ready

启动成功后就可以,查看UI界面了:

http://127.0.0.1:5001/webui

结果如下:

5. 编译失败后调试成功

按步骤编译,墙也是翻好的,每次都卡在类似的地方:

someone@ipfs:~$ make install
....
[get ] [fetch] go-libp2p-crypto QmaPbCnUMBohSGo3KnxEa2bHqyJVVeEEcwtqJAYxerieBo
[0 / 202] 392sERROR: [2 / 101 ] parallel fetch: failed to fetch package: QmRb5jh8z2E8hMGN2tkvs1yHynUanqnZ3UeKwgN1i9P1F8: Post https://ipfs.io/api/v0/get?arg=QmRb5jh8z2E8hMGN2txxxx1yHynUanqnZ3UeKwgN1i9P1F8&encoding=json&stream-channels=true: dial tcp 173.252.100.32:443: getsockopt: connection timed out
[0 / 202] 442s^Cmk/gx.mk:4: recipe for target 'gx-deps' failed

https再开一个终端,wget都可以访问。使用"make install_unsupported"也没卵用,然后再次"make install"还是不行。

结果,第二天,安装完官方的ipfs并启动后,再make install 源码,结果,编译通过了,难道这个编译是看天气的吗?

猜测编译可能和以下操作有关:

apt-get install libzip-dev

参考网址:

https://www.oschina.net/p/ipfs

http://liyuechun.org/tags/

https://raw.githubusercontent.com/ipfs/ipfs/master/papers/ipfs-cap2pfs/ipfs-p2p-file-system.pdf

强烈推荐:https://www.daijiale.cn/

IPFS初探的更多相关文章

  1. 初探领域驱动设计(2)Repository在DDD中的应用

    概述 上一篇我们算是粗略的介绍了一下DDD,我们提到了实体.值类型和领域服务,也稍微讲到了DDD中的分层结构.但这只能算是一个很简单的介绍,并且我们在上篇的末尾还留下了一些问题,其中大家讨论比较多的, ...

  2. CSharpGL(8)使用3D纹理渲染体数据 (Volume Rendering) 初探

    CSharpGL(8)使用3D纹理渲染体数据 (Volume Rendering) 初探 2016-08-13 由于CSharpGL一直在更新,现在这个教程已经不适用最新的代码了.CSharpGL源码 ...

  3. 从273二手车的M站点初探js模块化编程

    前言 这几天在看273M站点时被他们的页面交互方式所吸引,他们的首页是采用三次加载+分页的方式.也就说分为大分页和小分页两种交互.大分页就是通过分页按钮来操作,小分页是通过下拉(向下滑动)时异步加载数 ...

  4. JavaScript学习(一) —— 环境搭建与JavaScript初探

    1.开发环境搭建 本系列教程的开发工具,我们采用HBuilder. 可以去网上下载最新的版本,然后解压一下就能直接用了.学习JavaScript,环境搭建是非常简单的,或者说,只要你有一个浏览器,一个 ...

  5. .NET文件并发与RabbitMQ(初探RabbitMQ)

    本文版权归博客园和作者吴双本人共同所有.欢迎转载,转载和爬虫请注明原文地址:http://www.cnblogs.com/tdws/p/5860668.html 想必MQ这两个字母对于各位前辈们和老司 ...

  6. React Native初探

    前言 很久之前就想研究React Native了,但是一直没有落地的机会,我一直认为一个技术要有落地的场景才有研究的意义,刚好最近迎来了新的APP,在可控的范围内,我们可以在上面做任何想做的事情. P ...

  7. 【手把手教你全文检索】Apache Lucene初探

    PS: 苦学一周全文检索,由原来的搜索小白,到初次涉猎,感觉每门技术都博大精深,其中精髓亦是不可一日而语.那小博猪就简单介绍一下这一周的学习历程,仅供各位程序猿们参考,这其中不涉及任何私密话题,因此也 ...

  8. Key/Value之王Memcached初探:三、Memcached解决Session的分布式存储场景的应用

    一.高可用的Session服务器场景简介 1.1 应用服务器的无状态特性 应用层服务器(这里一般指Web服务器)处理网站应用的业务逻辑,应用的一个最显著的特点是:应用的无状态性. PS:提到无状态特性 ...

  9. NoSQL初探之人人都爱Redis:(3)使用Redis作为消息队列服务场景应用案例

    一.消息队列场景简介 “消息”是在两台计算机间传送的数据单位.消息可以非常简单,例如只包含文本字符串:也可以更复杂,可能包含嵌入对象.消息被发送到队列中,“消息队列”是在消息的传输过程中保存消息的容器 ...

随机推荐

  1. Kafka笔记2(安装)

    1.安装java 2.安装zookeeper 3.安装kafka Broker 测试:发布消息 测试:读取消息 4,broker配置 常规配置: broker.id: 默认0  每个broker都需要 ...

  2. java之连接数据库之JDBC访问数据库的基本操作

    1.将数据库的JDBC驱动加载到classpath中,在基于JavaEE的web应用实际开发过程中通常要把目标数据库产品的JDBC驱动复制到WEB—INF/lib下. 2.加载JDBC驱动并将其注册到 ...

  3. hive sql执行的job在map时报java.lang.OutOfMemoryError的错误

    较为详细且重要的一段报错信息是org.apache.hadoop.mapred.YarnChild: Error running child : java.lang.OutOfMemoryError: ...

  4. 【2】Kali之情报搜集技术

    渗透测试中情报搜集需要完成两项重要任务: 1.通过信息搜集工作,确定渗透测试目标范围. 2.通过情报信息搜集,发现渗透测试目标的安全漏洞与脆弱点,为后续的渗透攻击提供基础. 通过DNS和IP地址挖掘目 ...

  5. PTA第一个编程题总结

    7-1 打印沙漏 (20 分) 本题要求你写个程序把给定的符号打印成沙漏的形状.例如给定17个“*”,要求按下列格式打印 ***** *** * *** ***** 所谓“沙漏形状”,是指每行输出奇数 ...

  6. python_study-1

    # Author:larlly'''函数1.在Python交互式命令行下,可以直接输入代码,然后执行,并立刻得到结果.2.文本编辑器推荐俩款 http://www.sublimetext.com/ h ...

  7. json字符串 转Java List 简单方法

    JSONArray jsonArr = JSONArray.fromObject(jsonStr); List<Map<String,Object>> listMap = (L ...

  8. iOS开发 -------- storyBoard实现控制器添加childViewController

    1 拖进去scrollView 添加约束(0,0,0,0);     2 更新scrollView约束,然后在scrollView上面加个view,设置其约束为(0,0,0,0) 和 水平滑动约束; ...

  9. Java基础学习-Path环境变量的配置

    1.为什么要进行Path环境变量的配置       程序的编译和执行需要使用到javac和java命令,所以只能在bin目录下写程序,而实际开发中,我们不可能将程序全部写到bin目录下,所以我们不许让 ...

  10. tomcat的Server.xml详解和Host的配置

    基于以下说法的领悟: 若只配appBase,不配Context 的docBase(appBase和docBase二选一就可以了),则appBase的每个文件夹里都代表一个应用,每个应用都必须放ROOT ...