To install IPFS, Go makes it relatively straightforward to install dependencies directly from its source.
In you console type:
$ go get -d github.com/ipfs/go-ipfs $ cd /go/src/github.com/ipfs/go-ipfs$ make install
We now need to install ipfs-update module.For that go to here and download the zip file then extract it to the go/src/github.com/ipfs/go-ipfs Then open the terminal, at that position inside ipfs-update and type:
Now, again type :
$ ipfs-update $ ipfs-update versions $ ipfs-update install \<your selected version\>
The version you selected will update your go-ipfs.
Now, you can use the command 'ipfs'.
Before we can use IPFS, we must initialize a local repository. This repository contains the settings and internal data for your user account. It also generates a peer identity key to sign any content you create cryptographically.
$ ipfs init
init command outputs your peer identity key. This key is similar to an account number.
$ ipfs cat /ipfs/QmYwAPJzv5CZsnA625s3Xf2nemtYgPpHdWEz79ojWnPbdG/readme
You should see Hello and welcome to IPFS:
Your IPFS repository is located by default to location in a .ipfs folder in your home folder, where all your content is stored.
Note: The quick start guide from the readme gives a list of all commands to assist with getting started.
Navigate to a directory where you would like to create a file and try the following:
$ mkdir ipfs_dir $ cd ipfd_dir
Now let's create a file inside this folder.
$ echo "hello world" >hello.txt
The text file hello.txt contains "hello world ". Next, add the file to IPFS.
$ ipfs add hello.txt
You see the following type of output(may not be exact but kind of):
$ added QmYBmnUzkvvLxPksYUBGHy2sqbvwskLQw5gK6whxHGcsa8 hello.txt
The combination of letters and numbers is the hash that's associated with this text file. The hash is created based on the contents of the file. If you change the contents of the file, the hash changes, save this hash to access the file later on.
Without using IPFS, we can read the contents of the hello.txt file with the following command:
$ cat mytextfiletxt
We can read it through IPFS as well. Using the hash generated earlier, enter the following to return the contents of the file:
ipfs cat QmYBmnUzkvvLxPksYUBGHy2sqbvwskLQw5gK6whxHGcsa8
If we change the text inside our hello.txt file,we will receive a new hash. Using the
cat command, we see that our helloworld.txt file was updated with the new text.
So far we've worked with IPFS locally. Now we're ready to try things online. Open another terminal and run the daemon command.
$ ipfs daemon
The daemon allows us to interact with the IPFS network through localhost in our browser. Switch back to the other terminal to take a look at our peers.
$ ipfs swarm peers
This command results in a bunch of addresses flashing across the terminal. We opened the swarm component that allows us to listen and maintain connections with other peers on the network. The
peers command allows us to see every peer that has an open connection.
We've successfully connected to the IPFS network and from here can get content from other nodes if we know the hash of the content.
As we've successfully connected our node to the network we can use the IPFS Web Console.
In the console, we can:
- check the status of your node
- upload files to IPFS
- explore files
- see your peers
- adjust settings for your node
The web console is the best tool for managing IPFS node.
Check my first post here
Happy configuring. _x_