In the following guide, we will cover all the necessary steps to set up an IPFS node, enable a local HTTP gateway, add it to Media Network and then serve its content to end-users through it.

Installing IPFS node

Installing IPFS through the command-line is handy if you plan on building applications and services on top of an IPFS node. This method is also useful if you're setting up a node without a user interface, usually the case with remote servers or virtual machines. Using IPFS through the command-line allows you to do everything that IPFS Desktop can do, but at a more granular level since you can specify which commands to run.

System requirements

IPFS requires 512MiB of memory and can run an IPFS node on a Raspberry Pi. However, how much disk space your IPFS installation takes up depends on how much data you're sharing. A base installation takes up about 12MB of disk space, and the default maximum disk storage is set to 10GB.

Official distributions

The IPFS team manages the website to help users quickly find the latest version of every IPFS package. As soon as a new release of an IPFS package comes out, it is automatically shown on, so you can be sure you're getting the latest software. These steps detail how to download and install Go-IPFS 0.8.0 from using the command-line.

Install system tools

apt update; \
apt install -y tmux curl nano
  1. Download the Linux binary
  1. Unzip the file
tar -xvzf go-ipfs_v0.8.0_linux-amd64.tar.gz
  1. Move into the go-ipfs folder and run the install script
cd go-ipfs
sudo bash
  1. Check that IPFS installed
ipfs --version

Optimize OS

sysctl -w net.core.rmem_max=2500000

Initialize the repository

ipfs stores all its settings and internal data in a directory called the repository. Before using IPFS for the first time, you’ll need to initialize the repository with the ipfs init command:

If you are running on a server in a data center, you should initialize IPFS with the server profile. Doing so will prevent IPFS from creating a lot of data center-internal traffic trying to discover local nodes:

ipfs init --profile server

If you're running it on your personal computer you can initalize it with:

ipfs init
> initializing ipfs node at /Users/medianetwork/.ipfs
> generating 2048-bit RSA keypair...done
> peer identity: Qmcpo2iLBikrdf1d6QU6vXuNb6P7hwrbNPW9kLAH8eG67z
> to get started, enter:
> ipfs cat /ipfs/QmYwAPJzv5CZsnA625s3Xf2nemtYgPpHdWEz79ojWnPbdG/readme

The hash after peer identity: is your node’s ID and will be different from the one shown in the above output. Other nodes on the network use it to find and connect to you. You can run ipfs id at any time to get it again if you need it.

Now, try running the command suggested to you in the output of ipfs init. The one that looks like ipfs cat /ipfs/<HASH>/readme.

You should see something like this:

Hello and Welcome to IPFS!
██╗██████╗ ███████╗███████╗
██║██████╔╝█████╗ ███████╗
██║██╔═══╝ ██╔══╝ ╚════██║
██║██║ ██║ ███████║
╚═╝╚═╝ ╚═╝ ╚══════╝
If you see 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:
./quick-start <-- usage examples
./readme <-- this file

Take your node online

Once you're ready to join your node to the public network, run the ipfs daemon in another terminal and wait for all three lines below to appear to know that your node is ready:

ipfs daemon
Initializing daemon...
go-ipfs version: 0.8.0
Repo version: 11
System version: amd64/linux
Golang version: go1.15.8
Swarm listening on /ip4/
Swarm listening on /ip4/
Swarm listening on /ip4/
Swarm listening on /ip4/
Swarm listening on /ip4/
Swarm listening on /ip4/
Swarm listening on /ip4/
Swarm listening on /ip4/
Swarm listening on /ip6/::1/tcp/4001
Swarm listening on /ip6/::1/udp/4001/quic
Swarm listening on /p2p-circuit
Swarm announcing /ip4/
Swarm announcing /ip4/
Swarm announcing /ip4/
Swarm announcing /ip4/
Swarm announcing /ip6/::1/tcp/4001
Swarm announcing /ip6/::1/udp/4001/quic
API server listening on /ip4/
Gateway (writable) server listening on /ip4/
Daemon is ready

Make a note of the TCP ports you receive. If they are different, use yours in the commands below.

Now, switch back to your original terminal. If you’re connected to the network, you should be able to see the IPFS addresses of your peers when you run:

ipfs swarm peers
> /ip4/
> /ip4/
> /ip4/
> /ip4/

Adding files to IPFS

You can add any type of content to IPFS. In this case we will put some text content into a .txt file called mytextfile.txt and put the text IPFS TEST - VERSION 1 in it.

echo "IPFS TEST - VERSION 1" > mytextfile.txt

You can read the file's contents using the cat command:

cat mytextfile.txt
ipfs add mytextfile.txt
added QmS7S76K81Qq5AeHFN5tPL8uDhY3NCCSSSBAD4xaMAq87m mytextfile.txt

Save the hash that IPFS returned. This is the content's cryptographic hash. If the file's content changes, the hash will change, but if the file's content remains the same, the hash will always be the same.

Downloading files from IPFS

You can now try to download the file you've just uploaded to IPFS

ipfs cat QmS7S76K81Qq5AeHFN5tPL8uDhY3NCCSSSBAD4xaMAq87m

How IPFS identifies files

IPFS tracks content based on its cryptographic hash. This hash uniquely identifies exactly that content. As long as the content stays the same, the hash stays the same, but if the content changes at all you will get a different hash. If you have two different files that contain identical content, IPFS will track that content with one hash. The filenames are different, but the content is the same, so the hash of the content will be identical.

Make your gateway public

By default, your IPFS HTTP gateway is not exposed to the world. It only works locally. Let's allow anyone in with this command to enable it on port 8080:

sudo ipfs config Addresses.Gateway /ip4/

Please restart the IPFS daemon in order to changes to apply.

Accessing your HTTP Gateway

Check with curl command if IPFS HTTP gateway is accessible by trying to download the previously added mytextfile.txt

curl http://localhost:8080/ipfs/QmS7S76K81Qq5AeHFN5tPL8uDhY3NCCSSSBAD4xaMAq87m

If everything works smoothly, you should get this:


You can now try to access mytextfile.txt from a browser, replacing the IP with your own external one. It should look something like this:

Congrats! If your gateway is reachable, we're now ready to add it to Media Network.