2018-10-10 08:46:09 +02:00
|
|
|
#! /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 08:46:09 +02:00
|
|
|
##
|
2018-10-10 20:48:48 +02:00
|
|
|
|
2019-02-12 10:17:15 +01:00
|
|
|
WORKDIR=$(pwd)
|
|
|
|
|
2018-10-10 20:48:48 +02:00
|
|
|
echo ""
|
2021-01-25 08:15:23 +01:00
|
|
|
echo "Creating virtual ENV and install all needed requirements..."
|
2018-10-10 20:48:48 +02:00
|
|
|
sleep 1
|
2021-01-25 08:15:23 +01:00
|
|
|
python3 -m venv venv && source venv/bin/activate
|
2018-10-10 20:48:48 +02:00
|
|
|
|
2021-01-25 08:15:23 +01:00
|
|
|
pip3 install -r requirements.txt && deactivate
|
2018-10-10 08:46:09 +02:00
|
|
|
|
2018-10-10 09:56:13 +02:00
|
|
|
echo ""
|
2021-01-25 08:15:23 +01:00
|
|
|
echo "Please edit settings.ini file and set the needed parameters..."
|
2018-10-10 09:56:13 +02:00
|
|
|
sleep 1
|
2018-10-10 08:46:09 +02:00
|
|
|
cp settings.ini.back settings.ini
|
|
|
|
|
|
|
|
"${VISUAL:-"${EDITOR:-vi}"}" "settings.ini"
|
|
|
|
|
2018-10-10 09:56:13 +02:00
|
|
|
echo ""
|
2021-01-25 08:15:23 +01:00
|
|
|
echo "Installing GeoStat SystemD service..."
|
2018-10-10 09:56:13 +02:00
|
|
|
sleep 1
|
2018-10-10 08:46:09 +02:00
|
|
|
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 ""
|
2021-01-25 08:15:23 +01:00
|
|
|
echo "Last step, you need to register and download the lates GeoLite2 City mmdb file from the maxmind.com website"
|
|
|
|
echo "After you get an account on the maxmind.com you can find the needed file by the link below"
|
|
|
|
echo "https://www.maxmind.com/en/accounts/YOURACCOUNTID/geoip/downloads"
|
|
|
|
echo "Please don't forget to unzip and put the GeoLite2-City.mmdb file in the same directory with the geoparse.py"
|
2021-01-25 21:59:44 +01:00
|
|
|
echo "script, or you can put it enywhere and then fix the path in the settings.ini"
|
2021-01-25 08:15:23 +01:00
|
|
|
|
|
|
|
echo ""
|
|
|
|
echo "Good, all was done and you can start getting GEO data from your Nginx/Apache log file now"
|
|
|
|
echo "Please run 'systemctl start geostat.service' for starting the GeoStat script"
|
|
|
|
echo "You can find the GeoStat application logs in the syslog file if you need"
|
2018-10-10 09:30:56 +02:00
|
|
|
echo "Good Luck !"
|