Skip to content

Instantly share code, notes, and snippets.

@MiguelBel
Last active September 20, 2019 19:54
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save MiguelBel/695d2bd8e135137cfa24c70de1955d80 to your computer and use it in GitHub Desktop.
Save MiguelBel/695d2bd8e135137cfa24c70de1955d80 to your computer and use it in GitHub Desktop.
sudo apt-get install htop -y # This is not necessary, I just have it for check the resources consumption
sudo apt-get update
sudo apt-get install golang-go -y
export PATH=$PATH:$GOROOT/bin:$GOPATH/
export GOPATH=$HOME/go
wget https://dist.ipfs.io/go-ipfs/v0.4.10/go-ipfs_v0.4.10_linux-386.tar.gz
tar xvfz go-ipfs_v0.4.10_linux-386.tar.gz
sudo mv go-ipfs/ipfs /usr/local/bin/ipfs
ipfs init
ipfs config Addresses.Gateway /ip4/0.0.0.0/tcp/8080
ipfs config --json API.HTTPHeaders.Access-Control-Allow-Origin '["*"]'
ipfs config --json API.HTTPHeaders.Access-Control-Allow-Methods '["PUT", "GET", "POST"]'
ipfs config --json Gateway.HTTPHeaders.Access-Control-Allow-Origin '["*"]'
ipfs config --json Gateway.HTTPHeaders.Access-Control-Allow-Methods '["PUT", "GET", "POST", "OPTIONS"]'
ipfs config --json Gateway.Writable true
ipfs config --json Gateway.HTTPHeaders.Access-Control-Expose-Headers '["Ipfs-Hash"]'
ipfs daemon
@MiguelBel
Copy link
Author

You can use it straight on your server with:

wget https://gist.githubusercontent.com/MiguelBel/695d2bd8e135137cfa24c70de1955d80/raw/9f51cf6eba4ded1ce89168ab6e0b670eee935
45f/Setup%2520IPFS%2520Node%2520Ubuntu%252016

sh Setup%20IPFS%20Node%20Ubuntu%2016

@pollosp
Copy link

pollosp commented Nov 14, 2017

maybe curl https://gist.githubusercontent.com/MiguelBel/695d2bd8e135137cfa24c70de1955d80/raw/9f51cf6eba4ded1ce89168ab6e0b670eee93545f/Setup%2520IPFS%2520Node%2520Ubuntu%252016 | sh is better 🍶

@pollosp
Copy link

pollosp commented Nov 14, 2017

sudo apt-get update
sudo apt-get install htop -y # This is not necessary, I just have it for check the resources consumption
sudo apt-get install golang-go -y
export PATH=$PATH:$GOROOT/bin:$GOPATH/
export GOPATH=$HOME/go
wget https://dist.ipfs.io/go-ipfs/v0.4.10/go-ipfs_v0.4.10_linux-386.tar.gz
tar xvfz go-ipfs_v0.4.10_linux-386.tar.gz
sudo mv go-ipfs/ipfs /usr/local/bin/ipfs

mkdir -p /opt/ipfs/
export IPFS_PATH=/opt/ipfs/
sudo cat > /etc/systemd/system/ipfs.service << EOF
[Unit]
Description=IPFS
After=network.target
[Service]
Type=simple
Restart=on-abort
Environment=IPFS_PATH=/opt/ipfs/
WorkingDirectory=/opt/ipfs
ExecStart=/usr/local/bin/ipfs daemon
[Install]
WantedBy=multi-user.target
EOF

ipfs init
ipfs config Addresses.Gateway /ip4/0.0.0.0/tcp/8080
ipfs config --json API.HTTPHeaders.Access-Control-Allow-Origin '["*"]'
ipfs config --json API.HTTPHeaders.Access-Control-Allow-Methods '["PUT", "GET", "POST"]'
ipfs config --json Gateway.HTTPHeaders.Access-Control-Allow-Origin '["*"]'
ipfs config --json Gateway.HTTPHeaders.Access-Control-Allow-Methods '["PUT", "GET", "POST", "OPTIONS"]'
ipfs config --json Gateway.Writable true
ipfs config --json Gateway.HTTPHeaders.Access-Control-Expose-Headers '["Ipfs-Hash"]'
systemctl ipfs start 

Still superdirty, but at least it leave ipfs running as daemon ..... 🐷 🐖

@karsrhyder
Copy link

I think last line should be systemctl start ipfs

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment