IPFS在macOS搭建(一)

4 篇文章 0 订阅

1.下载地址:
https://docs.ipfs.io/guides/guides/install/
在这里插入图片描述
Download IPFS for your platform 找适用的版本
在这里插入图片描述
2.创建目录及解压后用install.sh 安装:

appledeMac-mini:~ apple$ cd  IPFS/
appledeMac-mini:IPFS apple$ ls
go-filecoin-master	go-ipfs
appledeMac-mini:IPFS apple$ cd  go-ipfs/
appledeMac-mini:go-ipfs apple$ ls
LICENSE		README.md	install.sh
appledeMac-mini:go-ipfs apple$ sudo ./install.sh 
Password:
问题:没$PATH该有的目录和权限
mv: rename ./ipfs to /usr/local/bin/./ipfs: No such file or directory
mv: rename ./ipfs to /usr/bin/./ipfs: Operation not permitted
We cannot install ./ipfs in one of the directories /usr/local/bin /usr/bin
It seems that we do not have the necessary write permissions.
Perhaps try running this script as a privileged user:

    sudo ./install.sh

用root用户:

appledeMac-mini:~ root# cd   /usr/local/ 
appledeMac-mini:local root# mkdir bin
appledeMac-mini:go-ipfs root# ./install.sh 
Moved ./ipfs to /usr/local/bin

3.测试IPFS:

appledeMac-mini:go-ipfs root# ipfs  help
USAGE
  ipfs  - Global p2p merkle-dag filesystem.  ##安装成功

SYNOPSIS
  ipfs [--config=<config> | -c] [--debug | -D] [--help] [-h] [--api=<api>] [--offline] [--cid-base=<base>] [--upgrade-cidv0-in-output] [--encoding=<encoding> | --enc] [--timeout=<timeout>] <command> ...

OPTIONS

  -c, --config               string - Path to the configuration file to use.
  -D, --debug                bool   - Operate in debug mode.
  --help                     bool   - Show the full command help text.
  -h                         bool   - Show a short version of the command help
                                      text.
  -L, --local                bool   - Run the command locally, instead of using
                                      the daemon. DEPRECATED: use --offline.
  --offline                  bool   - Run the command offline.
  --api                      string - Use a specific API instance (defaults to
                                      /ip4/127.0.0.1/tcp/5001).

4.·ipfs初始化节点

appledeMac-mini:go-filecoin-master root# ipfs  init
initializing IPFS node at /var/root/.ipfs
generating 2048-bit RSA keypair...done
peer identity: QmYvjCmvgE6HagyAK9ZDfCnhzbgzcZyrM3QTpD5z94HMJR
to get started, enter:

	ipfs cat /ipfs/QmS4ustL54uo8FzR9455qaxZwuMiUhyvMcX9Ba8nUH4uVv/readme

5.查看节点信息

appledeMac-mini:go-filecoin-master root# 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

6.节点搭建成功查看本机节点的id信息

appledeMac-mini:~ root# ipfs  id
{
	"ID": "QmYvjCmvgE6HagyAK9ZDfCnhzbgzcZyrM3QTpD5z94HMJR",
	"PublicKey": "CAASpgIwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQDfEVnymF06TwnzBt5aOo2GvDdvp58Z3kxLVivvgoBPeJaEnOKMfBjLq+ltUTjDe3isCo/zUSP4EppN1rFkvpVKyxru5jp/wwJzu6I3xTcMPnevFS60ptrqi9fk4iHXyy1eEKEqAwLdWHQHApFYTuE5k8xmaFgRKtKWXs4UpXiCo5l5wG4vM5mK4A/pFJFf/PoofkweBJI35zjjyi4fnY+CsLg5DyrsbkbuuyaLmbAKRNoq9pXjHs7+WNoMbk/aofWfAD7Gu6WMy6fi6YoOTD5Ds6zQ2P11vWk2qNn7k4ssLcbn6tqiRt0gLPTY61J4Hsgi7/h5zi+lDAqVBWcvA615AgMBAAE=",
	"Addresses": null,
	"AgentVersion": "go-ipfs/0.4.21/",
	"ProtocolVersion": "ipfs/0.1.0"
}

7.启动IPFS及查看(可通过节点·ID·访问到数据)

appledeMac-mini:~ root# ipfs  daemon
Initializing daemon...
go-ipfs version: 0.4.21-
Repo version: 7
System version: amd64/darwin
Golang version: go1.12.5
15:48:18.691 ERROR    p2pnode: mdns error:  could not determine host IP addresses for appledeMac-mini.local. discovery.go:46
Swarm listening on /ip4/127.0.0.1/tcp/4001
Swarm listening on /ip4/192.168.1.51/tcp/4001
Swarm listening on /ip6/::1/tcp/4001
Swarm listening on /p2p-circuit
Swarm announcing /ip4/127.0.0.1/tcp/4001
Swarm announcing /ip4/192.168.1.51/tcp/4001
Swarm announcing /ip6/::1/tcp/4001
API server listening on /ip4/127.0.0.1/tcp/5001
WebUI: http://127.0.0.1:5001/webui   ##这个就是访问节点页面的·url
Gateway (readonly) server listening on /ip4/127.0.0.1/tcp/8080
Daemon is ready

在这里插入图片描述
在这里插入图片描述

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值