QuartzMap/docs/source/install.rst

223 lines
5.2 KiB
ReStructuredText
Raw Normal View History

2024-07-10 16:27:23 +00:00
Install
=====
.. _installation:
2024-07-10 20:20:22 +00:00
Installers
2024-07-10 16:27:23 +00:00
------------
2024-07-10 20:20:22 +00:00
If you plan to use SSL, be sure to set the hostname
2024-07-10 16:27:23 +00:00
.. code-block:: console
2024-07-10 20:20:22 +00:00
$ hostnamectl set-hostname qpod.webgis1.com
Download QuartzMap or use Git.
2024-07-10 20:42:54 +00:00
Installer scripts are available in the install directory and should be called from the quartzmap directory.
2024-07-10 20:20:22 +00:00
.. code-block:: console
$ git clone https://github.com/AcuGIS/quartzmap.git
2024-07-10 20:42:54 +00:00
$ cd quartzmap
2024-07-10 16:27:23 +00:00
2024-07-10 20:20:22 +00:00
If PostgreSQL is not installed, install it using /installer/postgres.sh
.. code-block:: console
$ ./installer/postgres.sh
Run the installer:
.. code-block:: console
$ ./installer/app-install.sh
2024-07-10 20:42:54 +00:00
Optionally, install an SSL certificate using certbot
.. code-block:: console
certbot --apache --agree-tos --email hostmaster@yourdomain.com --no-eff-email -d yourdomain.com
Go to https://yourdomain.com/admin/setup.php to complete the installation
2024-07-10 20:20:22 +00:00
Manual Installation
-------------------
2024-07-10 16:27:23 +00:00
2024-07-10 20:42:54 +00:00
1. Install dependencies:
.. code-block:: console
apt-get -y install apache2 php-{pgsql,zip,gd,simplexml,curl,fpm} proftpd libapache2-mod-fcgid postfix python3-certbot-apache gdal-bin
2. Install QGIS Server
.. code-block:: console
RELEASE=$(lsb_release -cs)
wget --no-check-certificate --quiet -O /etc/apt/keyrings/qgis-archive-keyring.gpg https://download.qgis.org/downloads/qgis-archive-keyring.gpg
cat >>/etc/apt/sources.list.d/qgis.sources <<CAT_EOF
Types: deb deb-src
URIs: https://qgis.org/ubuntu
Suites: ${RELEASE}
Architectures: amd64
Components: main
Signed-By: /etc/apt/keyrings/qgis-archive-keyring.gpg
CAT_EOF
apt-get update -y || true
apt-get install -y qgis-server
if [ -d /etc/logrotate.d ]; then
cat >/etc/logrotate.d/qgisserver <<CAT_EOF
/var/log/qgisserver.log {
su www-data www-data
size 100M
notifempty
missingok
rotate 3
daily
compress
create 660 www-data www-data
}
CAT_EOF
fi
mkdir -p ${DATA_DIR}/qgis
chown www-data:www-data ${DATA_DIR}/qgis
touch /var/log/qgisserver.log
chown www-data:www-data /var/log/qgisserver.log
3. Set up Apache
.. code-block:: console
a2enmod ssl headers expires fcgid cgi
4. Copy conf files from installer directory
.. code-block:: console
2024-07-10 16:27:23 +00:00
2024-07-10 20:42:54 +00:00
cp installer/apache2.conf /etc/apache2/sites-available/default-ssl.conf
2024-07-10 16:27:23 +00:00
2024-07-10 20:42:54 +00:00
sed "s|\$DATA_DIR|$DATA_DIR|" < installer/qgis_apache2.conf > /etc/apache2/sites-available/qgis.conf
for f in default-ssl 000-default; do
sed -i.save "s/#ServerName example.com/ServerName ${HNAME}/" /etc/apache2/sites-available/${f}.conf
done
a2ensite 000-default default-ssl qgis
a2disconf serve-cgi-bin
# switch to mpm_event to server faster and use HTTP2
PHP_VER=$(php -version | head -n 1 | cut -f2 -d' ' | cut -f1,2 -d.)
a2enmod proxy_fcgi setenvif http2
a2enconf php${PHP_VER}-fpm
a2enmod mpm_event
systemctl reload apache2
5. Set up ProFTPD
.. code-block:: console
sed -i.save '
s/#DefaultRoot~/DefaultRoot ~/
s/# RequireValidShelloff/RequireValidShell off/' /etc/proftpd/proftpd.conf
systemctl enable proftpd
systemctl restart proftpd
6. Create the PostgreSQL database
.. code-block:: console
su postgres
createdb quartz
createuser -sd quartz
psql -c "alter user quartz with password 'SuperSecret'"
psql -c "ALTER DATABASE quartz OWNER TO quartz"
CMD_EOF
7. Create the Data, Cache, and Apps directories
.. code-block:: console
mkdir /var/www/data
mkdir /var/www/cache
mkdir /var/www/html/apps
chown -R www-data:www-data /var/www/data
chown -R www-data:www-data /var/www/cache
chown -R www-data:www-data /var/www/html/apps
8. Give sync service +w to apps/1/images dir
.. code-block:: console
chmod -R g+w "${APPS_DIR}"
9. Create the const.php configuration file using values from above
.. code-block:: console
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", 'quartz_user');
?>
CAT_EOF
10. Copy files from quartzmap directory to /var/www/html
.. code-block:: console
cp -r . /var/www/html/
chown -R www-data:www-data /var/www/html
rm -rf /var/www/html/installer
systemctl restart apache2
11. Configure FTP users
.. code-block:: console
groupadd qatusers
for f in create_ftp_user delete_ftp_user update_ftp_user; do
cp installer/${f}.sh /usr/local/bin/
chown www-data:www-data /usr/local/bin/${f}.sh
chmod 0550 /usr/local/bin/${f}.sh
done
cat >/etc/sudoers.d/q2w <<CAT_EOF
www-data ALL = NOPASSWD: /usr/local/bin/create_ftp_user.sh, /usr/local/bin/delete_ftp_user.sh, /usr/local/bin/update_ftp_user.sh
CAT_EOF
Optionally, install an SSL certificate using certbot
.. code-block:: console
certbot --apache --agree-tos --email hostmaster@yourdomain.com --no-eff-email -d yourdomain.com
2024-07-10 16:27:23 +00:00
2024-07-10 20:42:54 +00:00
Go to https://yourdomain.com/admin/setup.php to complete the installation