code:work:lvisf:2021:rtp:server
Differences
This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| code:work:lvisf:2021:rtp:server [2022/02/02 16:28] – [OSM Tile Server Setup] david | code:work:lvisf:2021:rtp:server [2022/02/02 22:39] (current) – [Subdivisions] david | ||
|---|---|---|---|
| Line 3: | Line 3: | ||
| * FIXME Need to start with ubuntu server, not desktop so the IP address stuff is fixed / static | * FIXME Need to start with ubuntu server, not desktop so the IP address stuff is fixed / static | ||
| * OR figure out how to fix this desktop install | * OR figure out how to fix this desktop install | ||
| + | |||
| + | Try this as your netplan file: | ||
| + | < | ||
| + | # Let NetworkManager manage all devices on this system | ||
| + | network: | ||
| + | version: 2 | ||
| + | renderer: NetworkManager | ||
| + | ethernets: | ||
| + | eno1: | ||
| + | renderer: networkd | ||
| + | match: | ||
| + | name: eno1 | ||
| + | addresses: [10.4.1.10/ | ||
| + | gateway4: 10.4.1.254 | ||
| + | nameservers: | ||
| + | search: [nasa.gov] | ||
| + | addresses: [128.183.10.134, | ||
| + | </ | ||
| ===== Base Server Install ===== | ===== Base Server Install ===== | ||
| Line 197: | Line 215: | ||
| - Install some more packages required to compile < | - Install some more packages required to compile < | ||
| - | sudo apt install subversion build-essential cmake libcurl4-gnutls-dev libnetcdf-dev libgdal-dev libfftw3-dev libpcre3-dev liblapack-dev libblas-dev | + | sudo apt -y install subversion build-essential cmake libcurl4-gnutls-dev libnetcdf-dev libgdal-dev libfftw3-dev libpcre3-dev liblapack-dev libblas-dev |
| - | sudo apt install libglib2.0-dev ffmpeg graphicsmagick | + | sudo apt -y install libglib2.0-dev ffmpeg graphicsmagick |
| </ | </ | ||
| - Go to **src** directory < | - Go to **src** directory < | ||
| Line 302: | Line 320: | ||
| - Install httpd < | - Install httpd < | ||
| - | sudo apt update | + | sudo apt -y update |
| - | sudo apt install apache2 | + | sudo apt -y install apache2 |
| </ | </ | ||
| - Adjust firewall if necessary (was not necessary (see link above) but this shows apache already through the firewall < | - Adjust firewall if necessary (was not necessary (see link above) but this shows apache already through the firewall < | ||
| Line 319: | Line 337: | ||
| sudo chmod 775 / | sudo chmod 775 / | ||
| sudo chgrp -R lvis / | sudo chgrp -R lvis / | ||
| + | ln -s / | ||
| mkdir / | mkdir / | ||
| </ | </ | ||
| Line 350: | Line 369: | ||
| - Log in to this account | - Log in to this account | ||
| - Install some required software < | - Install some required software < | ||
| - | sudo apt install libboost-all-dev git tar unzip wget bzip2 build-essential autoconf libtool libxml2-dev libgeos-dev libgeos++-dev libpq-dev libbz2-dev libproj-dev munin-node munin protobuf-c-compiler libfreetype6-dev libtiff5-dev libicu-dev libgdal-dev libcairo2-dev libcairomm-1.0-dev apache2 apache2-dev libagg-dev liblua5.2-dev ttf-unifont lua5.1 liblua5.1-0-dev | + | sudo apt -y install libboost-all-dev git tar unzip wget bzip2 build-essential autoconf libtool libxml2-dev libgeos-dev libgeos++-dev libpq-dev libbz2-dev libproj-dev munin-node munin protobuf-c-compiler libfreetype6-dev libtiff5-dev libicu-dev libgdal-dev libcairo2-dev libcairomm-1.0-dev apache2 apache2-dev libagg-dev liblua5.2-dev ttf-unifont lua5.1 liblua5.1-0-dev |
| </ | </ | ||
| Line 356: | Line 375: | ||
| - Install data base packages needed < | - Install data base packages needed < | ||
| - | sudo apt install postgresql postgresql-contrib postgis postgresql-12-postgis-3 postgresql-12-postgis-3-scripts | + | sudo apt -y install postgresql postgresql-contrib postgis postgresql-12-postgis-3 postgresql-12-postgis-3-scripts |
| </ | </ | ||
| - Migrate our database to the other drive as it has way more space | - Migrate our database to the other drive as it has way more space | ||
| Line 411: | Line 430: | ||
| - Create the actual database< | - Create the actual database< | ||
| sudo -u postgres -i | sudo -u postgres -i | ||
| + | createuser renderaccount # answer yes for superuser (although this isn't strictly necessary) | ||
| createdb -E UTF8 -O renderaccount gis | createdb -E UTF8 -O renderaccount gis | ||
| </ | </ | ||
| Line 427: | Line 447: | ||
| < | < | ||
| - | sudo apt install osm2pgsql | + | sudo apt -y install osm2pgsql |
| </ | </ | ||
| Line 433: | Line 453: | ||
| < | < | ||
| - | sudo apt install autoconf apache2-dev libtool libxml2-dev libbz2-dev libgeos-dev libgeos++-dev libproj-dev gdal-bin libmapnik-dev mapnik-utils python3-mapnik python3-psycopg2 python3-yaml | + | sudo apt -y install autoconf apache2-dev libtool libxml2-dev libbz2-dev libgeos-dev libgeos++-dev libproj-dev gdal-bin libmapnik-dev mapnik-utils python3-mapnik python3-psycopg2 python3-yaml |
| </ | </ | ||
| Line 447: | Line 467: | ||
| - Make and install < | - Make and install < | ||
| ./configure | ./configure | ||
| - | make | + | CPUCOUNT=$(grep -c " |
| + | make -j $CPUCOUNT | ||
| sudo make install | sudo make install | ||
| sudo make install-mod_tile | sudo make install-mod_tile | ||
| Line 461: | Line 482: | ||
| </ | </ | ||
| - Add some more things < | - Add some more things < | ||
| - | sudo apt install npm | + | sudo apt -y install npm |
| sudo npm install -g carto | sudo npm install -g carto | ||
| carto -v | carto -v | ||
| Line 499: | Line 520: | ||
| If you want a smaller **pbf** file which should take less time to ingest, you can grab the subdivisions here: | If you want a smaller **pbf** file which should take less time to ingest, you can grab the subdivisions here: | ||
| * [[https:// | * [[https:// | ||
| + | |||
| + | < | ||
| + | time osm2pgsql -d gis --create --slim | ||
| + | time osm2pgsql -d gis --append --slim | ||
| + | </ | ||
| Line 510: | Line 536: | ||
| ===== Shapefile download ===== | ===== Shapefile download ===== | ||
| + | |||
| + | This gets the basic water and land information | ||
| < | < | ||
| Line 519: | Line 547: | ||
| < | < | ||
| - | sudo apt install fonts-noto-cjk fonts-noto-hinted fonts-noto-unhinted ttf-unifont | + | sudo apt -y install fonts-noto-cjk fonts-noto-hinted fonts-noto-unhinted ttf-unifont |
| </ | </ | ||
| Line 554: | Line 582: | ||
| sudo nano / | sudo nano / | ||
| </ | </ | ||
| - | - And add the following line < | + | - And add the following line and then exit out of the editor< |
| LoadModule tile_module / | LoadModule tile_module / | ||
| </ | </ | ||
| Line 606: | Line 634: | ||
| </ | </ | ||
| - | Try our locally hosted map now! [[http:// | + | ===== Viewing local tiles ===== |
| + | |||
| + | * Good info: [[https:// | ||
| + | * Try our locally hosted map now! [[http:// | ||
| + | |||
| + | - Put this into **leaflet.html** in your html folder <code html> | ||
| + | < | ||
| + | <html lang=" | ||
| + | < | ||
| + | <meta charset=" | ||
| + | <meta name=" | ||
| + | <script src=" | ||
| + | <link rel=" | ||
| + | < | ||
| + | html, body { | ||
| + | height: 100%; | ||
| + | padding: 0; | ||
| + | margin: 0; | ||
| + | } | ||
| + | #map { | ||
| + | /* configure the size of the map */ | ||
| + | width: 100%; | ||
| + | height: 100%; | ||
| + | } | ||
| + | </ | ||
| + | </ | ||
| + | < | ||
| + | <div id=" | ||
| + | < | ||
| + | // initialize Leaflet | ||
| + | var map = L.map(' | ||
| + | |||
| + | // add the OpenStreetMap tiles | ||
| + | L.tileLayer(' | ||
| + | maxZoom: 19, | ||
| + | attribution: | ||
| + | }).addTo(map); | ||
| + | |||
| + | // show the scale bar on the lower left corner | ||
| + | L.control.scale({imperial: | ||
| + | |||
| + | // show a marker on the map | ||
| + | L.marker({lon: | ||
| + | </ | ||
| + | </ | ||
| + | </ | ||
| + | </ | ||
| + | - And modify the line that renders the tile layer with this line < | ||
| + | L.tileLayer(' | ||
| + | </ | ||
code/work/lvisf/2021/rtp/server.1643819307.txt.gz · Last modified: by david
