User Tools

Site Tools


code:work:lvisf:2021:rtp:server

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
code:work:lvisf:2021:rtp:server [2022/02/02 15:57] – [Entire Earth] davidcode: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:
 +<code>
 +# 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/24]
 +      gateway4: 10.4.1.254
 +      nameservers:
 +        search: [nasa.gov]
 +        addresses: [128.183.10.134, 128.183.50.17, 8.8.8.8]
 +</code>
  
 ===== Base Server Install ===== ===== Base Server Install =====
Line 197: Line 215:
  
   - Install some more packages required to compile <code>   - Install some more packages required to compile <code>
-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
 </code> </code>
   - Go to **src** directory <code>   - Go to **src** directory <code>
Line 302: Line 320:
  
   - Install httpd <code>   - Install httpd <code>
-sudo apt update +sudo apt -y update 
-sudo apt install apache2+sudo apt -y install apache2
 </code> </code>
   - Adjust firewall if necessary (was not necessary (see link above) but this shows apache already through the firewall <code>   - Adjust firewall if necessary (was not necessary (see link above) but this shows apache already through the firewall <code>
Line 319: Line 337:
 sudo chmod 775 /var/www/html sudo chmod 775 /var/www/html
 sudo chgrp -R lvis /var/www/html sudo chgrp -R lvis /var/www/html
 +ln -s /var/www/html
 mkdir /var/www/html/MJD mkdir /var/www/html/MJD
 </code> </code>
Line 334: Line 353:
   * [[https://switch2osm.org/serving-tiles/manually-building-a-tile-server-20-04-lts/]] will show you how to setup a local tile server to create tiles in real time based on the OSB planet data base file you are now downloading (PBF snapshot of the Earth file)  I wish they had the topo one?   * [[https://switch2osm.org/serving-tiles/manually-building-a-tile-server-20-04-lts/]] will show you how to setup a local tile server to create tiles in real time based on the OSB planet data base file you are now downloading (PBF snapshot of the Earth file)  I wish they had the topo one?
   * [[https://www.postgresql.org/docs/6.3/c0702.htm]] alternate location of the data base, as it will not fit on the root drive so refer to this link   * [[https://www.postgresql.org/docs/6.3/c0702.htm]] alternate location of the data base, as it will not fit on the root drive so refer to this link
 +  * Download entire earth PBF file here: [[https://planet.openstreetmap.org/]]
  
 ===== Requirements ===== ===== Requirements =====
Line 349: Line 369:
   - Log in to this account   - Log in to this account
   - Install some required software <code>   - Install some required software <code>
-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
 </code> </code>
  
Line 355: Line 375:
  
   - Install data base packages needed <code>   - Install data base packages needed <code>
-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
 </code> </code>
   - 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 410: Line 430:
     - Create the actual database<code>     - Create the actual database<code>
 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
 </code> </code>
Line 426: Line 447:
  
 <code> <code>
-sudo apt install osm2pgsql+sudo apt -y install osm2pgsql
 </code> </code>
  
Line 432: Line 453:
  
 <code> <code>
-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
 </code> </code>
  
Line 446: Line 467:
   - Make and install <code>   - Make and install <code>
 ./configure ./configure
-make+CPUCOUNT=$(grep -c   "^processor" /proc/cpuinfo) 
 +make -j $CPUCOUNT
 sudo make install sudo make install
 sudo make install-mod_tile sudo make install-mod_tile
Line 460: Line 482:
 </code> </code>
   - Add some more things <code>   - Add some more things <code>
-sudo apt install npm+sudo apt -y install npm
 sudo npm install -g carto sudo npm install -g carto
 carto -v carto -v
Line 498: 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://download.geofabrik.de/]]  <- Get smaller PBF files here! :!:   * [[https://download.geofabrik.de/]]  <- Get smaller PBF files here! :!:
 +
 +<code>
 +time osm2pgsql -d gis --create --slim  -G --hstore --tag-transform-script ~/src/openstreetmap-carto/openstreetmap-carto.lua -C 2500 --number-processes 16 -S ~/src/openstreetmap-carto/openstreetmap-carto.style ~/data/greenland-latest.osm.pbf
 +time osm2pgsql -d gis --append --slim  -G --hstore --tag-transform-script ~/src/openstreetmap-carto/openstreetmap-carto.lua -C 2500 --number-processes 16 -S ~/src/openstreetmap-carto/openstreetmap-carto.style ~/data/antarctica-latest.osm.pbf
 +</code>
  
  
Line 509: Line 536:
  
 ===== Shapefile download ===== ===== Shapefile download =====
 +
 +This gets the basic water and land information
  
 <code> <code>
Line 518: Line 547:
  
 <code> <code>
-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
 </code> </code>
  
Line 553: Line 582:
 sudo nano /etc/apache2/conf-available/mod_tile.conf sudo nano /etc/apache2/conf-available/mod_tile.conf
 </code> </code>
-    - And add the following line <code>+    - And add the following line and then exit out of the editor<code>
 LoadModule tile_module /usr/lib/apache2/modules/mod_tile.so LoadModule tile_module /usr/lib/apache2/modules/mod_tile.so
 </code> </code>
Line 605: Line 634:
 </code> </code>
  
-Try our locally hosted map now!  [[http://10.4.1.10/rtp_leaflet.html]]+===== Viewing local tiles ===== 
 + 
 +  * Good info: [[https://switch2osm.github.io/using-tiles/getting-started-with-leaflet/]] 
 +  * Try our locally hosted map now!  [[http://10.4.1.10/rtp_leaflet.html]] 
 + 
 +  - Put this into **leaflet.html** in your html folder <code html> 
 +<!DOCTYPE HTML> 
 +<html lang="en"> 
 +  <head> 
 +    <meta charset="utf-8" /> 
 +    <meta name="viewport" content="width=device-width, initial-scale=1.0"> 
 +    <script src="https://unpkg.com/leaflet@1.7.1/dist/leaflet.js"></script> 
 +    <link rel="stylesheet" href="https://unpkg.com/leaflet@1.7.1/dist/leaflet.css" /> 
 +    <style> 
 +      html, body { 
 +        height: 100%; 
 +        padding: 0; 
 +        margin: 0; 
 +      } 
 +      #map { 
 +        /* configure the size of the map */ 
 +        width: 100%; 
 +        height: 100%; 
 +      } 
 +    </style> 
 +  </head> 
 +  <body> 
 +    <div id="map"></div> 
 +    <script> 
 +      // initialize Leaflet 
 +      var map = L.map('map').setView({lon: 0, lat: 0}, 2); 
 + 
 +      // add the OpenStreetMap tiles 
 +      L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png',
 +        maxZoom: 19, 
 +        attribution: '&copy; <a href="https://openstreetmap.org/copyright">OpenStreetMap contributors</a>' 
 +      }).addTo(map); 
 + 
 +      // show the scale bar on the lower left corner 
 +      L.control.scale({imperial: true, metric: true}).addTo(map); 
 + 
 +      // show a marker on the map 
 +      L.marker({lon: 0, lat: 0}).bindPopup('The center of the world').addTo(map); 
 +    </script> 
 +  </body> 
 +</html> 
 +</code> 
 +  - And modify the line that renders the tile layer with this line <code> 
 +L.tileLayer('http://localhost/hot/{z}/{x}/{y}.png',
 +</code>
code/work/lvisf/2021/rtp/server.1643817459.txt.gz · Last modified: 2022/02/02 15:57 by david