Size: 3498
Comment:
|
Size: 3534
Comment: minor fixes
|
Deletions are marked like this. | Additions are marked like this. |
Line 13: | Line 13: |
Login as root, and issue: | Login as root, and run: |
Line 19: | Line 20: |
Line 23: | Line 25: |
=== 3. Prepare database === | |
Line 24: | Line 27: |
=== 3. Prepare database === | |
Line 47: | Line 49: |
Line 63: | Line 66: |
change version in first line from: 0.4-12~precise2 to 0.4.12~buster. If the version will be different, change it accoringly: Version number can't containg '-' character. | change version in first line from: 0.4-12~precise2 to 0.4.12~buster. If the version will be different, change it accordingly: Version number can't contain the '-' character. |
Line 70: | Line 74: |
change the following variables: | Change the following variables: |
Line 78: | Line 83: |
Line 85: | Line 91: |
Line 89: | Line 96: |
Line 90: | Line 98: |
dpkg -i libapache2-mod-tile_0.4.12~buster_amd64.deb renderd_0.4.12~buster_amd64.deb | apt install ./libapache2-mod-tile_0.4.12~buster_amd64.deb ./renderd_0.4.12~buster_amd64.deb |
Line 94: | Line 102: |
Line 96: | Line 105: |
npm install -g carto | npm install carto |
Line 103: | Line 112: |
Line 108: | Line 118: |
Line 111: | Line 122: |
wget https://download.geofabrik.de/<intersting area>.osm.pbf | wget https://download.geofabrik.de/<interesting area>.osm.pbf |
Line 113: | Line 124: |
For testing you can download some small pbf file, i.e.: https://download.geofabrik.de/africa/cape-verde-latest.osm.pbf | For testing you can download a small pbf file, i.e.: https://download.geofabrik.de/africa/cape-verde-latest.osm.pbf |
Line 116: | Line 128: |
Line 117: | Line 130: |
Line 120: | Line 134: |
Of course, instead of cape-verde-latest.osm.pbf, you can use any pbf you want. | Of course, instead of `cape-verde-latest.osm.pbf`, you can use any pbf you want. |
Line 123: | Line 138: |
Line 131: | Line 147: |
Line 140: | Line 157: |
=== 10. Fix mod_tile permitions === | === 10. Fix mod_tile permissions === |
Line 143: | Line 160: |
Line 150: | Line 168: |
/etc/init.d/renderd stop /etc/init.d/renderd start |
service renderd stop service renderd start |
Line 153: | Line 171: |
This guide will help to install OSM Tile server on Debian Buster
OSM database: gis
Database user: gisuser
Table of contents:
Contents
1. Install required packages
Login as root, and run:
apt install postgresql postgis apache2 apache2-dev libmapnik-dev osm2pgsql python-mapnik git mapnik-utils fonts-noto-cjk fonts-noto-hinted fonts-noto-unhinted ttf-unifont
2. Create user account
useradd -m gisuser
3. Prepare database
Create database user gisuser and database gis:
su - postgres psql create user gis; create database gis owner gisuser; \q psql gis CREATE EXTENSION postgis; CREATE EXTENSION hstore; ALTER TABLE geometry_columns OWNER TO gisuser; ALTER TABLE spatial_ref_sys OWNER TO gisuser; \q exit
4. Build renderd
su - gisuser mkdir ~/src cd ~/src git clone -b switch2osm https://github.com/SomeoneElseOSM/mod_tile.git cd mod_tile
Modify the following files:
debian/compat:
change 7 -> 9
debian/changelog:
- change version in first line from: 0.4-12~precise2 to 0.4.12~buster. If the version will be different, change it accordingly: Version number can't contain the '-' character.
libapache2-mod-tile (0.4.12~buster) precise; urgency=low
debian/renderd.init:
Change the following variables:
DAEMON=/usr/bin/$NAME DAEMON_ARGS="-c /etc/renderd.conf" RUNASUSER=gisuser
Finally build package:
cd ~/src/mod_tile ./autogen.sh dpkg-buildpackage -uc -us
In ~/src directory you should find:
libapache2-mod-tile_0.4.12~buster_amd64.deb renderd_0.4.12~buster_amd64.deb
Install them from root account:
apt install ./libapache2-mod-tile_0.4.12~buster_amd64.deb ./renderd_0.4.12~buster_amd64.deb
5. Download and build opencarto
apt install npm nodejs npm install carto su - gisuser cd ~/src git clone git://github.com/gravitystorm/openstreetmap-carto.git cd openstreetmap-carto carto project.mml > mapnik.xml
After last command, you can see a lot of warnings. I don't understand them, but it looks they they are irrelevant
6. Download map data
Under gisuser account:
mkdir ~/data cd ~/data wget https://download.geofabrik.de/<interesting area>.osm.pbf
For testing you can download a small pbf file, i.e.: https://download.geofabrik.de/africa/cape-verde-latest.osm.pbf
7. Import map to gis database
Under gisuser account:
osm2pgsql -d gis --create --slim -G --hstore --tag-transform-script ~/src/openstreetmap-carto/openstreetmap-carto.lua -C 2500 --number-processes 1 -S ~/src/openstreetmap-carto/openstreetmap-carto.style ~/data/cape-verde-latest.osm.pbf
Of course, instead of cape-verde-latest.osm.pbf, you can use any pbf you want.
8. Load shape files
cd ~/src/openstreetmap-carto scripts/get-shapefiles.py
9. Fix renderd paths
In /etc/renderd.conf you should have:
[mapnik] plugins_dir=/usr/lib/mapnik/3.0/input font_dir=/usr/share/fonts/truetype/dejavu [default] XML=/home/gisuser/src/openstreetmap-carto/mapnik.xml
10. Fix mod_tile permissions
From root:
chown gisuser.gisuser /var/lib/mod_tile
11. Finally start renderd
service renderd stop service renderd start
check /var/log/syslog for messages from renderd.