This commit is contained in:
AcuGIS 2024-03-25 16:47:38 +02:00
commit f24a21469c
7 changed files with 199 additions and 235 deletions

View File

@ -0,0 +1,3 @@
.wy-nav-content {
max-width: none;
}

View File

@ -0,0 +1,3 @@
.wy-nav-content {
max-width: none;
}

View File

@ -33,3 +33,12 @@ html_theme = 'sphinx_rtd_theme'
# -- Options for EPUB output # -- Options for EPUB output
epub_show_urls = 'footnote' epub_show_urls = 'footnote'
html_static_path = ['_static']
# These paths are either relative to html_static_path
# or fully qualified paths (eg. https://...)
html_css_files = [
'css/custom.css',
]

View File

@ -40,7 +40,9 @@ Populate the required fields with whatever values you want to use.
Manual Installation on Ubuntu 22 Manual Installation on Ubuntu 22
------------ --------------------------------
Follow below to customize your installation.
Install PostgreSQL with PostGIS Install PostgreSQL with PostGIS
@ -54,269 +56,193 @@ If you do not already have it installed, install it now.
#!/bin/bash -e #!/bin/bash -e
PG_VER='16' apt install postgresql postgresql-contrib
PG_PASS=$(< /dev/urandom tr -dc _A-Z-a-z-0-9 | head -c32);
function install_postgresql(){
RELEASE=$(lsb_release -cs)
#3. Install PostgreSQL
echo "deb http://apt.postgresql.org/pub/repos/apt/ ${RELEASE}-pgdg main" > /etc/apt/sources.list.d/pgdg.list
wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | apt-key add -
apt-get update -y || true
apt-get install -y postgresql-${PG_VER} postgresql-client-${PG_VER} postgresql-contrib-${PG_VER} \
python3-postgresql postgresql-plperl-${PG_VER} \
postgresql-pltcl-${PG_VER} postgresql-${PG_VER}-postgis-3 \
odbc-postgresql libpostgresql-jdbc-java
if [ ! -f /usr/lib/postgresql/${PG_VER}/bin/postgres ]; then
echo "Error: Get PostgreSQL version"; exit 1;
fi
ln -sf /usr/lib/postgresql/${PG_VER}/bin/pg_config /usr/bin
ln -sf /var/lib/postgresql/${PG_VER}/main/ /var/lib/postgresql
ln -sf /var/lib/postgresql/${PG_VER}/backups /var/lib/postgresql
systemctl start postgresql
#5. Set postgres Password
if [ $(grep -m 1 -c 'pg pass' /root/auth.txt) -eq 0 ]; then
sudo -u postgres psql 2>/dev/null -c "alter user postgres with password '${PG_PASS}'"
echo "pg pass: ${PG_PASS}" > /root/auth.txt
fi
#4. Add Postgre variables to environment
if [ $(grep -m 1 -c 'PGDATA' /etc/environment) -eq 0 ]; then
cat >>/etc/environment <<CMD_EOF
PGDATA=/var/lib/postgresql/${PG_VER}/main
CMD_EOF
fi
#6. Configure ph_hba.conf
cat >/etc/postgresql/${PG_VER}/main/pg_hba.conf <<CMD_EOF
local all all trust
host all all 127.0.0.1 255.255.255.255 trust
host all all 0.0.0.0/0 scram-sha-256
host all all ::1/128 scram-sha-256
hostssl all all 127.0.0.1 255.255.255.255 scram-sha-256
hostssl all all 0.0.0.0/0 scram-sha-256
hostssl all all ::1/128 scram-sha-256
CMD_EOF
sed -i.save "s/.*listen_addresses.*/listen_addresses = '*'/" /etc/postgresql/${PG_VER}/main/postgresql.conf
sed -i.save "s/.*ssl =.*/ssl = on/" /etc/postgresql/${PG_VER}/main/postgresql.conf
#10. Create Symlinks for Backward Compatibility from PostgreSQL 9 to PostgreSQL 8
#ln -sf /usr/pgsql-9.4/bin/pg_config /usr/bin
mkdir -p /var/lib/pgsql
ln -sf /var/lib/postgresql/${PG_VER}/main /var/lib/pgsql
ln -sf /var/lib/postgresql/${PG_VER}/backups /var/lib/pgsql
#create SSL certificates
if [ ! -f /var/lib/postgresql/${PG_VER}/main/server.key -o ! -f /var/lib/postgresql/${PG_VER}/main/server.crt ]; then
SSL_PASS=$(< /dev/urandom tr -dc _A-Z-a-z-0-9 | head -c32);
if [ $(grep -m 1 -c 'ssl pass' /root/auth.txt) -eq 0 ]; then
echo "ssl pass: ${SSL_PASS}" >> /root/auth.txt
else
sed -i.save "s/ssl pass:.*/ssl pass: ${SSL_PASS}/" /root/auth.txt
fi
openssl genrsa -des3 -passout pass:${SSL_PASS} -out server.key 2048
openssl rsa -in server.key -passin pass:${SSL_PASS} -out server.key
chmod 400 server.key
openssl req -new -key server.key -days 3650 -out server.crt -passin pass:${SSL_PASS} -x509 -subj '/C=CA/ST=Frankfurt/L=Frankfurt/O=acuciva-de.com/CN=acuciva-de.com/emailAddress=info@acugis.com'
chown postgres.postgres server.key server.crt
mv server.key server.crt /var/lib/postgresql/${PG_VER}/main
fi
systemctl restart postgresql
}
function install_webmin(){ Install Prerequisties
echo "deb http://download.webmin.com/download/repository sarge contrib" > /etc/apt/sources.list.d/webmin.list ------------------------------------------
wget --quiet -qO - http://www.webmin.com/jcameron-key.asc | apt-key add -
apt-get -y update
apt-get -y install webmin
}
touch /root/auth.txt For Community Edition:
export DEBIAN_FRONTEND=noninteractive
add-apt-repository -y universe .. code-block:: bash
apt-get -y update || true
apt-get -y install wget unzip apt-get -y install apache2 libapache2-mod-php php-{pgsql,zip,gd,simplexml} proftpd postfix python3-certbot-apache
install_postgresql; For Commerical Edition:
.. code-block:: bash
apt-get -y install apache2 libapache2-mod-php php-{pgsql,zip,gd,simplexml} proftpd libapache2-mod-fcgid postfix python3-certbot-apache
install_qgis_server
Create the PostGIS Database
--------------------------------
#!/bin/bash -e .. code-block:: sql
APP_DB='q2w' CREATE USER quartz with password 'SuperSecret';
APP_DB_PASS=$(< /dev/urandom tr -dc _A-Za-z0-9 | head -c32);
DATA_DIR='/var/www/data'
CACHE_DIR='/var/www/cache'
APPS_DIR='/var/www/html/apps'
# 1. Install packages (assume PG is preinstalled) CREATE DATABASE quartz with OWNER quartz;
apt-get -y install apache2 libapache2-mod-php php-{pgsql,zip,gd} proftpd
sed -i.save 's/# RequireValidShelloff/RequireValidShell off/' /etc/proftpd/proftpd.conf
sed -i.save 's/#DefaultRoot~/DefaultRoot ~/' /etc/proftpd/proftpd.conf
systemctl enable proftpd Create the Database Objects
systemctl restart proftpd --------------------------------
# 2. Create db .. code-block:: sql
su postgres <<CMD_EOF
createdb ${APP_DB}
createuser -sd ${APP_DB}
psql -c "alter user ${APP_DB} with password '${APP_DB_PASS}'"
psql -c "ALTER DATABASE ${APP_DB} OWNER TO ${APP_DB}"
CMD_EOF
echo "${APP_DB} pass: ${APP_DB_PASS}" >> /root/auth.txt CREATE TYPE public.userlevel AS ENUM ('Admin', 'User');
mkdir -p "${APPS_DIR}" CREATE TABLE public.user ( id SERIAL PRIMARY KEY,
mkdir -p "${CACHE_DIR}" name character varying(250),
mkdir -p "${DATA_DIR}" email character varying(250),
password character varying(255),
ftp_user character varying(250),
accesslevel public.userlevel,
owner_id integer NOT NULL REFERENCES public.user(id),
UNIQUE(email)
);
chown -R www-data:www-data "${APPS_DIR}" CREATE TABLE public.access_groups ( id SERIAL PRIMARY KEY,
chown -R www-data:www-data "${CACHE_DIR}" name character varying(255) NOT NULL,
chown -R www-data:www-data "${DATA_DIR}" owner_id integer NOT NULL REFERENCES public.user(id)
);
cat >admin/incl/const.php <<CAT_EOF CREATE TABLE public.user_access ( id SERIAL PRIMARY KEY,
<?php user_id integer NOT NULL REFERENCES public.user(id),
define("DB_HOST", "localhost"); access_group_id integer NOT NULL REFERENCES public.access_groups(id),
define("DB_NAME", "${APP_DB}"); UNIQUE(user_id, access_group_id)
define("DB_USER", "${APP_DB}"); );
define("DB_PASS", "${APP_DB_PASS}");
define("DB_PORT", 5432); CREATE TABLE public.map ( id SERIAL PRIMARY KEY,
define("DB_SCMA", 'public'); name character varying(50) NOT NULL,
define("APPS_DIR", "${APPS_DIR}"); description character varying(50) NOT NULL,
define("CACHE_DIR", "${APPS_DIR}"); is_public BOOLEAN DEFAULT false,
define("DATA_DIR", "${DATA_DIR}"); owner_id integer NOT NULL REFERENCES public.user(id)
?> );
CAT_EOF
CREATE TABLE public.map_access ( id SERIAL PRIMARY KEY,
map_id integer NOT NULL REFERENCES public.map(id),
access_group_id integer NOT NULL REFERENCES public.access_groups(id),
UNIQUE(map_id, access_group_id)
);
CREATE TABLE public.permalink ( id SERIAL PRIMARY KEY,
description character varying(255),
query character varying(255),
map_id integer NOT NULL REFERENCES public.map(id),
created TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
expires TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP + interval '1 hour',
visits integer NOT NULL DEFAULT 0,
visits_limit integer NOT NULL DEFAULT 1,
hash character varying(36) NOT NULL,
owner_id integer NOT NULL REFERENCES public.user(id)
);
CREATE TABLE public.signup ( id SERIAL PRIMARY KEY,
name character varying(250),
email character varying(250),
password character varying(250),
verify character varying(250),
UNIQUE(email)
);
systemctl restart apache2 Configure ProFTPD
----------------------------
# create group for all FTP users .. code-block:: bash
groupadd qatusers
# install ftp user creation script sed -i.save '
for f in create delete; do s/#DefaultRoot~/DefaultRoot ~/
cp installer/${f}_ftp_user.sh /usr/local/bin/ s/# RequireValidShelloff/RequireValidShell off/' /etc/proftpd/proftpd.conf
chown www-data:www-data /usr/local/bin/${f}_ftp_user.sh systemctl enable proftpd
chmod 0550 /usr/local/bin/${f}_ftp_user.sh systemctl restart proftpd
done
cat >/etc/sudoers.d/q2w <<CAT_EOF Configure Apache
www-data ALL = NOPASSWD: /usr/local/bin/create_ftp_user.sh, /usr/local/bin/delete_ftp_user.sh ----------------------------
CAT_EOF
.. code-block:: bash
a2enmod ssl headers expires fcgid cgi
cp installer/apache2.conf /etc/apache2/sites-available/default-ssl.conf
for f in 000-default default-ssl; do
sed -i.save "s/#ServerName example.com/#ServerName ${HNAME}/" /etc/apache2/sites-available/${f}.conf
done
a2ensite 000-default default-ssl
systemctl reload apache2
certbot --apache --agree-tos --email hostmaster@${HNAME} --no-eff-email -d ${HNAME}
Create Data and Cache Directories
----------------------------
.. code-block:: bash
mkdir -p "${APPS_DIR}"
mkdir -p "${CACHE_DIR}"
mkdir -p "${DATA_DIR}"
chown -R www-data:www-data "${APPS_DIR}"
chown -R www-data:www-data "${CACHE_DIR}"
chown -R www-data:www-data "${DATA_DIR}"
cp -r . /var/www/html/
chown -R www-data:www-data /var/www/html
rm -rf /var/www/html/installer
systemctl restart apache2
# create group for all FTP users
groupadd qatusers
create_ftp_user
# install ftp user creation script
for f in update; do
cp installer/${f}_ftp_user.sh /usr/local/bin/
chown www-data:www-data /usr/local/bin/${f}_ftp_user.sh
chmod 0550 /usr/local/bin/${f}_ftp_user.sh
done
cat >/etc/sudoers.d/q2w <<CAT_EOF
www-data ALL = NOPASSWD: /usr/local/bin/update_ftp_user.sh
CAT_EOF
echo -e "postgres and other passwords are saved in /root/auth.txt file"
Install More Stuff
---------------------------------------
.. code-block:: php
cat >admin/incl/const.php <<CAT_EOF
<?php
define("DB_HOST", "localhost");
define("DB_NAME", "${APP_DB}");
define("DB_USER", "${APP_DB}");
define("DB_PASS", "${APP_DB_PASS}");
define("DB_PORT", 5432);
define("DB_SCMA", 'public');
define("APPS_DIR", "${APPS_DIR}");
define("CACHE_DIR", "${CACHE_DIR}");
define("DATA_DIR", "${DATA_DIR}");
define("SUPER_ADMIN_ID", 1);
define("SESS_USR_KEY", 'q2w_user');
?>
CAT_EOF
.. note:: If you want to quickly install and test Lizmap Web Client in a few steps, you can follow those .. note:: If you want to quickly install and test Lizmap Web Client in a few steps, you can follow those
`instructions <https://github.com/3liz/lizmap-docker-compose>`_ using Docker and Docker-Compose. `instructions <https://github.com/3liz/lizmap-docker-compose>`_ using Docker and Docker-Compose.
.. note:: In Debian distributions, you can work as administrator (log in with ``root``), without using ``sudo`` on contrary to Ubuntu. .. note:: In Debian distributions, you can work as administrator (log in with ``root``), without using ``sudo`` on contrary to Ubuntu.
Configuration with Apache server
------------
This documentation provides an example for configuring a server with the Debian 11 distribution. We assume you have base system installed and updated.
.. warning:: This page does not describe how to secure your Nginx server. It's just for a demonstration.
Configure Locales
-----------------
For simplicity, it is interesting to configure the server with UTF-8 default encoding.
.. code-block:: bash
# configure locales
locale-gen fr_FR.UTF-8 #replace fr with your language
dpkg-reconfigure locales
# define your timezone [useful for logs]
dpkg-reconfigure tzdata
apt install ntp ntpdate
.. note:: It is also necessary configure the other software so that they are using this default encoding if this is not the case.
Installing necessary packages
-----------------------------
.. warning:: Lizmap web client 3.6 is based on Jelix 1.8. You must install at least the **7.4** version of PHP. The **dom**, **simplexml**, **pcre**, **session**, **tokenizer** and **spl** extensions are required (they are generally turned on in a standard PHP 7/8 installation)
.. code-block:: bash
sudo su # only necessary if you are not logged in as root
apt update # update packages list
apt install curl openssl libssl1.1 nginx-full nginx nginx-common
On Debian 11 or Ubuntu 20.04 LTS, install these packages:
.. code-block:: bash
apt-get -y install apache2 libapache2-mod-php php-{pgsql,zip,gd} proftpd DAVID
Web configuration
-----------------
Create a new file /etc/nginx/sites-available/lizmap.conf:
.. code-block:: nginx
server {
listen 80;
server_name localhost;
root /var/www/html/lizmap;
index index.php index.html index.htm;
# compression setting
gzip_vary on;
gzip_proxied any;
gzip_comp_level 5;
gzip_min_length 100;
gzip_http_version 1.1;
gzip_types text/plain text/css application/json application/javascript text/xml application/xml application/xml+rss text/javascript text/json;
location / {
try_files $uri $uri/ =404;
}
location ~ [^/]\.php(/|$) {
fastcgi_split_path_info ^(.+\.php)(/.*)$;
set $path_info $fastcgi_path_info; # because of bug http://trac.nginx.org/nginx/ticket/321
try_files $fastcgi_script_name =404;
include fastcgi_params;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param PATH_INFO $path_info;
fastcgi_param PATH_TRANSLATED $document_root$path_info;
fastcgi_pass unix:/var/run/php/php7.4-fpm.sock;
fastcgi_param SERVER_NAME $http_host;
}
}
You should declare the lizmap.local domain name somewhere (in your /etc/hosts,
or into your DNS..), or replace it by your own domain name.
Enable the virtual host you just created:
.. code-block:: bash .. code-block:: bash

View File

@ -1,15 +1,32 @@
Maps Maps
===== =====
The GeoServer page allows you to create GeoServer PostGIS Stores from your PostGIS databases. The Maps page allows you to create and edit Maps.
If the Workspace does not exist, it will be created. Create Map
Usage
------------ ------------
Populate the required fields as shown below: To create a Map, click on "Add New" button.
.. image:: images/geoserver-1.png .. image:: images/Add-Map.png
There are two options for creating a Map.
Option 1, FTP Uploads.
FTP Uploads are qgis2web maps you have uploaded directly via FTP.
It can also maps you uploaded via any FTP client.
.. image:: images/map-2.png
The second option is Archive.
Archive is a zipped archive file you can upload.
.. image:: images/map-3.png

3
docs/source/quartz.css Normal file
View File

@ -0,0 +1,3 @@
.wy-nav-content {
max-width: 90%;
}

View File

@ -0,0 +1,3 @@
.wy-nav-content {
max-width: 90%;
}