/
install
executable file
·46 lines (34 loc) · 1.5 KB
/
install
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#!/usr/bin/env bash
set -e
GO_IPFS_VERSION=v0.4.17
# Hyperborea connected peer used to bootstrap hyperborea only ipfs nodes
IPFS_PEER="/ip6/fc6e:691e:dfaa:b992:a10a:7b49:5a1a:5e09/tcp/4001/ipfs/QmU6NeD2Uu34WKest1NZGvGmScLhN1zVo66K35GeE6Jft2"
BASE_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
# Download and install IPFS
mkdir "$BASE_DIR/tmp"
wget "https://dist.ipfs.io/go-ipfs/${GO_IPFS_VERSION}/go-ipfs_${GO_IPFS_VERSION}_linux-arm.tar.gz" -O "$BASE_DIR/tmp/go-ipfs.tar.gz"
tar xvfz "$BASE_DIR/tmp/go-ipfs.tar.gz" -C "$BASE_DIR/tmp"
sudo cp "$BASE_DIR/tmp/go-ipfs/ipfs" /usr/local/bin/ipfs
sudo chown root:staff /usr/local/bin/ipfs
rm -rf "$BASE_DIR/tmp"
# Initialize IPFS
ipfs init
# Configure HTTP to IPFS gateway
source "$BASE_DIR/../shared/nginx/install"
sudo cp "$BASE_DIR/ipfs-http-gateway.conf" /etc/nginx/site-path-enabled/ipfs-http-gateway.conf
sudo systemctl restart nginx.service
source "$BASE_DIR/../shared/nodeinfo/install"
sudo cp $BASE_DIR/nodeinfo-ipfs /opt/tomesh/nodeinfo.d/ipfs
# add cjdns bootstrap address
ipfs bootstrap add "$IPFS_PEER"
# Download dependencies
sudo apt-get install -y jq
# Move file
sudo cp $BASE_DIR/ipfs-swarm-cjdns.sh /usr/local/bin/
sudo chmod +x /usr/local/bin/ipfs-swarm-cjdns.sh
# Configure systemd to start ipfs.service on system boot
sudo cp "$BASE_DIR/ipfs.service" /etc/systemd/system/ipfs.service
sudo sed -i "s|__USER_HOME__|${HOME}|" /etc/systemd/system/ipfs.service
sudo systemctl daemon-reload
sudo systemctl enable ipfs.service
sudo systemctl start ipfs.service