Docker is useful for deploying test networks.
-
Download latest release go-ipfs binary and untar it.
-
Now copy
go-ipfs/ipfs
to/usr/local/bin/ipfs
or somewhere $PATH points to. -
Test ipfs is working with
ipfs help
-
Run
ipfs init
, this will set up a node with the defaultIPFS_PATH=/home/$USER/.ipfs
and create a new identity.
initializing IPFS node at /home/$USER/.ipfs
generating 2048-bit RSA keypair...done
peer identity: QmS4ustL54uo8FzR9455qaxZwuMiUhyvMcX9Ba8nUH4uVv
- Since this is a private swarm, delete the default bootstrap nodes with
ipfs bootstrap rm --all
Skip these steps if you have a pre-shared swarm.key
.
git clone https://github.com/Kubuxu/go-ipfs-swarm-key-gen
cd go-ipfs-swarm-key-gen/
⚠️ Next command will Overwrite existing swarm.keygo run ipfs-swarm-key-gen/main.go > $IPFS_PATH/swarm.key
As mentioned in #1, you can also generate a swarm.key
using the following command:
⚠️ Next command will Overwrite existing swarm.key
(echo -e '/key/swarm/psk/1.0.0/\n/base16/' ; head -c 32 /dev/urandom | od -t x1 -A none - | tr -d '\n '; echo '') > $IPFS_PATH/swarm.key
Ok. Put that file in the default IPFS directory. On Linux that is /home/$USER/.ipfs/
.
This directory should also contain configuration and keystores. If it does not, go back and check where ipfs init
put these.
Great, now your node won't connect to anyone without the same swarm.key. Be sure to remove the default ipfs bootstrap addresses before continuing.
- Start your ipfs node with
ipfs daemon
. You should see a message near the top. If you don't see the following message ensure theswarm.key
file is in the correct location.
Swarm is limited to private network of peers with the swarm key
Swarm key fingerprint: xxxxxxxxxxxxxxxx
-
In a new terminal, run
ipfs id
. You will see the peer id, public key, addresses, and versions. We are interested in theAddresses
list. -
There will be an address for each active network interface. Copy the address which other nodes will be able to reach you with.
It looks like/ip4/192.168.1.11/tcp/4001/ipfs/<peer_id>
. -
Hopefully you will have other nodes you have set up with the same configuration as above. Add the above address to the bootstrap list of those nodes with
ipfs bootstrap add /ip4/192.168.1.11/tcp/4001/ipfs/<peer_id>
. -
You should have multiple nodes set as bootstrap nodes to ensure network connectivity.
Congrats, you now have a private ipfs swarm up and running. Now to learn ipfs!
Usage is congruent to the default usage of ipfs. Check out the documentation here.
- Set up boot node to run IPFS deamon on boot: IPFS_SERVICE
- Configure your local IPFS node for the private swarm: CONNECT
- Enable the WebUI at localhost:5001/webui for your private swarm: WEBUI