(this will get a lot easier once we solve some of these issues)
- modify
cmd/ipfs/config.go
and set to:
# change this
const DefaultPathRoot = "~/.go-ipfs"
# to this
const DefaultPathRoot = ".go-ipfs"
- make two directories for your nodes
mkdir node1
mkdir node2
- Init both of them
cd node1 && ipfs init
cd node2 && ipfs init
- You'll now have files
node1/.go-ipfs/config
with something like this:
{
"Identity": {
"PeerID": "QmRSxW3e1SXVT3ovBzg6Nqe1EQwMW5PwXVByK2JKko3PH8",
"PrivKey": "CAASrBIwggkoAgEAAoICAQDGkzuZr8xsZX7ouZdFwuGuemS...HUGE KEY...==",
"Address": "/ip4/127.0.0.1/tcp/5001"
},
"Datastore": {
"Type": "leveldb",
"Path": "/Users/jbenet/.go-ipfs/datastore"
},
"RPCAddress": "/ip4/127.0.0.1/tcp/4001",
"Peers": [
{
"Address": "/ip4/104.131.131.82/tcp/5001",
"PeerID": "QmaCpDMGvV2BGHeYERUEnRQAwe3N8SzbUtfsmvsqQLuvuJ"
}
]
}
You should change the following keys:
Identity.Address
should have two different ports (say 5001, 5002)RPCAddress
should have two different ports (say 4001, 4002)Peers
should point to each other -- i.e. add:
{
"Address": "<the Identity.Address of the other node>",
"PeerID": "<the Identity.PeerID of the other node>"
}
- add some files to each node:
# in node1/
> echo "foo" > foo
> ipfs add foo
added QmdH8HtMYXGg7ZxtjG6wtDrevqFkWYDff4NVxFicfPQwXy foo
# in node2/
> echo "bar" > bar
> ipfs add bar
added QmdruGFND6oiYuszuGHApktfCUz31RfPANYARFrC2n6Dmq bar
- you can now launch the nodes. In two different terminals, type:
cd node1 && ipfs mount ipfs
cd node2 && ipfs mount ipfs
-
The should connect to each other (cross fingers)
-
You should now be able to cat one file across the other node
# in node1/
> ipfs cat QmdruGFND6oiYuszuGHApktfCUz31RfPANYARFrC2n6Dmq
foo
# in node2/
> cat ipfs/QmdH8HtMYXGg7ZxtjG6wtDrevqFkWYDff4NVxFicfPQwXy
bar
(both ipfs cat <hash>
and cat ipfs/<hash>
should work)
yay? Ping us at https://github.com/jbenet/go-ipfs or #ipfs on freenode if it doesn't work.