This guide assumes you're using Debian 11 and have root access to your server.
If you don't have root access, but a recent version of Golang is already installed, you can skip the "Installing Golang" section, but you will need to modify the Edie management tool to call the IPFS binary directly by path and find a different way to daemonize IPFS. That is beyond the scope of this guide.
The reference IPFS daemon (Kubo) is written in the Golang programming language. The version of Golang available in the default Debian Stable repositories is too old to compile Kubo. Thus we have to manually install the latest version.
First, switch to the root user by running sudo -i
.
After that, download the Golang binaries.
Go to this site and scroll down to the section labeled "Stable versions". The file you need will be labeled "linux", then the architecture of your server (usually amd64
), then ".tar.gz". Right click that link, then download it onto your server (I'm using the version that was newest at the time of writing; substitute the link you just found):
wget https://go.dev/dl/go1.19.3.linux-amd64.tar.gz
Then extract them:
tar -C /usr/local -xzf go1.19.3.linux-amd64.tar.gz
At this point you can run exit
to exit the root user and go back to your normal user account.
Add Golang to your $PATH
:
export PATH=$PATH:/usr/local/go/bin
You should also add that line to the bottom of your ~/.zshrc
, ~/.bashrc
, etc. so that you don't have to run it every time you open a new shell session.
Test that Golang is properly installed:
go version
If all is well, it should print a line similar to the following:
go version go1.19.3 linux/amd64
Download the IPFS source code. (You will need Golang installed beforehand.)
git clone https://github.com/ipfs/kubo; cd kubo
Compile it.
make build
If you have root access to your server, move the ipfs
binary to somewhere in your $PATH
. I personally recommend /usr/local/bin
.
sudo mv ./cmd/ipfs/ipfs /usr/local/bin
Now that ipfs
is installed and in your $PATH
, initialize the datastore.
ipfs init
Daemonization (running the IPFS daemon in the background) is up to you how you want to do it. But if you don't daemonize, many of the IPFS functions will not work. Here is a sample systemd unit file:
[Unit] Description=IPFS After=network.target [Service] User=YourUsername ExecStart=/usr/local/bin/ipfs daemon ExecReload=/usr/local/bin/ipfs daemon TimeoutStopSec=5s LimitNOFILE=1048576 LimitNPROC=512 PrivateTmp=true ProtectSystem=full [Install] WantedBy=multi-user.target
If your operating system uses systemd as its init system, you can use this unit file by copying it to /lib/systemd/system/
and then running the following:
sudo systemctl daemon-reload
sudo systemctl enable ipfs
sudo systemctl start ipfs
Edie is a tool I wrote in Bash to make managing decentralized IPFS sites easier to manage. It both allows you to make your own sites and to keep the sites of other people pinned on your node and updated.
First, download the tool.
git clone https://codeberg.org/lethe/edie
(Optionally) symlink it to somewhere in your $PATH
. If you do this, you can update Edie by running cd edie && git pull
without having to symlink it again.
sudo ln -s $HOME/edie/edie /usr/local/bin
Now let's make a site.
edie -c
The tool will ask you the following questions:
On my machine, the output looked like this:
Nickname for site (no spaces): EdieTest Full path to site files (no spaces): /var/www/misc/ 19.81 MiB / 19.81 MiB [============================] 100.00% This next step may take a while depending on the size of the site. Hang tight! Published to k2k4r8lzp5lprvvepogfviahclcb5cuau5afgk16zp89l8rfz7w8w5a8: /ipfs/QmdzZfoxk5KPje8qLUKpPPghyhrySzsDAw4SRJXdMWH2qD Site created. Keys and config backed up in ~/.edie/sites/
Afterwards, you can see the details of your new site by running edie -i YourNicknameHere
. The output will look like this:
Site name: EdieTest IPNS hash: /ipns/k2k4r8lzp5lprvvepogfviahclcb5cuau5afgk16zp89l8rfz7w8w5a8 Local path to site files: /var/www/misc/
That hash (for example, /ipns/k2k4r8lzp5lprvvepogfviahclcb5cuau5afgk16zp89l8rfz7w8w5a8
) is your new site! By using IPNS (the IPFS naming system), we can update our site without having to hand out a new hash every time.
After you've edited the site's files, you can publish the new version to IPFS by running:
edie -k YourNicknameHere
The output will look like the following:
Updating EdieTest 19.81 MiB / 19.81 MiB [============================] 100.00% This next step may take a while depending on the size of the site. Hang tight! Published to k2k4r8lzp5lprvvepogfviahclcb5cuau5afgk16zp89l8rfz7w8w5a8: /ipfs/QmdzZfoxk5KPje8qLUKpPPghyhrySzsDAw4SRJXdMWH2qD Site updated.
This works best with domains set up to use DNSLink.
Add a new site to your storage:
edie -a shimmy1996.com
List info about a pinned site:
edie -v shimmy1996.com
List all sites you have pinned:
edie -l
Update all pinned sites:
edie -u
Unpin a site and delete it from local storage:
edie -d shimmy1996.com
made with <3 by your friends at Dead End Shrine Online
CC BY-NC-SA 4.0 © Lethe Beltane