IPFs Installation and compilation

Source: Internet
Author: User
Tags install go node server docker run
  • Filecoin White Paper
  • Official website: Ipfs.io

[TOC]

Installation

Reference:

    • IPFs Alpha Demo
    • Go-ipfs#build-from-source
    • Install Go IPFs

If you do not have a go environment, you first need to install the GO environment:

brew install go

To configure the GO environment variable:
Execute sudo vi /etc/profile Join

#go configexport PATH=$PATH:/usr/local/go/binexport PATH=$PATH:$GOPATH/bin

Executes a wq! forced save exit.

Download and compile IPFs

go get -u -d github.com/ipfs/go-ipfscd $GOPATH/src/github.com/ipfs/go-ipfsmake install

Appears error :

ERROR: from shell.Get(): Post https://ipfs.io/api/v0/get?arg=QmaPbCnUMBohSGo3KnxEa2bHqyJVVeEEcwtqJAYxerieBo&encoding=json&stream-channels=true: dial tcp 173.252.102.16:443: getsockopt: operation timed out

Install from source #4851

️: If the GX (for dependency management) or any of its dependencies crashes, the go get process may break because the most recent code for each dependency will always be selected, often leading to an API mismatch.

Pre-compiled installation package installation IPFs

The above problem has not been solved for the time being, gx relying on the problem of China Gateway. Then install the run IPFs by installing the package:

  1. Download Go-ipfs,mac OS X Please upload Darwin amd64 it, Ubuntu please Linux amd64 .
  2. Use the tar xvfz go-ipfs_v0.4.14_darwin-amd64.tar.gz unzip installation package.
  3. Run the project by ipfs init establishing a IPFs node on the local computer.
  4. To test, use the ipfs id view node ID.

    {"ID": "QmZXXApnUUTD75bph88eNii3Sc97fiumTX7AMBv5CKHGdf","PublicKey": "CAASpgIwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCmeja+Xls57HMzJdpyk2uutamqNf0zwKUIde6AmK/qtneFSszEr7fwPZ6lE2KUxlaIdDelBpYLWKgwnJA89vWVDcFElXbgmLEwjlWeAnjR3EWLSQcmVGifB7jKrSG0VNeZdRv4Pj/i75zSdxAujZ0EwY6TpN6ZNaXX3BI/8owLlZAVq2wAKjFhjOtSfdGd5Tm61tN4q0EfPPHnU/kC9kr+HQkJm9h71pIL2Uu6LhoRQNpx/ZTnTXm6L0pxzEQSzal7lYsBQGiBKzzaL7PhZtZ6kY6atALRiiFj7ID8rbE03LrOQw4xoFjo3UBardTy1gQVflyqsysCi1DIStzn8qKNAgMBAAE=","Addresses": null,"AgentVersion": "go-ipfs/0.4.14/","ProtocolVersion": "ipfs/0.1.0"}
  5. Using the ipfs daemon boot node server
  6. New terminal Execution Command ipfs cat /ipfs/QmYwAPJzv5CZsnA625s3Xf2nemtYgPpHdWEz79ojWnPbdG/readme .
  7. Browser input URL Http://localhost:5001/webui There is a nice UI interface.

Update

IPFs has an update tool that can be accessed ipfs update . The tool is not installed with IPFs to keep the logic separate from the main code base. To install ipfs update , please download here.

Download IPFs build with IPFs

go-ipfsavailable versions are listed:

ipfs cat /ipns/dist.ipfs.io/go-ipfs/versions

Then, review the available versions of the versions in the previous command ($ version):

ipfs ls /ipns/dist.ipfs.io/go-ipfs/$VERSION

To download a given version of a version:

ipfs get /ipns/dist.ipfs.io/go-ipfs/$VERSION/go-ipfs_$VERSION_darwin-386.tar.gz # darwin 32-bit buildipfs get /ipns/dist.ipfs.io/go-ipfs/$VERSION/go-ipfs_$VERSION_darwin-amd64.tar.gz # darwin 64-bit buildipfs get /ipns/dist.ipfs.io/go-ipfs/$VERSION/go-ipfs_$VERSION_freebsd-amd64.tar.gz # freebsd 64-bit buildipfs get /ipns/dist.ipfs.io/go-ipfs/$VERSION/go-ipfs_$VERSION_linux-386.tar.gz # linux 32-bit buildipfs get /ipns/dist.ipfs.io/go-ipfs/$VERSION/go-ipfs_$VERSION_linux-amd64.tar.gz # linux 64-bit buildipfs get /ipns/dist.ipfs.io/go-ipfs/$VERSION/go-ipfs_$VERSION_linux-arm.tar.gz # linux arm buildipfs get /ipns/dist.ipfs.io/go-ipfs/$VERSION/go-ipfs_$VERSION_windows-amd64.zip # windows 64-bit build

