# lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 18.04.3 LTS
Release: 18.04
Codename: bionic
# tar -zxvf go-ipfs_v0.4.22_linux-amd64.tar.gz
# cd go-ipfs/
# ./install.sh
Moved ./ipfs to /usr/local/bin
# ipfs init
initializing IPFS node at /root/.ipfs
generating 2048-bit RSA keypair...done
peer identity: QmQZhYTQTZwPPL6tvDRft3GCqFTgDC2vWJsj1sHECe8Jmf
to get started, enter:
ipfs cat /ipfs/QmS4ustL54uo8FzR9455qaxZwuMiUhyvMcX9Ba8nUH4uVv/readme
# ipfs cat /ipfs/QmS4ustL54uo8FzR9455qaxZwuMiUhyvMcX9Ba8nUH4uVv/readme
Hello and Welcome to IPFS!
██╗██████╗ ███████╗███████╗
██║██╔══██╗██╔════╝██╔════╝
██║██████╔╝█████╗ ███████╗
██║██╔═══╝ ██╔══╝ ╚════██║
██║██║ ██║ ███████║
╚═╝╚═╝ ╚═╝ ╚══════╝
If you're seeing this, you have successfully installed
IPFS and are now interfacing with the ipfs merkledag!
-------------------------------------------------------
| Warning: |
| This is alpha software. Use at your own discretion! |
| Much is missing or lacking polish. There are bugs. |
| Not yet secure. Read the security notes for more. |
-------------------------------------------------------
Check out some of the other files in this directory:
./about
./help
./quick-start <-- usage examples
./readme <-- this file
./security-notes
# ipfs daemon
Initializing daemon...
go-ipfs version: 0.4.22-
Repo version: 7
System version: amd64/linux
Golang version: go1.12.7
Swarm listening on /ip4/127.0.0.1/tcp/4001
Swarm listening on /ip4/183.60.21.112/tcp/4001
Swarm listening on /ip6/::1/tcp/4001
Swarm listening on /p2p-circuit
Swarm announcing /ip4/127.0.0.1/tcp/4001
Swarm announcing /ip4/183.60.21.112/tcp/4001
Swarm announcing /ip6/::1/tcp/4001
API server listening on /ip4/127.0.0.1/tcp/5001
WebUI: http://127.0.0.1:5001/webui
Gateway (readonly) server listening on /ip4/127.0.0.1/tcp/8080
Daemon is ready
# ipfs swarm peers | wc -l
628
nohup ipfs daemon >> /storage/ipfs.log 2>&1 &
Environment
# cd /lib/systemd/system/
# touch ipfs.service
# vim ipfs.service
[Unit]
Description=ipfs service
[Service]
Environment='IPFS_PATH=/storage/ipfs'
ExecStart=/usr/local/bin/ipfs daemon
Restart=always
User=root
Group=root
[Install]
WantedBy=multi-user.target
# systemctl daemon-reload
# systemctl enable ipfs.service
Created symlink from /etc/systemd/system/multi-user.target.wants/ipfs.service to /lib/systemd/system/ipfs.service.
# systemctl start ipfs.service
# systemctl status ipfs.service
http://ip地址:5001/webui
# ipfs get /ipns/proofs.filecoin.io -o /V20/
Saving file(s) to /V20/
2.00 MiB / 61.75 GiB [>-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------] 0.00% 5h16m55s
# vim /root/.bashrc
export IPFS_PATH=/storage/ipfs
# source /root/.bashrc
# echo $IPFS_PATH
/storage/ipfs
# which ipfs
/usr/local/bin/ipfs
# ipfs init
initializing IPFS node at /storage/ipfs
# pwd
/storage/ipfs
# ls
blocks config datastore datastore_spec keystore version
参考: