From b83609bf3abf97cf3cd057842491e9678744c205 Mon Sep 17 00:00:00 2001 From: AcuGIS Date: Mon, 25 Mar 2024 11:17:22 +0000 Subject: [PATCH] Update docs/source/install.rst --- docs/source/install.rst | 111 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 111 insertions(+) diff --git a/docs/source/install.rst b/docs/source/install.rst index dddd504..dfab0e6 100644 --- a/docs/source/install.rst +++ b/docs/source/install.rst @@ -43,6 +43,117 @@ Manual Installation on Ubuntu 22 ------------ +Install PostgreSQL with PostGIS +------------------------------------------ + +QuartzMap requires PostgreSQL with PostGIS. + +If you do not already have it installed, install it now. + +.. code-block:: bash + +#!/bin/bash -e + +PG_VER='16' +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 </etc/postgresql/${PG_VER}/main/pg_hba.conf <> /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(){ + 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 +export DEBIAN_FRONTEND=noninteractive + +add-apt-repository -y universe +apt-get -y update || true + +apt-get -y install wget unzip + +install_postgresql; + + + #!/bin/bash -e APP_DB='q2w'