-
Notifications
You must be signed in to change notification settings - Fork 0
Server side installation
sudo apt-get update
sudo apt-get -y install python3-pip
sudo apt-get install libapache2-mod-wsgi-py3
Install GDAL (it works without virtualenv, so in case of installing in virtualenv could be a problem)
sudo add-apt-repository -y ppa:ubuntugis/ppa
sudo apt update
sudo apt upgrade
sudo apt install gdal-bin python-gdal python3-gdal
`pip3 install GDAL' # for verify or in case of virtualenv used
Preconditions:
check version: sudo lsb_release -a
for xenial : sudo sh -c 'echo "deb http://apt.postgresql.org/pub/repos/apt xenial-pgdg main" >> /etc/apt/sources.list'
adding keys: wget --quiet -O - http://apt.postgresql.org/pub/repos/apt/ACCC4CF8.asc | sudo apt-key add -
update : sudo apt update
sudo apt install postgresql-11
sudo apt install postgresql-11-postgis-2.4
sudo apt install postgresql-11-postgis-scripts
to get the commandline tools shp2pgsql, raster2pgsql you need to do this:
sudo apt install postgis
Install pgRouting 2.6 package:
sudo apt install postgresql-10-pgrouting
** Never install PostGIS in the postgres database, create a user database **
sudo -u postgres psql
CREATE EXTENSION adminpack;
CREATE DATABASE gisdb;
\connect gisdb;
CREATE SCHEMA postgis;
ALTER DATABASE gisdb SET search_path=public, postgis, contrib;
\connect gisdb; -- this is to force new search path to take effect
CREATE EXTENSION postgis SCHEMA postgis;
CREATE EXTENSION postgis_sfcgal SCHEMA postgis; if you need advanced 3D support
CREATE EXTENSION pgrouting SCHEMA postgis;
ALTER SYSTEM SET listen_addresses='*';
\q exit
Edit config for allows connections from outside :
sudo nano /etc/postgresql/11/main/pg_hba.conf
add at the end of file:
host all all 0.0.0.0/0 md5
Also postgresql.conf can be reviewed for allow connection from "*" not "localhost"
Restart service:
sudo service postgresql restart
for add password for user or add user :
sudo -u postgres psql
postgres=# \password
Enter new password:
Enter it again:
postgres=#
additional information you can find at : http://trac.osgeo.org/postgis/wiki/UsersWikiPostGIS24UbuntuPGSQL10Apt
sudo apt-get install git
https://certbot.eff.org/ Note: do the certificate install prior to config apache Django WSGI in this case it will be done authomaticaly
<VirtualHost *:80>
ServerName aqa.science
#ServerAdmin webmaster@localhost
#DocumentRoot /var/www/html
WSGIDaemonProcess main user=www-data group=www-data threads=5
WSGIScriptAlias / /home/<user>/map_aqa_science/aqa_science/wsgi.py
<Directory /home/<user>/map_aqa_science/>
WSGIProcessGroup main
WSGIApplicationGroup %{GLOBAL}
WSGIScriptReloading On
Require all granted
</Directory>
Alias /media/ /var/www/media/
Alias /static/ /home/<user>/map_aqa_science/static/
<Directory /home/<user>/map_aqa_science/static>
Require all granted
</Directory>
<Directory /var/www/media>
Require all granted
</Directory>
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined