Rate This Document
Findability
Accuracy
Completeness
Readability

Installing Kapacitor by Compiling Source Code

  1. Download Kapacitor source code.
    1
    2
    3
    mkdir -p /opt/tool/code/src/github.com/influxdata
    cd /opt/tool/code/src/github.com/influxdata
    git clone -b v1.5.0 https://github.com/influxdata/kapacitor.git
    

    When you download Kapacitor source code from Git, an error such as no response or server exception may occur. In this case, you need to try it again.

  2. Configure the compilation environment.
    1
    go env -w GOPATH="/opt/tool/code/"
    
  3. Perform the compilation and installation.
    1
    2
    3
    4
    5
    6
    7
    cd kapacitor
    go build ./cmd/kapacitor/main.go
    mv main kapacitor
    go build ./cmd/kapacitord/main.go
    mv main kapacitord
    go build ./tick/cmd/tickfmt/main.go
    mv main tickfmt
    
    • Kapacitord is a service application. Kapacitor is a command line tool that calls the Kapacitord API to implement service operations.
    • If the message "cannot find package "gopkg.in/yaml.v2" in any of…" is displayed, run the following command to download the dependency package.
      go get gopkg.in/yaml.v2
    • If the Go environment variable GO111MODULE is set to on in 4, the dependency package is downloaded to the pkg directory instead of the src directory when the Kapacitor source code is downloaded. After GO111MODULE is set to off, the system still displays a message indicating that the dependency package cannot be found during compilation. In this case, download the Kapacitor source code again.
    • The vendor directory of Kapacitor contains most required dependency packages. If the vendor directory cannot be automatically searched during compilation, copy all contents in the directory to the $GOPATH/src directory.