Facing difficulties in Installing Community Beat (Elasticbeat)


(Yuvraj Gupta) #1

Hi All
I am facing difficulty while installing elasticbeat. I am using Ubuntu.
I am mentioning the steps along with error while installing elasticbeat:-

  1. Installed Go using following command:-
    sudo apt-get install golang

  2. Verified Go language is installed:-
    go version
    Output:- go version go1.2.1 linux/amd64

  3. Added following variables to ~/.bashrc file:-
    export GOROOT="/usr/lib/go"
    export GOPATH="$HOME/go"
    export PATH="$GOROOT/bin:$PATH"

  4. Navigated to workspace & created directory:-
    cd $GOPATH
    mkdir -p src/github.com/radoondas

  5. Navigated to the directory and cloned elasticbeat repository using following command:-
    cd $GOPATH/src/github.com/radoondas/elasticbeat
    git clone https://github.com/radoondas/elasticbeat.git

  6. Then running make command gives following error:-
    yuvraj@ubuntu:~/go/src/github.com/radoondas/elasticbeat$ make
    go build
    main.go:6:2: cannot find package "github.com/elastic/beats/libbeat/beat" in any of:
    /usr/lib/go/src/pkg/github.com/elastic/beats/libbeat/beat (from $GOROOT)
    /home/yuvraj/go/src/github.com/elastic/beats/libbeat/beat (from $GOPATH)
    beater/elasticbeat.go:9:2: cannot find package "github.com/elastic/beats/libbeat/cfgfile" in any of:
    /usr/lib/go/src/pkg/github.com/elastic/beats/libbeat/cfgfile (from $GOROOT)
    /home/yuvraj/go/src/github.com/elastic/beats/libbeat/cfgfile (from $GOPATH)
    beater/elasticbeat.go:10:2: cannot find package "github.com/elastic/beats/libbeat/common" in any of:
    /usr/lib/go/src/pkg/github.com/elastic/beats/libbeat/common (from $GOROOT)
    /home/yuvraj/go/src/github.com/elastic/beats/libbeat/common (from $GOPATH)
    beater/elasticbeat.go:11:2: cannot find package "github.com/elastic/beats/libbeat/logp" in any of:
    /usr/lib/go/src/pkg/github.com/elastic/beats/libbeat/logp (from $GOROOT)
    /home/yuvraj/go/src/github.com/elastic/beats/libbeat/logp (from $GOPATH)
    beater/elasticbeat.go:12:2: cannot find package "github.com/elastic/beats/libbeat/publisher" in any of:
    /usr/lib/go/src/pkg/github.com/elastic/beats/libbeat/publisher (from $GOROOT)
    /home/yuvraj/go/src/github.com/elastic/beats/libbeat/publisher (from $GOPATH)
    make: *** [build] Error 1

The above error was due to libbeat folder not found.

Solved above error by cloning beats director of Elastic using following steps:-

  1. Created a directory
    mkdir -p $GOPATH/src/github.com/elastic

  2. Navigated to the directory and cloned Elastic beats repository using following command:-
    cd $GOPATH/src/github.com/elastic
    git clone https://github.com/elastic/beats.git

  3. Copied the folder in the location it was expecting.
    sudo cp -r github.com/ /usr/lib/go/src/pkg/

After doing the following & again running make command from
yuvraj@ubuntu:~/go/src/github.com/radoondas/elasticbeat$ make
gives following error:-

/usr/lib/go/src/pkg/github.com/elastic/beats/libbeat/outputs/kafka/client.go:10:2: cannot find package "github.com/Shopify/sarama" in any of:
/usr/lib/go/src/pkg/github.com/Shopify/sarama (from $GOROOT)
/home/yuvraj/go/src/github.com/Shopify/sarama (from $GOPATH)
/usr/lib/go/src/pkg/github.com/elastic/beats/libbeat/outputs/elasticsearch/client.go:16:2: cannot find package "github.com/dustin/go-humanize" in any of:
/usr/lib/go/src/pkg/github.com/dustin/go-humanize (from $GOROOT)
/home/yuvraj/go/src/github.com/dustin/go-humanize (from $GOPATH)
/usr/lib/go/src/pkg/github.com/elastic/beats/libbeat/outputs/redis/client.go:10:2: cannot find package "github.com/garyburd/redigo/redis" in any of:
/usr/lib/go/src/pkg/github.com/garyburd/redigo/redis (from $GOROOT)
/home/yuvraj/go/src/github.com/garyburd/redigo/redis (from $GOPATH)
/usr/lib/go/src/pkg/github.com/elastic/beats/libbeat/common/geolite.go:9:2: cannot find package "github.com/nranchev/go-libGeoIP" in any of:
/usr/lib/go/src/pkg/github.com/nranchev/go-libGeoIP (from $GOROOT)
/home/yuvraj/go/src/github.com/nranchev/go-libGeoIP (from $GOPATH)
/usr/lib/go/src/pkg/github.com/elastic/beats/libbeat/beat/beat.go:51:2: cannot find package "github.com/satori/go.uuid" in any of:
/usr/lib/go/src/pkg/github.com/satori/go.uuid (from $GOROOT)
/home/yuvraj/go/src/github.com/satori/go.uuid (from $GOPATH)
/usr/lib/go/src/pkg/github.com/elastic/beats/libbeat/common/config.go:4:2: cannot find package "github.com/urso/ucfg" in any of:
/usr/lib/go/src/pkg/github.com/urso/ucfg (from $GOROOT)
/home/yuvraj/go/src/github.com/urso/ucfg (from $GOPATH)
/usr/lib/go/src/pkg/github.com/elastic/beats/libbeat/common/config.go:5:2: cannot find package "github.com/urso/ucfg/yaml" in any of:
/usr/lib/go/src/pkg/github.com/urso/ucfg/yaml (from $GOROOT)
/home/yuvraj/go/src/github.com/urso/ucfg/yaml (from $GOPATH)
/usr/lib/go/src/pkg/github.com/elastic/beats/libbeat/outputs/transport/proxy.go:8:2: cannot find package "golang.org/x/net/proxy" in any of:
/usr/lib/go/src/pkg/golang.org/x/net/proxy (from $GOROOT)
/home/yuvraj/go/src/golang.org/x/net/proxy (from $GOPATH)
make: *** [build] Error 1


(Magnus Bäck) #2

I'm pretty sure all Beats require Go 1.5.


(Yuvraj Gupta) #3

Thanks, it solved the problem.
Just curious to know whether is it mentioned anywhere in about the same for GO version as i never read and encountered such issue.


(Magnus Bäck) #4

Not sure if it's explicitly mentioned as a requirement, but https://github.com/elastic/beats/blob/master/CONTRIBUTING.md states that the current development environment uses Go 1.6.2.


(Yuvraj Gupta) #5

I never accessed that page as I was just trying to run a community beat. Thanks for the help :slight_smile:


(system) #6