Guest User

Untitled

a guest
Mar 3rd, 2019
234
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. sudo apt-get update -qq
  2. sudo apt-get install -y build-essential cmake g++ libboost-dev libboost-system-dev \
  3.                         libboost-filesystem-dev libexpat1-dev zlib1g-dev libxml2-dev\
  4.                         libbz2-dev libpq-dev libproj-dev \
  5.                         postgresql-server-dev-10 postgresql-10-postgis-2.4 \
  6.                         postgresql-contrib-10 \
  7.                         apache2 php php-pgsql libapache2-mod-php php-pear php-db \
  8.                         php-intl git
  9.  
  10. export USERNAME=ubuntu
  11. export USERHOME=/home/ubuntu/nominatim
  12. export NOMINATIM_SOURCE_DIR=$USERHOME/Nominatim-3.2.0
  13. export APACHE_BASE_DIR=$NOMINATIM_SOURCE_DIR/build/website
  14. mkdir nominatim
  15.  
  16. # create 32GB swap file
  17. sudo dd if=/dev/zero of=/swapfile bs=1G count=32
  18. sudo chmod 600 /swapfile
  19. sudo mkswap /swapfile
  20. sudo swapon /swapfile
  21. sudo tee -a /etc/fstab << EOFFSTAB
  22. /swapfile swap swap defaults 0 0
  23. EOFFSTAB
  24.  
  25. # postgresql
  26. sudo tee -a /etc/postgresql/10/main/postgresql.conf << EOFPOSTGRESCONF
  27. # settings for 32GB memory
  28. shared_buffers = 2GB
  29. maintenance_work_mem = 10GB
  30. work_mem = 50MB
  31. effective_cache_size = 24GB
  32. synchronous_commit = off
  33. #checkpoint_segments = 100 # only for postgresql <= 9.4
  34. checkpoint_timeout = 10min
  35. checkpoint_completion_target = 0.9
  36.  
  37. fsync = off
  38. full_page_writes = off
  39. EOFPOSTGRESCONF
  40.  
  41. sudo systemctl restart postgresql
  42.  
  43. sudo -u postgres createuser -s $USERNAME
  44. sudo -u postgres createuser www-data
  45.  
  46. # apache
  47. sudo tee /etc/apache2/conf-available/nominatim.conf << EOFAPACHECONF
  48. <Directory "$APACHE_BASE_DIR">
  49.   Options FollowSymLinks MultiViews
  50.   AddType text/html   .php
  51.   DirectoryIndex search.php
  52.   Require all granted
  53. </Directory>
  54.  
  55. Alias /nominatim $APACHE_BASE_DIR
  56. EOFAPACHECONF
  57.  
  58. sudo a2enconf nominatim
  59. sudo systemctl restart apache2
  60.  
  61. # nominatim
  62. cd $USERHOME
  63. wget https://nominatim.org/release/Nominatim-3.2.0.tar.bz2
  64. tar xf Nominatim-3.2.0.tar.bz2
  65. cd Nominatim-3.2.0
  66. mkdir build
  67. cd build
  68. cmake ..
  69. make
  70.  
  71. tee settings/local.php << EOF
  72. <?php
  73.  @define('CONST_Website_BaseURL', '/nominatim/');
  74.  @define('CONST_Osm2pgsql_Flatnode_File', '$USERHOME/flatnode.file');
  75. EOF
  76.  
  77. touch $USERHOME/flatnode.file
  78.  
  79. # load auxiliary data
  80. cd $NOMINATIM_SOURCE_DIR/data
  81. wget https://www.nominatim.org/data/wikipedia_article.sql.bin
  82. wget https://www.nominatim.org/data/wikipedia_redirect.sql.bin
  83. wget https://www.nominatim.org/data/gb_postcode_data.sql.gz
  84.  
  85. # ingest geodata
  86. cd $NOMINATIM_SOURCE_DIR/build
  87. # whole planet
  88. wget https://planet.openstreetmap.org/pbf/planet-latest.osm.pbf
  89. ./utils/setup.php --osm-file planet-latest.osm.pbf --all --osm2pgsql-cache 24000 2>&1 | tee setup.log
RAW Paste Data