=============
maps.libre.is
=============
HOWTO run your own map servers.
Debian
======
Using Debian stable (12/bookworm).
Install dependenices:
.. code-block:: sh
sudo apt install apache2 python3-certbot-apache \
osm2pgsql postgresql-postgis postgresql-postgis-scripts \
pkg-config libicu-dev virtualenv python3-pip \
build-essential python3-dev
Firewall
========
Open ports 80 and 443 for web.
Apache
======
Install and set up Apache.
.. code-block:: sh
certbot -d maps.libre.is -d map.libre.is
# remove old apache configs:
rm /etc/apache2/sites-enabled/000-default*
Add new apache configs to /etc/apache2/sites-available/maps-libre-is.conf:
.. code-block:: apache
ServerName maps.libre.is
ServerAlias map.libre.is
ServerAdmin webmaster@libre.is
DocumentRoot /var/www/html/maps-libre-is
ErrorLog ${APACHE_LOG_DIR}/error-libre-maps-is.log
CustomLog ${APACHE_LOG_DIR}/access-libre-maps-is.log combined
RewriteEngine on
ReWriteCond %{HTTPS} off
RewriteCond %{SERVER_NAME} =map.libre.is
RewriteRule ^ https://maps.libre.is%{REQUEST_URI} [END,NE,R=permanent]
ReWriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
RewriteCond %{SERVER_NAME} =maps.libre.is
RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,NE,R=permanent]
ServerName maps.libre.is
ServerAlias map.libre.is
ServerAdmin webmaster@libre.is
DocumentRoot /var/www/html/maps-libre-is
ErrorLog ${APACHE_LOG_DIR}/error-ssl-libre-maps-is.log
CustomLog ${APACHE_LOG_DIR}/access-ssl-libre-maps-is.log combined
RewriteEngine on
RewriteCond %{SERVER_NAME} =map.libre.is
RewriteRule ^ https://maps.libre.is%{REQUEST_URI} [END,NE,R=permanent]
ReWriteCond %{HTTPS} off [OR]
ReWriteCond %{HTTP_HOST} ^www\.(.*)$ [NC]
ReWriteRule ^(.*)$ https://%1$1 [L,R=301]
Options FollowSymlinks
AllowOverride All
Require all granted
Include /etc/letsencrypt/options-ssl-apache.conf
SSLCertificateFile /etc/letsencrypt/live/maps.libre.is/fullchain.pem
SSLCertificateKeyFile /etc/letsencrypt/live/maps.libre.is/privkey.pem
# vim: syntax=apache ts=4 sw=4 sts=4 sr noet
Enable new configuration:
.. code-block:: sh
sudo mkdir -p /var/www/html/maps-libre-is
echo maps.libre.is | sudo tee /var/www/html/maps-libre-is/index.html
sudo ln -s /etc/apache2/sites-available/maps-libre-is.conf /etc/apache2/sites-enabled/maps-libre-is.conf
sudo systemctl restart apache2
Nominatim
=========
"Nominatim uses OpenStreetMap data to find locations on Earth by name and
address (geocoding).
It can also do the reverse, find an address for any location on the planet."
``_
``_
``_
The full installation is quite demanding:
* 2GB RAM minimum.
* Full planet import requires 128GB of RAM or more.
* Full planet needs at least 1TB of fast disk.
* Full import of planet takes 2.5 days on NVMe, 4-5 days on SSD.
With the large disk, create a mount in /srv.
Set up Nominatim user and switch to it.
.. code-block:: sh
sudo useradd -d /srv/nominatim -s /bin/bash -m nominatim
sudo -u nominatim bash
export USERNAME=nominatim
export USERHOME=/srv/nominatim
chmod a+x $USERHOME
Postgres
========
Postgres is needed by Nominatim.
.. code-block:: sh
export USERNAME=nominatim
export USERHOME=/srv/nominatim
sudo systemctl restart postgresql
sudo -u postgres createuser -s $USERNAME
sudo -u postgres createuser www-data
Nominatim Install
=================
As user nominatim.
.. code-block::
sudo -u nominatim bash
export USERNAME=nominatim
export USERHOME=/srv/nominatim
virtualenv $USERHOME/nominatim-venv
$USERHOME/nominatim-venv/bin/pip install nominatim-db
. $USERHOME/nominatim-venv/bin/activate