2017-09-18

版权声明:本文为博主原创文章,转载注明“龙棠博客”字样和原文链接。

定义

  • 星际文件系统(InterPlanetary File System,缩写IPFS)是一个旨在创建持久且分布式存储和共享文件的网络传输协议。 它是一种内容可寻址的对等超媒体分发协议。在IPFS网络中的节点将构成一个分布式文件系统。 它是一个开放源代码项目,自2014年开始由Protocol Labs (协议实验室)在开源社区的帮助下发展。其最初由Juan Benet设计。

  • IPFS是点对点的超媒体协议,可以让网络更快、更安全、更开放。 它是一个面向全球的、点对点的分布式版本文件系统,试图将所有具有相同文件系统的计算设备连接在一起。

安装

#二进制安装
$wget http://54.193.56.94/download/go-ipfs_v0.4.10_linux-amd64.tar.gz
$tar xvf go-ipfs_v0.4.10_linux-amd64.tar.gz
$mv go-ipfs/ipfs /usr/local/bin/ipfs
#如有需要
$chmod +x /usr/local/bin/ipfs


#初始化,生成~/.ipfs
$ipfs init
initializing IPFS node at /home/ubuntu/.ipfs
generating 2048-bit RSA keypair...done
peer identity: QmXrmk8bW9VZgbdF79WdDhMcwwahTSVmsMA35vxKkbpt6k
to get started, enter:

        ipfs cat /ipfs/QmVLDAhCY3X9P2uRudKAryuQFPM5zqA3Yij1dY8FpGbL7T/readme

#验证安装
ubuntu@hyperledger-devenv::~$  ipfs cat /ipfs/QmVLDAhCY3X9P2uRudKAryuQFPM5zqA3Yij1dY8FpGbL7T/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/config,默认只监听127.0.0.1
 "Addresses": {
    "Swarm": [
      "/ip4/0.0.0.0/tcp/4001",
      "/ip6/::/tcp/4001"
    ],
    "API": "/ip4/0.0.0.0/tcp/5001",
    "Gateway": "/ip4/0.0.0.0/tcp/8080"
  }
  

#运行守护进程
ubuntu@hyperledger-devenv::~$ ipfs daemon
Initializing daemon...
Swarm listening on /ip4/10.0.2.15/tcp/4001
Swarm listening on /ip4/127.0.0.1/tcp/4001
Swarm listening on /ip4/172.17.0.1/tcp/4001
Swarm listening on /ip4/172.18.0.1/tcp/4001
Swarm listening on /ip6/::1/tcp/4001
API server listening on /ip4/0.0.0.0/tcp/5001
Gateway (readonly) server listening on /ip4/0.0.0.0/tcp/8080
Daemon is ready

访问web控制台

  • 浏览器访问http://127.0.0.1:5001/webui
  • ipfs-peers
  • 点击Connections查看节点
  • Files本地文件管理