apt update
apt -y dist-upgrade

####################################################################
# Be sure to get OSS version. The "Elastic License" is a non-free, proprietary license.
# 

apt update
apt install openjdk-8-jre-headless

# Install logstash
# Disable apt-cache in /etc/apt/apt.conf, it doesn't work with https
wget -qO - https://artifacts.elastic.co/GPG-KEY-elasticsearch | sudo apt-key add -
echo "deb https://artifacts.elastic.co/packages/6.x/apt stable main" | sudo tee -a /etc/apt/sources.list.d/elastic-6.x.list
# Disable apt cache in /etc/apt/apt.conf
apt update
# XXX Note the "kibana" package is non-free. Use the -oss package!
# XXX NOTE, the kibana-oss in the repo is old, so you have to get it manually:
#apt-get install kibana-oss
wget https://artifacts.elastic.co/downloads/kibana/kibana-oss-6.3.2-amd64.deb
dpkg -i kibana-oss-6.3.2-amd64.deb

# Edit config:
vim /etc/kibana/kibana.yml
#
server.host: "10.22.22.123"
server.name: "kibana1"
elasticsearch.url: "http://10.22.22.124:9200"

# Start:
systemctl start kibana.service

# Open firewall
-A INPUT -p tcp --dport 5601 -j ACCEPT

# Start on boot:
systemctl enable kibana.service

### XXX Backups
### XXX Prometheus :)

# View on web through tunnel:
http://10.22.22.123:5601
