Running IPFS at Oracle Cloud

How to setup and run IPFS node for free in Oracle Cloud environment.

First, you need to register for Oracle Cloud Free Tier. You need credit card and phone number for registration. Finish registration and login to web console.

In Oracle Cloud Console create Compute Instance. Select free type E2.1.Micro and Oracle Autonomous Linux image. In free tier we can use up to two virtual machines with 1 GB RAM each and 100GB of disk space shared between these two. Its possible to use all free 100GB storage just for one machine.

Selecting Oracle Autonomous Linux allows automatic zero downtime live kernel and important system libraries patching using Ksplice. This is really good since its just fire and forget instalation, we do not plan to do anything else with this VM except runing IPFS holding publicly available data.

Login to instance as user opc, create ipfs user and switch to it. For easier work you can add two export statements to ~ipfs/.bashrc

sudo useradd --home /home/ipfs -U ipfs
sudo chmod 750 /home/ipfs
sudo mkdir -p -m 750 /var/ipfs/data
sudo chown ipfs:ipfs /var/ipfs/data
sudo -u ipfs -i
export PATH=$PATH:/usr/local/bin
export IPFS_PATH=/var/ipfs/data

Download go-ipfs for 64bit Linux from IPFS downloads, unpack it and install it. Switch back to opc user for instalation because ipfs user can’t run sudo. Detailed instructions there.

While we are back to user opc lets open port 8443 in firewall:

sudo firewall-cmd --zone=public --add-port=8443/tcp --permanent
sudo firewall-cmd --zone=public --add-port=8443/udp --permanent
sudo firewall-cmd --reload

You also need to open port in cloud security list for your virtual cloud network in cloud management console.

Now its time to configure our IPFS daemon. Switch to ipfs user again by sudo -u ipfs -i and then init server:

ipfs init -p server

Edit /var/ipfs/data/config and change port in Addresses Swarm from well known ipfs 4001 to our more generic 8443 and then Routing Type from dht to dhtclient. This will save us some memory. Also set AutoNAT.ServiceMode to disabled.

IPFS will be started by systemd. For configuration sudo to root: sudo -u root -i then put following file ipfs.service into /etc/systemd/system directory.

Description=Interplanetary File System

ExecStart=/usr/local/bin/ipfs daemon --enable-namesys-pubsub --enable-gc


Last step is to increase UDP buffer size. In /etc/sysctl.d directory create file ipfs.conf


Start ipfs using systemd:

systemctl daemon-reload
systemctl enable ipfs.service
systemctl restart ipfs.service
systemctl status ipfs.service