Kubo

From Gentoo Wiki
Jump to:navigation Jump to:search

IPFS (Interplanetary File System) is a protocol for peer-to-peer file-sharing. Kubo (formerly go-ipfs) is one of the reference implementations[1] and is available as Gentoo package.

Installation

Emerge

root #emerge --ask net-p2p/kubo

Additional software

Major browsers like Chrome, Chromium and Firefox support IPFS through the IPFS companion extension.

Configuration

Initialization

Before the first run, the ipfs repository must be initialized:

root #su -s /bin/sh -c "ipfs init -e" ipfs

User

When using the default service files, the IPFS daemon is started as the ipfs system user. If a regular user wants to interact with the system daemon, the ipfs CLI must be configured to call its API, instead of trying to run in offline mode for the current user:

FILE ~/.ipfs/api
/ip4/127.0.0.1/tcp/5001

Profiles

Preset configuration profiles can be applied while the daemon is running, or during initialization. For example when a daemon needs to be optimized for a server environment during initialization:

root #su -s /bin/sh -c "ipfs init -e --profile server" ipfs

Similar on a running daemon:

user $ipfs config profile apply server

Files

  • $IPFS_PATH/config - Dynamic location.
  • /var/lib/ipfs/.ipfs/config - System daemon configuration file.
  • ~/.ipfs/config - User daemon configuration file.

The config file is JSON formatted and is read during start-up of the daemon or in offline mode. It is not read when ipfs is invoked in CLI mode. The configuration can be edited online with:

user $ipfs config edit

Service

openrc

Add the ipfs daemon to the default runlevel so it'll start on system boot:

root #rc-update add ipfs default

Start it now:

root #rc-service ipfs start

systemd

Start and enable the systemd service:

root #systemctl start ipfs.service
root #systemctl enable ipfs.service

Check the log output for warnings or errors:

root #journalctl -u ipfs.service

Usage

Invocation

user $ipfs --help

Troubleshooting

receive buffer size

When the configured system maximum buffer size is too small, the following log message will be present during daemon start:

root #journalctl -u ipfs.service
... failed to sufficiently increase receive buffer size (was: 208 kiB, wanted: 2048 kiB, got: 416 kiB). See https://github.com/lucas-clemente/quic-go/wiki/UDP-Receive-Buffer-Size for details.

The maximum buffer size can be increased by[2]:

root #sysctl -w 'net.core.rmem_max=2500000'
net.core.rmem_max = 2500000
root #echo "net.core.rmem_max=2500000" > /etc/sysctl.d/40-ipfs.conf

Removal

Unmerge

root #emerge --ask --depclean --verbose net-p2p/kubo

Cleanup

Delete the ipfs datastore, configuration and log files:

root #rm -rv /var/lib/ipfs/.ipfs

External resources

References