geostat/install.sh

47 lines
1 KiB
Bash
Raw Normal View History

#! /usr/bin/env bash
##
2018-10-10 21:17:03 +02:00
## Installation script for GeoStat
2018-10-10 09:30:56 +02:00
## Alexey Nizhegolenko 2018
##
2018-10-10 20:48:48 +02:00
WORKDIR=$(pwd)
2018-10-10 20:48:48 +02:00
echo ""
echo "Downloading latest GeoLiteCity.dat from MaxMind"
sleep 1
wget https://geolite.maxmind.com/download/geoip/database/GeoLite2-City.tar.gz
mkdir tmpgeo
tar -xvf GeoLite2-City.tar.gz -C ./tmpgeo && cd ./tmpgeo/*/.
cp ./GeoLite2-City.mmdb $WORKDIR
cd $WORKDIR
2018-10-10 20:48:48 +02:00
2018-10-10 09:56:13 +02:00
echo ""
echo "Creating virtual ENV and installing requirements..."
2018-10-10 09:30:56 +02:00
sleep 1
2018-10-10 09:56:13 +02:00
virtualenv venv && source venv/bin/activate
2018-10-10 09:30:56 +02:00
pip install -r requirements.txt && deactivate
2018-10-10 09:56:13 +02:00
echo ""
2018-10-10 09:30:56 +02:00
echo "Please edit settings.ini file and set right parameters..."
2018-10-10 09:56:13 +02:00
sleep 1
cp settings.ini.back settings.ini
"${VISUAL:-"${EDITOR:-vi}"}" "settings.ini"
2018-10-10 09:56:13 +02:00
echo ""
2018-10-10 09:30:56 +02:00
echo "Installing SystemD service..."
2018-10-10 09:56:13 +02:00
sleep 1
while read line
do
eval echo "$line"
done < "./geostat.service.template" > /lib/systemd/system/geostat.service
systemctl enable geostat.service
2018-10-10 09:56:13 +02:00
echo ""
echo "All done, now you can start getting GEO data from your log"
2018-10-10 09:56:13 +02:00
echo "run 'systemctl start geostat.service' for this"
2018-10-10 09:30:56 +02:00
echo "Good Luck !"