Usage

  Ipfs-global Peer Merkle-dag filesystem. IPFs [<flags>] <command> [<arg>] ...    subcommands BASIC COMMANDS init Initialize IPFs Local Configuration # Initialize IPFs native config add <path>      Add a file to IPFs # Adding files to IPFs cat <ref> Show IPFs Object Data # Display IPFs object for Get <ref> Download IPFs Objects # download IPFs objects ls <ref> list links from an object # Lists of objects linked to refs  <ref> list hashes of links from an object # a hash list of objects links DATA STRUCTURE COMMANDS block Interact with         Raw blocks in the Datastore # interacts with the original block in the data store object Interact with raw DAG nodes # interacts with the original DAG node files Interact with objects as if they were a UNIX filesystem # interacts with objects as if they were UNIX file systems Advanced COMMANDS Dae      Mon start a long-running daemon process # launches a long-running daemon Mount mount an IPFs read-only mountpoint # Install a IPFs read-only mount point resolve resolve any Type of name # Resolves any of the names of types name Publish or resolve IPNS names # Publish or resolve IPNS name DNS Reso Lve dns links # Resolves a DNS link pin pin objects to local storage # locates object to the native storage repo Manipul Ate an IPFs repository # operation of a IPFS warehouse NETWORK COMMANDS ID Show info about IPFs Peers # shows the IPFs node's Info bootstrap Add or remove bootstrap peers # Adding or removing bootstrap nodes swarm Manage connections to the peer Network # Managing connections to peers DHT query the DHT for values or peers # queries the DHT ping Mea for values or nodes        Sure the latency of a connection # measure connection delay DIAG Print Diagnostics # Print diagnostic information TOOL COMMANDS Config Manage Configuration # Admin config version show IPFs version Information # show IPFs release information update downl Oad and GO-IPFS updates # download and apply GO-IPFS update commands list all available commands # List of all available commands use ' IP FS <command>--helP ' to learn more on each command. IPFs uses a repository in the local file system. By default, the repo are located at ~/.ipfs. The repo location, set the $IPFS _path environment Variable:export Ipfs_path=/path/to/ipfsrepo

See also: IPFs getting-started

To get started with IPFs, you must first initialize the IPFs configuration file on your system, which is passed ipfs init . View ipfs init --help information about the optional parameters that it requires. After initialization is complete, you can use ipfs mount , ipfs add or any other command to explore!

Local ' IPFs working ' basic use:

echo "hello world" > helloipfs add hello# This should output a hash string that looks something like:# QmT78zSuBmuS4z925WZfrqQ1qHaJ56DQaTfyMUF7F8ff5oipfs cat <that hash>

Using Docker

The IPFs Docker image is located in Hub.docker.com/r/ipfs/go-ipfs. To display files inside the container, you need to -v docker install the host directory using the options. Select a directory that you want to use to import/export files from IPFs. You should also select a directory to store the IPFs files, which are retained when the container is restarted.

export ipfs_staging=</absolute/path/to/somewhere/>export ipfs_data=</absolute/path/to/somewhere_else/>

Start the container running IPFs and expose the port 4001 , 5001 and 8080 :

docker run -d --name ipfs_host -v $ipfs_staging:/export -v $ipfs_data:/data/ipfs -p 4001:4001 -p 127.0.0.1:8080:8080 -p 127.0.0.1:5001:5001 ipfs/go-ipfs:latest

Watch the IPFs log:

docker logs -f ipfs_host

Wait for the IPFs to start. When you see the following, IPFs is running:

Gateway (readonly) serverlistening on /ip4/0.0.0.0/tcp/8080

You can now stop viewing the log.
Run the IPFs command:

docker exec ipfs_host ipfs <args...>

Example: Connecting to a Node

docker exec ipfs_host ipfs swarm peers

To add a file:

cp -r <something> $ipfs_stagingdocker exec ipfs_host ipfs add -r /export/<something>

To stop a running container:

docker stop ipfs_host

️: If you have previously installed IPFs and have encountered a problem making the new version work, try deleting (or backing up another location) IPFs the configuration directory (the default is 〜/. IPFs) and rerun ipfs init . This will reinitialize the configuration file to its default value and clear the local data store of any error entry.

Extended Links

    • IPFs Getting Started notes
    • IPFs Notebooks and teaching
    • How to use the Interstellar File Transfer Network (IPFs) to build a blockchain service
Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.