- Create Instance on DO/AWS
- Configure a security group with the following options:
Custom TCP: 8080
Custom TCP: 4001–4002
- SSH into your EC2 instance
- Select a Linux binary from https://dist.ipfs.io/go-ipfs/ e.g. https://dist.ipfs.io/go-ipfs/v0.14.0/go-ipfs_v0.14.0_linux-amd64.tar.gz
- Unzip:
tar -xvzf go-ipfs_v0.14.0_linux-amd64.tar.gz
- Navigate to the correct directory:
cd go-ipfs
- Run the install script:
sudo bash install.sh
- Check that IPFS was installed correctly by running:
ipfs --version
- Create a directory:
mkdir /home/ubuntu/data/ipfs
- Add the path to your Bash profile:
echo 'export IPFS_PATH=/home/ubuntu/data/ipfs >> ~/.profile'
- Reload your bash profile:
source ~/.profile
- Initialize the IPFS repository:
ipfs init --profile server
- Open the Gateway on port 8080:
ipfs config Addresses.Gateway /ip4/0.0.0.0/tcp/8080
- Create a systemd service:
sudo vim /lib/systemd/system/ipfs.service
- Add the following contents to the file:
[Unit]
Description=ipfs daemon
[Service]
ExecStart=/usr/local/bin/ipfs daemon --enable-gc
Restart=always
User=ubuntu
Group=ubuntu
Environment=”IPFS_PATH=/home/ubuntu/data/ipfs”
[Install]
WantedBy=multi-user.target
- Save the file
- Restart the daemon:
sudo systemctl daemon-reload
- Enable the service:
sudo systemctl enable ipfs.service
- Start the service:
sudo systemctl start ipfs
- Check the status:
sudo systemctl status ipfs
- Edit IPFS configuration:
sudo vim /home/ubuntu/data/ipfs/config
- Set json key .Gateway.Writable = true
{
......
"Gateway": {
"APICommands": [],
"HTTPHeaders": {
"Access-Control-Allow-Headers": [
"X-Requested-With",
"Range",
"User-Agent"
],
"Access-Control-Allow-Methods": [
"GET",
"POST",
"PUT"
],
"Access-Control-Allow-Origin": [
"*"
]
},
"NoDNSLink": false,
"NoFetch": false,
"PathPrefixes": [],
"PublicGateways": null,
"RootRedirect": "",
"Writable": true
},
......
}
- Restart ipfs:
sudo systemctl restart ipfs