#! /bin/bash ADName=adis85_gis_astra-1.7.tar.gz ADPath=/root/adis_gis if test $(whoami) != "root" ; then echo "You are not root" exit 1 fi echo ADIS_GIS setup. Continue [N/y] read yn if [ -z "$yn" ]; then yn="n" fi if [ $yn != "y" ] && [ $yn != "Y" ]; then echo "User break" exit 0 fi OS_VER_ID=`sed -n '/VERSION_ID/p' /etc/os-release | cut -d= -f2 | cut -d_ -f1` OS_VER_ID=`echo -n $OS_VER_ID` if [ $OS_VER_ID != "1.7" ]; then echo "OS_VER_ID=$OS_VER_ID не есть Астра 1.7" exit 0 fi mkdir $ADPath tar xvfz $ADName -C $ADPath if [ ! -f $ADPath/pbf/*.pbf ]; then echo "PBF-file is absent" exit 0 fi systemctl stop renderd &> /dev/null echo Copy big files. Wait..... cp -fv Nominatim* $ADPath 2> /dev/null cp -fv osm-carto.tar $ADPath 2> /dev/null cd $ADPath dpkg -i deb/* echo AstraMode off >> /etc/apache2/apache2.conf useradd -m -s /bin/bash -d /srv/nominatim nominatim chmod a+rx /srv/nominatim usermac -m0:0 -c0:0 nominatim tar xfz Nominatim-build.tar.gz -C /srv/nominatim tar xvfz conf4nm.tar.gz cp -fv conf4nm/local.php /srv/nominatim/Nominatim/build/settings cat conf4nm/postgresql.conf.add >> /etc/postgresql/11/main/postgresql.conf usermod -a -G shadow postgres setfacl -d -m u:postgres:r /etc/parsec/macdb setfacl -R -m u:postgres:r /etc/parsec/macdb setfacl -m u:postgres:rx /etc/parsec/macdb setfacl -d -m u:postgres:r /etc/parsec/capdb setfacl -R -m u:postgres:r /etc/parsec/capdb setfacl -m u:postgres:rx /etc/parsec/capdb systemctl restart postgresql sudo -u postgres createuser -s nominatim &> /dev/null sudo -u postgres createuser www-data &> /dev/null usermac -m0:0 -c0:0 www-data cp -fv conf4nm/nominatim.conf /etc/apache2/conf-available a2enconf nominatim systemctl restart apache2 cp -rpv pbf /usr/local/share chmod 666 /usr/local/share/pbf/* su - nominatim -c "dropdb nominatim" &> /dev/null su - nominatim -c "cd /srv/nominatim/Nominatim/build; ./utils/setup.php --osm-file /usr/local/share/pbf/*" # установка и настройка mod_tile и renderd tar xvfz bin4osm.tar.gz -C / ln -s /usr/lib/apache2/modules/libphp7.3.so /usr/lib/apache2/modules/libphp7.so a2enconf mod_tile systemctl restart apache2 useradd -m -s /bin/bash -d /srv/osm osm chmod a+rx /srv/osm usermac -m0:0 -c0:0 osm rm -rf /var/lib/mod_tile &> /dev/null mkdir /var/lib/mod_tile chown osm:osm /var/lib/mod_tile tar xf osm-carto.tar -C /srv/osm sudo -u postgres createuser -s osm &> /dev/null su - postgres -c "dropdb gis" &> /dev/null su - postgres -c "createdb -E UTF8 -O osm gis" su - postgres -c "psql -d gis -c 'CREATE EXTENSION postgis;'" su - postgres -c "psql -d gis -c 'ALTER TABLE geometry_columns OWNER TO osm;'" su - postgres -c "psql -d gis -c 'ALTER TABLE spatial_ref_sys OWNER TO osm;'" su - osm -c "cd /srv/nominatim/Nominatim/build; osm2pgsql/osm2pgsql -U osm --slim -C 1500 --number-processes 4 -d gis --drop -S /srv/osm/openstreetmap-carto-2.29.1/openstreetmap-carto.style /usr/local/share/pbf/*" su - osm -c "cd /srv/osm/openstreetmap-carto-2.29.1; ./get-shapefiles-local.sh" RENDCONF=/usr/local/etc/renderd.conf sed -i 's/^XML=.*/XML=\/srv\/osm\/openstreetmap-carto-2\.29\.1\/style\.xml/' $RENDCONF sed -i 's/^HOST=.*/HOST=localhost/' $RENDCONF sed -i 's/mapnik\/input/mapnik\/3\.0\/input/' $RENDCONF ln -s /usr/local/lib/libiniparser.so.3.0.0 /usr/lib/libiniparser.so.3 systemctl enable renderd systemctl enable apache2 CITY_NAME=`sed -n /CITY_NAME/p /root/adis.info | cut -d= -f2` /server/www/html/utils/get-center-map --search="$CITY_NAME" --ip=localhost --save echo "Done. Need to reboot the System..." #read #reboot