Linux install guide for an IPFS node on a Raspberry, Banana, or Atomic Pi with Ubuntu to pin CIDs
This tutorial is streamlined from a great tutorial here: How to install IPFS node on Raspberry Pi 4 running Ubuntu - Friends of Little Yus
1. Prerequisites
-
Raspberry, Banana, or Atomic Pi with at least 1GB RAM
-
32GB storage capacity for OS and CID content
-
internet connection preferably via LAN
2. Install Ubuntu Server version (LTS)
3. Download IPFS
-
visit the IPFS distribution page Releases · ipfs/kubo · GitHub
-
depending on your your Pi-model, download the latest 64-bit linux-arm64 or 32-bit linux-arm version
-
as of this writing, latest version is 0.18.1. which will exemplarily be used on Raspberry Pi:
Raspberry Pi 3/4 (64-bit):
wget https://dist.ipfs.io/go-ipfs/v0.18.1/go-ipfs_v0.18.1_linux-arm64.tar.gz
Raspberry Pi 2 (32-bit):
wget https://dist.ipfs.io/go-ipfs/v0.18.1/go-ipfs_v0.18.1_linux-arm.tar.gz
4. Extract
Raspberry Pi 3/4 (64-bit): tar -xvzf go-ipfs_v0.18.1_linux-arm64.tar.gz
Raspberry Pi 2 (32-bit): tar -xvzf go-ipfs_v0.18.1_linux-arm.tar.gz
5. Run install script and confirm installed version
cd go-ipfs
sudo bash install.sh
ipfs --version
6. Low-power profile initialization
since we are happy with a resource-constrained system we
initialize IPFS with the low-power profile:
ipfs init —profile=lowpower
7. Create a service for the IPFS daemon
The following link was used as reference for creating this service file: systemd support · Issue #1430 · ipfs/kubo · GitHub
Create service file:
sudo nano /etc/systemd/system/ipfs.service
Edit, Copy, and Save the following to the ipfs.service file (Replace Raspberry with your username):
[Unit]
Description=IPFS Daemon
After=network.target
[Service]
User=Raspberry
Environment=IPFS_PATH=/home/Raspberry/.ipfs
ExecStart=/usr/local/bin/ipfs daemon --init --migrate
StandardOutput=journal
Restart=on-failure
KillSignal=SIGINT
[Install]
WantedBy=multi-user.target
8. Start IPFS
sudo systemctl daemon-reload
sudo systemctl start ipfs
9. Enable auto-start on reboot
sudo systemctl enable ipfs
10. Reboot Pi
sudo reboot now
11. Pinning CIDs
pin CIDs to keep sensitive content censorship resistent, e.g., the GridSAT NDP - just copy/paste the following commands:
CID for NFT with NDP source code:
ipfs pin add QmNZ6pKjn5s68MazQycJwazymio9rGx3i6qZqCDsgfzgBP
CID for NDP .git:
ipfs pin add QmYjdbvH4fvrJosbn9Nu85QUZB9MQC9P6CwozcMJELepSj
CID for gridsat.eth/:
ipfs pin add QmWxzTDuZzDGD24tv2cukJhUo5H8CF9bUqA8bxZR7Y77UK
Note: CIDs may constantly change - please update regularly - CID updates for the exemplary NDP are posted here, on Twitter, LinkedIn, and gridsat.eth/
The following steps are not mandatory and can be skipped for a resilient IPFS node to pin content - however, they help the IPFS network to perform at its best:
12. Configure Ports
IPFS uses the following default ports:
-
4001 – default libp2p swarm port – must be open to sync to all other public nodes.
-
5001 – API port and webui– provides write/admin access to the node – should be locked down or configured to only be accessible by your local IP.
-
8080 – Gateway
13. Configure firewall
assumed that UFW already runs, open up the following local ports:
-
4001 must be open to sync to all other public nodes.
-
5001 API port and webui. Keep closed if you do not use
-
8080 – Gateway. Keep closed if you do not use
Open up ports:
sudo ufw allow 4001
sudo ufw allow 5001
sudo ufw allow 8080
14. Port forwarding
most internet routers support the Universal Plug-and-Play (UPnP) and/or IPv6 - enable, e.g., for Fritz!Box How do I activate UPnP for my Fritz!Box? | Paessler Knowledge Base - if there is no native UPnP and/or IPv6 support, IPFS only needs the libp2p swarm port (4001) to be open: Configure NAT and port forwarding | IPFS Docs