Einrichtung neuer IONOS VPS XS Server ## (1) Neuen User anlegen ##geouser ##geouserpasswort sudo adduser geouser; sudo usermod -aG sudo geouser ## Prüfen der ROOT Berechtigung su - geouser sudo ls / ## Ausloggen exit exit ##---------------------------------------------------------------------------------------- ##---------------------------------------------------------------------------------------- ##---------------------------------------------------------------------------------------- ## und mit neuem PUTTY Fenster als geouser wieder einloggen!!!! sudo apt update; sudo apt upgrade -y; ## Anmerkung: sshd config behalten bestätigen "keep the local version currently installed" ##--------------- Prerequisits installieren Start ## Anleitung: https://docs.lizmap.com/3.8/en/install/py-qgis-server.html ## ---------------- ## We supposed, you already have installed QGIS Server packages, as explain in the QGIS Server documentation. ## ## ## QGIS >= 3.22 installed ## ## ** Installation entsprechend: https://qgis.org/resources/installation-guide/#debian--ubuntu ## ** Kurzer ausflug nach hier: https://qgis.org/resources/installation-guide/#available-codenames sudo wget https://download.qgis.org/downloads/qgis-archive-keyring.gpg; sudo gpg --no-default-keyring --keyring ./qgis-archive-keyring.gpg --list-keys; ## **After you have verified the output you can install the key with: sudo cp qgis-archive-keyring.gpg /etc/apt/keyrings/qgis-archive-keyring.gpg; ## ** With the keyring in place you can add the repository as /etc/apt/sources.list.d/qgis.sources with following content: sudo nano /etc/apt/sources.list.d/qgis.sources ## Folgenden Inhalt einfügen und sichern ## ------------- Inhalt ------------------------ Types: deb deb-src URIs: https://qgis.org/ubuntu-ltr Suites: noble Architectures: amd64 Components: main Signed-By: /etc/apt/keyrings/qgis-archive-keyring.gpg ## ------------------------------------- ## ** After that type the commands below to install QGIS: ## ** In case you would like to install QGIS Server, type: sudo apt update; sudo apt install qgis-server --no-install-recommends --no-install-suggests -y ## #Check QGIS Server version (optional) sudo apt-cache policy qgis-server ## # Test if QGIS server is running: /usr/lib/cgi-bin/qgis_mapserv.fcgi ## ---------- folgendes wird ausgegeben --------------------- geouser@ubuntu:~$ /usr/lib/cgi-bin/qgis_mapserv.fcgi Application path not initialized Application path not initialized Application path not initialized Application path not initialized Warning 1: Unable to find driver ECW to unload from GDAL_SKIP environment variable. Warning 1: Unable to find driver ECW to unload from GDAL_SKIP environment variable. Warning 1: Unable to find driver JP2ECW to unload from GDAL_SKIP environment variable. "Loading native module /usr/lib/qgis/server/liblandingpage.so" "Loading native module /usr/lib/qgis/server/libwcs.so" "Loading native module /usr/lib/qgis/server/libwfs.so" "Loading native module /usr/lib/qgis/server/libwfs3.so" "Loading native module /usr/lib/qgis/server/libwms.so" "Loading native module /usr/lib/qgis/server/libwmts.so" Content-Length: 0 Location: http:/index.json Server: QGIS FCGI server - QGIS version 3.40.6-Bratislava Status: 302 ## ----------------------------------------------------------- ## ** QGIS Server sollte nun installiert sein! ##---------------------------------------------------------------------------------------- ## Im weiteren Verlauf wird PIP benötigt, daher nun: sudo apt install pip -y; ##---------------------------------------------------------------------------- ## Hier sollten alle Prerequisits installiert sein! ##---------------------------------------------------------------------------- ## Install in a Python venv ## ## We add needed packages not provided with QGIS Server : sudo apt install python3-venv python3-psutil -y; ## Then, we create the Py-QGIS-Server virtual environment and install py-qgis-server with pip : set -e; sudo python3 -m venv /opt/local/py-qgis-server --system-site-packages ## Beobachtung: Hier stürzte putty manchmal ab, in dem Fall putty neustart, neu einloggen und nochmals ausführen!! sudo python3 -m venv /opt/local/py-qgis-server --system-site-packages; sudo /opt/local/py-qgis-server/bin/pip install -U pip setuptools wheel pysocks typing py-qgis-server ## ---------- Führt zu folgender Ausgabe --------------- ## ## Attempting uninstall: pip ## Found existing installation: pip 24.0 ## Uninstalling pip-24.0: ## Successfully uninstalled pip-24.0 ## Successfully installed pip-25.1.1 py-qgis-server-1.9.4 pysocks-1.7.1 pyzmq-26.4.0 setuptools-80.3.1 tornado-6.4.2 typing-3.7.4.3 wheel-0.45.1 ## ## ----------------------------------------------------- ## Py-QGIS-Server is installed. ## Configuration and associated files ## Folders used below sudo mkdir -p /srv/qgis/plugins /srv/qgis/config /var/log/qgis /var/lib/py-qgis-server /srv/data; ## The file to watch for restarting workers ## We create an empty file that will be watch by Py-QGIS-Server to check when to restart QGIS Server map workers. sudo touch /var/lib/py-qgis-server/py-qgis-restartmon; sudo chmod 664 /var/lib/py-qgis-server/py-qgis-restartmon; ## The bash file to restart workers ## We create the executable file /usr/bin/qgis-reload to restart QGIS Server map workers. It will contain: sudo nano /usr/bin/qgis-reload ------------ Inhalt ---------------------- #!/bin/bash touch /var/lib/py-qgis-server/py-qgis-restartmon ------------------------------------------ ## Then we when change its mod : sudo chmod 750 /usr/bin/qgis-reload; ## The configuration file ## We create the Py-QGIS-Server configuration file /srv/qgis/server.conf. It will contain: sudo nano /srv/qgis/server.conf ------------ Inhalt ---------------------- # # Py-QGIS-Server configuration # https://docs.3liz.org/py-qgis-server/ # [server] port = 7200 interfaces = 127.0.0.1 workers = 4 pluginpath = /srv/qgis/plugins timeout = 200 restartmon = /var/lib/py-qgis-server/py-qgis-restartmon [logging] level = info [projects.cache] strict_check = false rootdir = /srv/data size = 50 advanced_report = no [monitor:amqp] routing_key = default_routing_key= host = [api.endpoints] lizmap_api=/lizmap [api.enabled] lizmap_api=yes ------------------------------------------ ## Manage it with systemd ## First of all, we create an environment file /srv/qgis/config/qgis-service.env with sudo nano /srv/qgis/config/qgis-service.env ------------ Inhalt ---------------------- LC_ALL=en_US.UTF-8 LANG=en_US.UTF-8 DISPLAY=:99 QGIS_OPTIONS_PATH=/srv/qgis/ QGIS_AUTH_DB_DIR_PATH=/srv/qgis/ GDAL_CACHEMAX=2048 QGIS_SERVER_CACHE_SIZE=2048 QGIS_SERVER_LIZMAP_REVEAL_SETTINGS=TRUE QGIS_SERVER_FORCE_READONLY_LAYERS=TRUE QGIS_SERVER_TRUST_LAYER_METADATA=TRUE QGIS_SERVER_APPLICATION_NAME=qgis-server ------------------------------------------ ## Then we can create the QGIS service systemd file /etc/systemd/system/qgis.service with sudo nano /etc/systemd/system/qgis.service ------------ Inhalt ---------------------- [Unit] Description=QGIS server After=network.target [Service] Type=simple ExecStart=/opt/local/py-qgis-server/bin/qgisserver -c /srv/qgis/server.conf # FIXME it is recommended to have a script *synchronous*, which is not the case here ExecReload=/usr/bin/qgis-reload KillMode=control-group KillSignal=SIGTERM TimeoutStopSec=10 Restart=always StandardOutput=append:/var/log/qgis/qgis-server.log StandardError=inherit SyslogIdentifier=qgis EnvironmentFile=/srv/qgis/config/qgis-service.env User=root LimitNOFILE=4096 [Install] WantedBy=multi-user.target ------------------------------------------ ## Finally, we enable the QGIS Server service to start it and to be sure it is started at system launch : sudo systemctl enable qgis; sudo service qgis start; sudo service qgis status ## Das führt zu folgendem: ## ----------------------------------------------------------------------- ● qgis.service - QGIS server Loaded: loaded (/etc/systemd/system/qgis.service; enabled; preset: enabled) Active: active (running) since Sat 2025-05-10 15:31:53 UTC; 45ms ago Main PID: 25500 (qgisserver) Tasks: 1 (limit: 977) Memory: 4.2M (peak: 4.4M) CPU: 18ms CGroup: /system.slice/qgis.service └─25500 /opt/local/py-qgis-server/bin/python3 /opt/local/py-qgis-s> May 10 15:31:53 ubuntu systemd[1]: Started qgis.service - QGIS server. ## -------------------------------------------------------------------- ## 1. We can check that QGIS Server with Py-QGIS-Server is working with : curl http://127.0.0.1:7200/ows/ sudo curl http://127.0.0.1:7200/ows/ #mit oder ohne sudo ## Das führt zu folgendem: ## ----------------------------------------------------------------------- geouser@ubuntu:/var/data$ curl http://127.0.0.1:7200/ows/ curl: (52) Empty reply from server ## -------------------------------------------------------------------- ## --------------------- Server läuft!! --------------------- ## Jetzt für Lizmap das LIZMAP QGIS Server Plugin installieren ## Pfad des plugins Verzeichnis ist: /srv/qgis/plugins ## Quelle: https://github.com/3liz/qgis-lizmap-server-plugin/releases/download/2.13.1/lizmap_server.2.13.1.zip ## install unzip sudo apt -yq install unzip; cd /srv/qgis/plugins; sudo wget https://github.com/3liz/qgis-lizmap-server-plugin/releases/download/2.13.1/lizmap_server.2.13.1.zip; ## Unzip archive sudo unzip lizmap_server.2.13.1.zip; ## Remove archive sudo rm lizmap_server.2.13.1.zip; # Rechte und Dateibesitzer neu setzen für AX101 sudo chmod 755 /srv/qgis/plugins/ -R; sudo chown www-data:www-data /srv/qgis/plugins/ -R; ## QGIS Server restart sudo service qgis restart; sudo service qgis status ## 1. We can check that QGIS Server with Py-QGIS-Server is working with : curl http://127.0.0.1:7200/ows/ sudo curl http://127.0.0.1:7200/ows/ #mit oder ohne sudo ## --------------------- Server läuft!! Jetzt mit Lizmap Server Plugin!! --------------------- ## ---------------- Nach runterlasen nun Lizmap installieren ## Da PHP benötigt wird muss das auch noch installiert werdden!! # php version: sudo apt -yq install php; sudo apt -yq install php8.3-xml php8.3-sqlite3; sudo php -version -y #configure locales sudo locale-gen de_DE.UTF-8 sudo dpkg-reconfigure locales # currently unchanged ## ------- PHP fertig ------- ## Quelle: https://github.com/3liz/lizmap-web-client ### Install Lizmap Client: Download: ## /var/www und /var/www/html anlegen ## Folders used below sudo mkdir -p /var/www /var/www/html; VERSION=3.8.8; LOCATION=/var/www; cd $LOCATION; sudo wget https://github.com/3liz/lizmap-web-client/releases/download/$VERSION/lizmap-web-client-$VERSION.zip; ## Unzip archive sudo unzip lizmap-web-client-$VERSION.zip; ## Any folder can used instead of the lizmap folder, e.E. lizmapv1 sudo mv lizmap-web-client-$VERSION lizmap-web-client-home; ## virtual link for http://localhost/lizmap/ sudo ln -s $LOCATION/lizmap-web-client-home/lizmap/www/ /var/www/html/lizmap; ## Remove archive sudo rm lizmap-web-client-$VERSION.zip; # Rechte korrigieren cd /var/www/lizmap-web-client-home; sudo lizmap/install/set_rights.sh www-data www-data; cd /var/www/lizmap-web-client-home/lizmap/var/config; sudo cp profiles.ini.php.dist profiles.ini.php; sudo cp lizmapConfig.ini.php.dist lizmapConfig.ini.php; sudo cp localconfig.ini.php.dist localconfig.ini.php; ## Hier sind die Installer!!!: /var/www/lizmap-web-client-home/lizmap/install ## Zurück zu Lizmap /var/www/lizmap-web-client-home root directory cd /var/www/lizmap-web-client-home; ##To finish the installation, run again the installer of Lizmap: ## Actual Lizmap installation ## sudo php lizmap/install/configurator.php # Auskommentiert, da keine Module benötigt!! sudo php lizmap/install/installer.php; sudo lizmap/install/clean_vartmp.sh; sudo lizmap/install/set_rights.sh www-data www-data ## Adapt the Lizmap Web Client configuration ## Either by editing manually the file lizmap/var/config/lizmapConfig.ini.php or by changing in Lizmap Web Client GUI: sudo nano lizmap/var/config/lizmapConfig.ini.php ## Das sieht dann so aus: ## ---------------------------------------------------------------------------- [services] ;URL to QGIS Server for OGC web services wmsServerURL="http://127.0.0.1:7200/ows/" ;WMS subdomain URLs list (optional) wmsPublicUrlList= ;URL to the API exposed by the Lizmap plugin for QGIS Server if needed lizmapPluginAPIURL="http://127.0.0.1:7200/lizmap/" onlyMaps=0 defaultRepository= defaultProject= ; path to find repositories rootRepositories="/srv/data" ; Use relative path # Quelle: https://github.com/3liz/py-qgis-server aber 1 statt true relativeWMSPath=1 ## --------------------------------------------------------------------------- ## Debug and check ## Tip ## 2. After the installation of Lizmap Server QGIS plugin, we can check with : curl http://127.0.0.1:7200/lizmap/server.json | jq '.' Read QGIS Server plugins with the use of QGIS-Plugin-Manager. ## Lizmap aktivieren durch QGIS Server restart sudo service qgis restart; sudo service qgis status curl http://127.0.0.1:7200/lizmap/ Your Server information panel must show you the QGIS Server version and installed plugins.