Skip to content

Instantly share code, notes, and snippets.

@fgianoli
Last active November 14, 2022 17:17
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save fgianoli/c2893b43f8769c24399d312a3d135a9e to your computer and use it in GitHub Desktop.
Save fgianoli/c2893b43f8769c24399d312a3d135a9e to your computer and use it in GitHub Desktop.
Installazione Lizmap

Installazione Lizmap

sudo su

install apache2

apt install apache2

ensure to have PHP installed and all required extensions:

add-apt-repository -y ppa:ondrej/php && sudo apt update && apt install -y php7.4-mbstring php7.4-zip php7.4-xml

change the extension according to your php version installed

apt install php7.4
apt install xvfb

apt install libsqlite3-0 libsqlite3-dev
apt install php7.4-sqlite3

First of all install QGIS Server

check ubuntu version:

lsb_release -a

aggiungere nel file /etc/apt/sources.list le righe

nano /etc/apt/sources.list

if Ubuntu 20.04

deb     https://qgis.org/ubuntu focal main
deb-src https://qgis.org/ubuntu focal main

if Ubuntu 20.10

deb     https://qgis.org/ubuntu groovy main
deb-src https://qgis.org/ubuntu groovy main
gpg --keyserver keyserver.ubuntu.com --recv-key 46B5721DBBD2996A
gpg --export --armor 46B5721DBBD2996A | sudo apt-key add -
apt update
apt upgrade

controllare versione di QGIS Server disponibile

apt-cache policy qgis-server

#installare QGIS Server

apt install qgis-server python-qgis libapache2-mod-fcgid

Abilitare apache2

a2enmod fcgid
a2enconf serve-cgi-bin
a2enmod rewrite
service apache2 restart

editare il file 000-default.conf di apache aggiungendo queste righe dopo la definizione della directory

nano /etc/apache2/sites-enabled/000-default.conf
FcgidIOTimeout 120

ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
<Directory "/usr/lib/cgi-bin/">
  AllowOverride All
  Options +ExecCGI -MultiViews +FollowSymLinks
  AddHandler fcgid-script .fcgi
  Require all granted
</Directory>
service apache2 restart

per testare
http://localhost/cgi-bin/qgis_mapserv.fcgi?SERVICE=WMS&VERSION=1.3.0&REQUEST=GetCapabilities

INSTALL LIZMAP

cd /var/www

mkdir lizmap
cd lizmap

Controllare la release disponibile di Lizmap sul repo git:
copiare il link allo zip della release ed incollarlo nel comando del wget
es. wget + URL.zip


wget https://github.com/3liz/lizmap-web-client/releases/download/3.5.0/lizmap-web-client-3.5.0.zip

unzip the folder

unzip lizmap-web-client-3.5.0.zip
mv lizmap-web-client-3.5.0 lizmap-web-client

Impostare i permessi

cd /var/www/lizmap/lizmap-web-client/lizmap/install
 ./set_rights.sh www-data www-data

Creare i file di setting

cd /var/www/lizmap/lizmap-web-client/lizmap/var/config
cp lizmapConfig.ini.php.dist lizmapConfig.ini.php
cp localconfig.ini.php.dist localconfig.ini.php
cp profiles.ini.php.dist profiles.ini.php

lizmapConfig.ini.php here we can set the default folder for QGIS server projects

check if php-xml is installed

apt install php7.4-xml

lanciare installazione Lizmap

cd /var/www/lizmap/lizmap-web-client/lizmap/install
php ./installer.php

edit apache conf

nano /etc/apache2/sites-enabled/000-default.conf
            Alias /lizmap /var/www/lizmap/lizmap-web-client/lizmap/www/
            <Directory "/var/www/lizmap/lizmap-web-client/lizmap/www/">
                Options -Indexes +FollowSymLinks +ExecCGI
                AllowOverride All
                Require all granted
            </Directory>
service apache2 restart

example of a apache conf file for production

<VirtualHost *:80>
	ServerName DOMAIN_NAME.eu
	ServerAlias www.DOMAIN_NAME.eu
	ServerAdmin pluto@topolinia.net 
        DocumentRoot /var/www/lizmap/lizmap-web-client/lizmap/www/
	ErrorLog ${APACHE_LOG_DIR}/error.log
	CustomLog ${APACHE_LOG_DIR}/access.log combined
	Alias /lizmap/ /var/www/lizmap/

		FcgidIOTimeout 120
	<Directory "/var/www/lizmap/lizmap-web-client/lizmap/">
    Options -Indexes +FollowSymLinks +ExecCGI
    AllowOverride All
    Require all granted
   </Directory>

    ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
    <Directory "/usr/lib/cgi-bin/">
      AllowOverride All
      Options +ExecCGI -MultiViews +FollowSymLinks
      AddHandler fcgid-script .fcgi
      Require all granted
    </Directory>


RewriteEngine on
RewriteCond %{SERVER_NAME} =mlal.geoatamai.it [OR]
RewriteCond %{SERVER_NAME} =www.mlal.geoatamai.it
RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,NE,R=permanent]
</VirtualHost>

Assicurarsi che i permessi siano stati assegnati correttamente all'utente www-data

cd /var/www/
chown -R www-data:www-data lizmap

to check if Lizmap is working go to: http://127.0.0.1:8000/lizmap

TIPS

To allow the admin to create password for user follow https://github.com/3liz/lizmap-web-client/issues/1402 add to localconfig.ini.php:

[jcommunity]
resetAdminPasswordEnabled = off
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment