Skip to content

Instantly share code, notes, and snippets.

@ssc-
Last active January 16, 2017 08:17
Show Gist options
  • Save ssc-/62efb1000bd67e76fdfe to your computer and use it in GitHub Desktop.
Save ssc-/62efb1000bd67e76fdfe to your computer and use it in GitHub Desktop.
Setup InfluxDB on FreeBSD

This is how I got InfluxDB (last stable - 0.8.8) working on FreeBSD 9.3-RELEASE-p9

First make sure sed resolves to gsed, than you don't have to patch that many files .. I solved it this way:

mkdir ~/bin
ln -sf /usr/local/bin/gsed ~/bin/sed
export PATH=~/bin:$PATH

Install required pkgs, setup env and download source.

Notes:

  • I have no idea why benchmark-storage is not included in the original src package; therefore we copy it from github
  • -DMDB_DSYNC=O_SYNC will fix error: use of undeclared identifier 'O_DSYNC'
pkg install bison flex leveldb protobuf gmake ruby  bzr mercurial valgrind
export GOPATH="$HOME/code/go"
export GOOS=freebsd
export CGO_CFLAGS="-I/usr/local/include -DMDB_DSYNC=O_SYNC"
export CGO_LDFLAGS="-L/usr/local/lib" 

mkdir -p code/go/tmp
cd ~/code/go/tmp

wget https://s3.amazonaws.com/get.influxdb.org/influxdb-0.8.8.src.tar.gz
wget https://codeload.github.com/influxdb/influxdb/tar.gz/v0.8.8 -O influxdb.tar.gz

tar xzfv influxdb.tar.gz

cd ~/code/go
tar xzfv tmp/influxdb-0.8.8.src.tar.gz

cd src/github.com/influxdb/influxdb/
cp -r ~/code/go/tmp/influxdb-0.8.8/tools/benchmark-storage tools/

After modifying SHELL influxdb will build and pass all tests:

sed -i -e 's,SHELL = /bin/,SHELL = /usr/bin/env ,' Makefile.in

./configure --with-flex=/usr/local/bin/flex --with-bison=/usr/local/bin/bison
gmake

Output:

$ gmake
gmake -C parser
gmake[1]: Entering directory '/home/influxdb/code/go/src/github.com/influxdb/influxdb/parser'
gmake[1]: Nothing to be done for 'all'.
gmake[1]: Leaving directory '/home/influxdb/code/go/src/github.com/influxdb/influxdb/parser'
/usr/local/bin/go get  -d -t github.com/influxdb/influxdb/...
rm -f protocol/*.pb.go
PATH=/home/influxdb/code/go/src/github.com/influxdb/influxdb/../../../../bin:$PATH /usr/local/bin/protoc --go_out=. protocol/*.proto
/usr/local/bin/go test github.com/influxdb/influxdb/admin github.com/influxdb/influxdb/api github.com/influxdb/influxdb/api/collectd github.com/influxdb/influxdb/api/graphite github.com/influxdb/influxdb/api/http github.com/influxdb/influxdb/api/udp github.com/influxdb/influxdb/checkers github.com/influxdb/influxdb/client github.com/influxdb/influxdb/client/examples github.com/influxdb/influxdb/cluster github.com/influxdb/influxdb/common github.com/influxdb/influxdb/configuration github.com/influxdb/influxdb/coordinator github.com/influxdb/influxdb/daemon github.com/influxdb/influxdb/datastore github.com/influxdb/influxdb/datastore/storage github.com/influxdb/influxdb/engine github.com/influxdb/influxdb/metastore github.com/influxdb/influxdb/parser github.com/influxdb/influxdb/protocol github.com/influxdb/influxdb/server github.com/influxdb/influxdb/statik github.com/influxdb/influxdb/wal -test.timeout=20m
ok  	github.com/influxdb/influxdb/admin	0.020s
?   	github.com/influxdb/influxdb/api	[no test files]
ok  	github.com/influxdb/influxdb/api/collectd	0.023s
?   	github.com/influxdb/influxdb/api/graphite	[no test files]
ok  	github.com/influxdb/influxdb/api/http	1.070s
?   	github.com/influxdb/influxdb/api/udp	[no test files]
?   	github.com/influxdb/influxdb/checkers	[no test files]
?   	github.com/influxdb/influxdb/client	[no test files]
?   	github.com/influxdb/influxdb/client/examples	[no test files]
ok  	github.com/influxdb/influxdb/cluster	0.547s
ok  	github.com/influxdb/influxdb/common	0.016s
ok  	github.com/influxdb/influxdb/configuration	0.018s
ok  	github.com/influxdb/influxdb/coordinator	1.133s
?   	github.com/influxdb/influxdb/daemon	[no test files]
ok  	github.com/influxdb/influxdb/datastore	0.044s
?   	github.com/influxdb/influxdb/datastore/storage	[no test files]
ok  	github.com/influxdb/influxdb/engine	0.022s
?   	github.com/influxdb/influxdb/metastore	[no test files]
ok  	github.com/influxdb/influxdb/parser	0.032s
ok  	github.com/influxdb/influxdb/protocol	0.012s
?   	github.com/influxdb/influxdb/server	[no test files]
?   	github.com/influxdb/influxdb/statik	[no test files]
ok  	github.com/influxdb/influxdb/wal	18.230s
echo "package main"										 > daemon/version.go
echo "const version = \""dev"\"" >> daemon/version.go
echo "const gitSha = \"afde71e\""     >> daemon/version.go
/usr/local/bin/go build -o influxdb  github.com/influxdb/influxdb/daemon
/usr/local/bin/go test github.com/influxdb/influxdb/integration -test.timeout=20m
ok  	github.com/influxdb/influxdb/integration	635.765s
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment