-
Notifications
You must be signed in to change notification settings - Fork 0
/
install-influxdb.sh
executable file
·39 lines (33 loc) · 1.02 KB
/
install-influxdb.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#!/bin/bash
set -e
function print-banner () {
local message="$1"
echo "##################################"
echo "$message"
echo "##################################"
}
function ensure-dependencies () {
print-banner "Ensuring dependencies"
./dependencies.sh "apt-transport-https" "curl"
}
function add-influxdb-repo-conf () {
print-banner "Adding configuration for influxdb repository"
curl -sL https://repos.influxdata.com/influxdb.key | sudo apt-key add -
source /etc/lsb-release
echo "deb https://repos.influxdata.com/${DISTRIB_ID,,} ${DISTRIB_CODENAME} stable" | sudo tee /etc/apt/sources.list.d/influxdb.list
}
function main () {
print-banner "Updating apt sources list"
sudo apt-get update
print-banner "Installing Influxdb"
sudo apt-get install -y influxdb
print-banner "Starting influxdb service"
sudo service influxdb start
}
if [ "$UID" -ne 0 ] ; then
echo "Please run as root"
else
ensure-dependencies
add-influxdb-repo-conf
main "$@"
fi