Requires to shuffle around the documentation.
make doc will now compile the documentation
in the build directory. The markdowns created
from the vagrant files are no longer versioned.
# Auto-generated vagrant install documentation
-set (INSTALLDOCFILES
- Install-on-Centos-7
- Install-on-Ubuntu-16
- )
-foreach (df ${INSTALLDOCFILES})
- ADD_CUSTOM_COMMAND( OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${df}.md
- COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/bash2md.sh ${PROJECT_SOURCE_DIR}/vagrant/${df}.sh ${CMAKE_CURRENT_BINARY_DIR}/${df}.md
- MAIN_DEPENDENCY ${PROJECT_SOURCE_DIR}/vagrant/${df}.sh
- DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/bash2md.sh
- COMMENT "Creating markdown docs from vagrant/${df}.sh"
- )
+# build the actual documentation
-ADD_CUSTOM_TARGET( md_install_${df} ALL
- DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/${df}.md
- )
-endforeach()
+configure_file(mkdocs.yml ../mkdocs.yml)
+file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/appendix)
-# Copied static documentation
+ADD_CUSTOM_TARGET(doc
+ COMMAND ${CMAKE_COMMAND} -E create_symlink ${CMAKE_CURRENT_SOURCE_DIR}/admin ${CMAKE_CURRENT_BINARY_DIR}/admin
+ COMMAND ${CMAKE_COMMAND} -E create_symlink ${CMAKE_CURRENT_SOURCE_DIR}/index.md ${CMAKE_CURRENT_BINARY_DIR}/index.md
+ COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/bash2md.sh ${PROJECT_SOURCE_DIR}/vagrant/Install-on-Centos-7.sh ${CMAKE_CURRENT_BINARY_DIR}/appendix/Install-on-Centos-7.md
+ COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/bash2md.sh ${PROJECT_SOURCE_DIR}/vagrant/Install-on-Ubuntu-16.sh ${CMAKE_CURRENT_BINARY_DIR}/appendix/Install-on-Ubuntu-16.md
+ COMMAND mkdocs build -d ${CMAKE_CURRENT_BINARY_DIR}/../site-html -f ${CMAKE_CURRENT_BINARY_DIR}/../mkdocs.yml
+)
-set (GENERALDOCFILES
- Installation.md
- Import-and-Update.md
- Faq.md
- )
-
-foreach (df ${GENERALDOCFILES})
- CONFIGURE_FILE(${df} ${df})
-endforeach()
+++ /dev/null
-
-*Note:* these installation instructions are also available in executable
- form for use with vagrant under `vagrant/Install-on-Centos-7.sh`.
-
-Installing the Required Software
-================================
-
-These instructions expect that you have a freshly installed CentOS version 7.
-Make sure all packages are up-to-date by running:
-
- sudo yum update -y
-
-The standard CentOS repositories don't contain all the required packages,
-you need to enable the EPEL repository as well. To enable it on CentOS,
-install the epel-release RPM by running:
-
- sudo yum install -y epel-release
-
-Now you can install all packages needed for Nominatim:
-
- sudo yum install -y postgresql-server postgresql-contrib postgresql-devel postgis postgis-utils \
- git cmake make gcc gcc-c++ libtool policycoreutils-python \
- php-pgsql php php-pear php-pear-DB php-intl libpqxx-devel proj-epsg \
- bzip2-devel proj-devel geos-devel libxml2-devel boost-devel expat-devel zlib-devel
-
-If you want to run the test suite, you need to install the following
-additional packages:
-
- sudo yum install -y python-pip python-Levenshtein python-psycopg2 \
- python-numpy php-phpunit-PHPUnit
- pip install --user --upgrade pip setuptools lettuce==0.2.18 six==1.9 \
- haversine Shapely pytidylib
- sudo pear install PHP_CodeSniffer
-
-
-System Configuration
-====================
-
-The following steps are meant to configure a fresh CentOS installation
-for use with Nominatim. You may skip some of the steps if you have your
-OS already configured.
-
-Creating Dedicated User Accounts
---------------------------------
-
-Nominatim will run as a global service on your machine. It is therefore
-best to install it under its own separate user account. In the following
-we assume this user is called nominatim and the installation will be in
-/srv/nominatim. To create the user and directory run:
-
- sudo useradd -d /srv/nominatim -s /bin/bash -m nominatim
-
-You may find a more suitable location if you wish.
-
-To be able to copy and paste instructions from this manual, export
-user name and home directory now like this:
-
- export USERNAME=nominatim
- export USERHOME=/srv/nominatim
-
-**Never, ever run the installation as a root user.** You have been warned.
-
-Make sure that system servers can read from the home directory:
-
- chmod a+x $USERHOME
-
-Setting up PostgreSQL
----------------------
-
-CentOS does not automatically create a database cluster. Therefore, start
-with initializing the database, then enable the server to start at boot:
-
- sudo postgresql-setup initdb
- sudo systemctl enable postgresql
-
-
-Next tune the postgresql configuration, which is located in
-`/var/lib/pgsql/data/postgresql.conf`. See section *Postgres Tuning* in
-[the installation page](Installation.md) for the parameters to change.
-
-Now start the postgresql service after updating this config file.
-
- sudo systemctl restart postgresql
-
-
-Finally, we need to add two postgres users: one for the user that does
-the import and another for the webserver which should access the database
-only for reading:
-
-
- sudo -u postgres createuser -s $USERNAME
- sudo -u postgres createuser apache
-
-
-Setting up the Apache Webserver
--------------------------------
-
-You need to create an alias to the website directory in your apache
-configuration. Add a separate nominatim configuration to your webserver:
-
-```
-sudo tee /etc/httpd/conf.d/nominatim.conf << EOFAPACHECONF
-<Directory "$USERHOME/Nominatim/build/website">
- Options FollowSymLinks MultiViews
- AddType text/html .php
- DirectoryIndex search.php
- Require all granted
-</Directory>
-
-Alias /nominatim $USERHOME/Nominatim/build/website
-EOFAPACHECONF
-```
-
-
-
-
-Then reload apache
-
-
- sudo systemctl restart httpd
-
-
-Adding SELinux Security Settings
---------------------------------
-
-It is a good idea to leave SELinux enabled and enforcing, particularly
-with a web server accessible from the Internet. At a minimum the
-following SELinux labeling should be done for Nominatim:
-
- sudo semanage fcontext -a -t httpd_sys_content_t "$USERHOME/Nominatim/(website|lib|settings)(/.*)?"
- sudo semanage fcontext -a -t lib_t "$USERHOME/Nominatim/module/nominatim.so"
- sudo restorecon -R -v $USERHOME/Nominatim
-
-
-Installing Nominatim
-====================
-
-Building and Configuration
---------------------------
-
-Get the source code from Github and change into the source directory
-
-
-
- cd $USERHOME
- git clone --recursive git://github.com/openstreetmap/Nominatim.git
- cd Nominatim
-
-
-
-
-
-When installing the latest source from github, you also need to
-download the country grid:
-
-
- wget -O data/country_osm_grid.sql.gz https://www.nominatim.org/data/country_grid.sql.gz
-
-
-The code must be built in a separate directory. Create this directory,
-then configure and build Nominatim in there:
-
-
- mkdir build
- cd build
- cmake $USERHOME/Nominatim
- make
-
-You need to create a minimal configuration file that tells nominatim
-the name of your webserver user and the URL of the website:
-
-```
-tee settings/local.php << EOF
-<?php
- @define('CONST_Database_Web_User', 'apache');
- @define('CONST_Website_BaseURL', '/nominatim/');
-EOF
-```
-
-
-Nominatim is now ready to use. Continue with
-[importing a database from OSM data](Import-and-Update.md).
+++ /dev/null
-
-
-
-
-
-
-
-
-*Note:* these installation instructions are also available in executable
- form for use with vagrant under vagrant/Install-on-Ubuntu-16.sh.
-
-Installing the Required Software
-================================
-
-These instructions expect that you have a freshly installed Ubuntu 16.04.
-
-Make sure all packages are are up-to-date by running:
-
-
-
- sudo apt-get update -qq
-
-Now you can install all packages needed for Nominatim:
-
- sudo apt-get install -y build-essential cmake g++ libboost-dev libboost-system-dev \
- libboost-filesystem-dev libexpat1-dev zlib1g-dev libxml2-dev\
- libbz2-dev libpq-dev libgeos-dev libgeos++-dev libproj-dev \
- postgresql-server-dev-9.5 postgresql-9.5-postgis-2.2 postgresql-contrib-9.5 \
- apache2 php php-pgsql libapache2-mod-php php-pear php-db \
- php-intl git
-
-If you want to run the test suite, you need to install the following
-additional packages:
-
- sudo apt-get install -y python3-setuptools python3-dev python3-pip \
- python3-psycopg2 python3-tidylib phpunit php-cgi
-
- pip3 install --user behave nose # urllib3
- sudo pear install PHP_CodeSniffer
-
-
-System Configuration
-====================
-
-The following steps are meant to configure a fresh Ubuntu installation
-for use with Nominatim. You may skip some of the steps if you have your
-OS already configured.
-
-Creating Dedicated User Accounts
---------------------------------
-
-Nominatim will run as a global service on your machine. It is therefore
-best to install it under its own separate user account. In the following
-we assume this user is called nominatim and the installation will be in
-/srv/nominatim. To create the user and directory run:
-
- sudo useradd -d /srv/nominatim -s /bin/bash -m nominatim
-
-You may find a more suitable location if you wish.
-
-To be able to copy and paste instructions from this manual, export
-user name and home directory now like this:
-
- export USERNAME=nominatim
- export USERHOME=/srv/nominatim
-
-**Never, ever run the installation as a root user.** You have been warned.
-
-Make sure that system servers can read from the home directory:
-
- chmod a+x $USERHOME
-
-Setting up PostgreSQL
----------------------
-
-Tune the postgresql configuration, which is located in
-`/etc/postgresql/9.5/main/postgresql.conf`. See section *Postgres Tuning* in
-[the installation page](Installation.md) for the parameters to change.
-
-Restart the postgresql service after updating this config file.
-
- sudo systemctl restart postgresql
-
-
-Finally, we need to add two postgres users: one for the user that does
-the import and another for the webserver which should access the database
-for reading only:
-
-
- sudo -u postgres createuser -s $USERNAME
- sudo -u postgres createuser www-data
-
-
-Setting up the Apache Webserver
--------------------------------
-
-You need to create an alias to the website directory in your apache
-configuration. Add a separate nominatim configuration to your webserver:
-
-```
-sudo tee /etc/apache2/conf-available/nominatim.conf << EOFAPACHECONF
-<Directory "$USERHOME/Nominatim/build/website">
- Options FollowSymLinks MultiViews
- AddType text/html .php
- DirectoryIndex search.php
- Require all granted
-</Directory>
-
-Alias /nominatim $USERHOME/Nominatim/build/website
-EOFAPACHECONF
-```
-
-
-
-
-Then enable the configuration and restart apache
-
-
- sudo a2enconf nominatim
- sudo systemctl restart apache2
-
-
-Installing Nominatim
-====================
-
-Building and Configuration
---------------------------
-
-Get the source code from Github and change into the source directory
-
-
-
- cd $USERHOME
- git clone --recursive git://github.com/openstreetmap/Nominatim.git
- cd Nominatim
-
-
-
-
-
-When installing the latest source from github, you also need to
-download the country grid:
-
-
- wget -O data/country_osm_grid.sql.gz https://www.nominatim.org/data/country_grid.sql.gz
-
-
-The code must be built in a separate directory. Create this directory,
-then configure and build Nominatim in there:
-
-
- mkdir build
- cd build
- cmake $USERHOME/Nominatim
- make
-
-You need to create a minimal configuration file that tells nominatim
-where it is located on the webserver:
-
-```
-tee settings/local.php << EOF
-<?php
- @define('CONST_Website_BaseURL', '/nominatim/');
-EOF
-```
-
-
-Nominatim is now ready to use. Continue with
-[importing a database from OSM data](Import-and-Update.md).
+++ /dev/null
-Database Migrations
-===================
-
-This page describes database migrations necessary to update existing databases
-to newer versions of Nominatim.
-
-SQL statements should be executed from the postgres commandline. Execute
-`psql nominiatim` to enter command line mode.
-
-3.0.0
------
-
-### Postcode Table
-
-A new separate table for artificially computed postcode centroids was introduced.
-Migration to the new format is possible but **not recommended**.
-
- * create postcode table and indexes, running the following SQL statements:
-
- CREATE TABLE location_postcode
- (place_id BIGINT, parent_place_id BIGINT, rank_search SMALLINT,
- rank_address SMALLINT, indexed_status SMALLINT, indexed_date TIMESTAMP,
- country_code varchar(2), postcode TEXT,
- geometry GEOMETRY(Geometry, 4326));
- CREATE INDEX idx_postcode_geometry ON location_postcode USING GIST (geometry);
- CREATE UNIQUE INDEX idx_postcode_id ON location_postcode USING BTREE (place_id);
- CREATE INDEX idx_postcode_postcode ON location_postcode USING BTREE (postcode);
- GRANT SELECT ON location_postcode TO "www-data";
-
- * add postcode column to location_area tables with SQL statement:
-
- ALTER TABLE location_area ADD COLUMN postcode TEXT;
-
- * reimport functions
-
- ./utils/setup.php --create-functions --enable-diff-updates --create-partition-functions
-
- * create appropriate triggers with SQL:
-
- CREATE TRIGGER location_postcode_before_update BEFORE UPDATE ON location_postcode
- FOR EACH ROW EXECUTE PROCEDURE postcode_update();
-
- * populate postcode table (will take a while):
-
- ./utils/setup.php --calculate-postcodes --index --index-noanalyse
-
-This will create a working database. You may also delete the old artificial
-postcodes now. Note that this may be expensive and is not absolutely necessary.
-The following SQL statement will remove them:
-
- DELETE FROM place_addressline a USING placex p
- WHERE a.address_place_id = p.place_id and p.osm_type = 'P';
- ALTER TABLE placex DISABLE TRIGGER USER;
- DELETE FROM placex WHERE osm_type = 'P';
- ALTER TABLE placex ENABLE TRIGGER USER;
-
-Frequently Asked Questions
-==========================
-
-Running Your Own Instance
--------------------------
+# Running Your Own Instance
### Can I import only a few countries and also keep them up to date?
Make sure there are no spaces at the beginning of your `settings/local.php` file.
-Installation
-------------
+# Installation
### I accidentally killed the import process after it has been running for many hours. Can it be resumed?
Check the last line of output that was logged before the process
was killed. If it looks like this:
- Done 844 in 13 @ 64.923080 per second - Rank 26 ETA (seconds): 7.886255
+
+ Done 844 in 13 @ 64.923080 per second - Rank 26 ETA (seconds): 7.886255
then you can resume with the following command:
- ./utils/setup.php --index --create-search-indices --create-country-names
+```sh
+./utils/setup.php --index --create-search-indices --create-country-names
+```
If the reported rank is 26 or higher, you can also safely add `--index-noanalyse`.
Or
- echo "date.timezone = 'America/Denver'" > /etc/php.d/timezone.ini
-
+```
+echo "date.timezone = 'America/Denver'" > /etc/php.d/timezone.ini
+```
### When running the import I get a version mismatch:
`COPY_END for place failed: ERROR: incompatible library "/opt/Nominatim/module/nominatim.so": version mismatch`
On CentOS v7 the PostgreSQL server is started with `systemd`.
Check if `/usr/lib/systemd/system/httpd.service` contains a line `PrivateTmp=true`.
If so then Apache cannot see the `/tmp/.s.PGSQL.5432` file. It's a good security feature,
-so use the [[#PostgreSQL_UNIX_Socket_Location_on_CentOS|preferred solution]]
+so use the [preferred solution](../appendix/Install-on-Centos-7/#adding-selinux-security-settings).
However, you can solve this the quick and dirty way by commenting out that line and then run
sudo pear install DB
-### I forgot to delete the flatnodes file before starting an import
+### I forgot to delete the flatnodes file before starting an import.
That's fine. For each import the flatnodes file get overwritten.
See https://help.openstreetmap.org/questions/52419/nominatim-flatnode-storage
-Importing a new database
-========================
-
The following instructions explain how to create a Nominatim database
from an OSM planet file and how to keep the database up to date. It
is assumed that you have already successfully installed the Nominatim
software itself, if not return to the [installation page](Installation.md).
-Configuration setup in settings/local.php
------------------------------------------
+# Configuration setup in settings/local.php
+
+The Nominatim server can be customized via the file `settings/local.php`
+in the build directory. Note that this is a PHP file, so it must always
+start like this:
+
+ <?php
+
+without any leading spaces.
There are lots of configuration settings you can tweak. Have a look
-at `settings/settings.php` for a full list. Most should have a sensible default.
+at `settings/default.php` for a full list. Most should have a sensible default.
+
+### Flatnode files
+
If you plan to import a large dataset (e.g. Europe, North America, planet),
you should also enable flatnode storage of node locations. With this
setting enabled, node coordinates are stored in a simple file instead
@define('CONST_Osm2pgsql_Flatnode_File', '/path/to/flatnode.file');
Replace the second part with a suitable path on your system and make sure
-the directory exists. There should be at least 35GB of free space.
+the directory exists. There should be at least 40GB of free space.
-Downloading additional data
----------------------------
+# Downloading additional data
-### Wikipedia rankings
+## Wikipedia rankings
Wikipedia can be used as an optional auxiliary data source to help indicate
the importance of osm features. Nominatim will work without this information
the initial import of the data if you want the rankings applied to the
loaded data.
-### UK postcodes
+## UK postcodes
Nominatim can use postcodes from an external source to improve searches that involve a UK postcode. This data can be optionally downloaded:
wget https://www.nominatim.org/data/gb_postcode_data.sql.gz
-Initial import of the data
---------------------------
+# Initial import of the data
**Important:** first try the import with a small excerpt, for example from
[Geofabrik](https://download.geofabrik.de).
Download the data to import and load the data with the following command:
- ./utils/setup.php --osm-file <your data file> --all [--osm2pgsql-cache 28000] 2>&1 | tee setup.log
+```sh
+./utils/setup.php --osm-file <data file> --all [--osm2pgsql-cache 28000] 2>&1 | tee setup.log
+```
The `--osm2pgsql-cache` parameter is optional but strongly recommended for
planet imports. It sets the node cache size for the osm2pgsql import part
-(see `-C` parameter in osm2pgsql help). 28GB are recommended for a full planet
-import, for excerpts you can use less. Adapt to your available RAM to
-avoid swapping, never give more than 2/3 of RAM to osm2pgsql.
-
+(see `-C` parameter in osm2pgsql help). As a rule of thumb, this should be
+about the same size as the file you are importing but never more than
+2/3 of RAM available. If your machine starts swapping reduce the size.
Computing word frequency for search terms can improve the performance of
forward geocoding in particular under high load as it helps Postgres' query
planner to make the right decisions. To recompute word counts run:
- ./utils/update.php --recompute-word-counts
+```sh
+./utils/update.php --recompute-word-counts
+```
This will take a couple of hours for a full planet installation. You can
also defer that step to a later point in time when you realise that
performance becomes an issue. Just make sure that updates are stopped before
running this function.
-Loading additional datasets
----------------------------
-
-The following commands will create additional entries for POI searches:
+If you want to be able to search for places by their type through
+[special key phrases](https://wiki.openstreetmap.org/wiki/Nominatim/Special_Phrases)
+you also need to enable these key phrases like this:
./utils/specialphrases.php --wiki-import > specialphrases.sql
psql -d nominatim -f specialphrases.sql
+Note that this command downloads the phrases from the wiki link above.
+
-Installing Tiger housenumber data for the US
-============================================
+# Installing Tiger housenumber data for the US
Nominatim is able to use the official TIGER address set to complement the
-OSM housenumber data in the US. You can add TIGER data to your own Nominatim
+OSM house number data in the US. You can add TIGER data to your own Nominatim
instance by following these steps:
1. Install the GDAL library and python bindings and the unzip tool
* Ubuntu: `sudo apt-get install python-gdal unzip`
* CentOS: `sudo yum install gdal-python unzip`
- 2. Get the TIGER 2015 data. You will need the EDGES files
- (3,234 zip files, 11GB total). Choose one of the two sources:
+ 2. Get preprocessed TIGER 2015 data and unpack it into the
+ data directory in your Nominatim sources:
- wget -r ftp://ftp2.census.gov/geo/tiger/TIGER2015/EDGES/
- wget -r ftp://mirror1.shellbot.com/census/geo/tiger/TIGER2015/EDGES/
+ cd Nominatim/data
+ wget https://nominatim.org/data/tiger2017-nominatim-preprocessed.tar.gz
+ tar xf tiger2017-nominatim-preprocessed.tar.gz
- The first one is the original source, the second a considerably faster
- mirror.
+ 3. Import the data into your Nominatim database:
- 3. Convert the data into SQL statements (stored in data/tiger):
+ ./utils/setup.php --import-tiger-data
- ./utils/imports.php --parse-tiger <tiger edge data directory>
+ 4. Enable use of the Tiger data in your `settings/local.php` by adding:
+
+ @define('CONST_Use_US_Tiger_Data', true);
- 4. Import the data into your Nominatim database:
+ 5. Apply the new settings:
- ./utils/setup.php --import-tiger-data
+```sh
+ ./utils/setup.php --create-functions --enable-diff-updates --create-partition-functions
+```
- 5. Enable use of the Tiger data in your `settings/local.php` by adding:
+The entire US adds about 10GB to your database.
- @define('CONST_Use_US_Tiger_Data', true);
+You can also process the data from the original TIGER data to create the
+SQL files, Nominatim needs for the import:
- 6. Apply the new settings:
+ 1. Get the TIGER 2017 data. You will need the EDGES files
+ (3,234 zip files, 11GB total). Choose one of the two sources:
- ./utils/setup.php --create-functions --enable-diff-updates --create-partition-functions
+ wget -r ftp://ftp2.census.gov/geo/tiger/TIGER2017/EDGES/
+ wget -r ftp://mirror1.shellbot.com/census/geo/tiger/TIGER2017/EDGES/
-Be warned that the import can take a very long time, especially if you
-import all of the US. The entire US adds about 10GB to your database.
+ The first one is the original source, the second a considerably faster
+ mirror.
+
+ 2. Convert the data into SQL statements:
+
+ ./utils/imports.php --parse-tiger <tiger edge data directory>
+Be warned that this can take quite a long time. After this process is finished,
+the same preprocessed files as above are available in `data/tiger`.
-Updates
-=======
+# Updates
There are many different possibilities to update your Nominatim database.
The following section describes how to keep it up-to-date with Pyosmium.
For a list of other methods see the output of `./utils/update.php --help`.
-Installing the newest version of Pyosmium
------------------------------------------
+### Installing the newest version of Pyosmium
It is recommended to install Pyosmium via pip. Run (as the same user who
will later run the updates):
- pip install --user osmium
+```sh
+pip install --user osmium
+```
Nominatim needs a tool called `pyosmium-get-updates` that comes with
Pyosmium. You need to tell Nominatim where to find it. Add the
The path above is fine if you used the `--user` parameter with pip.
Replace `user` with your user name.
-Setting up the update process
------------------------------
+### Setting up the update process
Next the update needs to be initialised. By default Nominatim is configured
to update using the global minutely diffs.
The --init-updates command needs to be rerun whenever the replication service
is changed.
-Updating Nominatim
-------------------
+### Updating Nominatim
The following command will keep your database constantly up to date:
-Nominatim installation
-======================
-
This page contains generic installation instructions for Nominatim and its
prerequisites. There are also step-by-step instructions available for
the following operating systems:
- * [Ubuntu 16.04](Install-on-Ubuntu-16.md)
- * [CentOS 7.2](Install-on-Centos-7.md)
+ * [Ubuntu 16.04](../appendix/Install-on-Ubuntu-16.md)
+ * [CentOS 7.2](../appendix/Install-on-Centos-7.md)
These OS-specific instructions can also be found in executable form
in the `vagrant/` directory.
-Prerequisites
--------------
+# Prerequisites
-### Software
+## Software
For compiling:
* [pyosmium](http://osmcode.org/pyosmium/)
-### Hardware
+## Hardware
A minimum of 2GB of RAM is required or installation will fail. For a full
planet import 32GB of RAM or more strongly are recommended.
-For a full planet install you will need about 500GB of hard disk space (as of
-June 2016, take into account that the OSM database is growing fast). SSD disks
+For a full planet install you will need about 600GB of hard disk space (as of
+January 2017, take into account that the OSM database is growing fast). SSD disks
will help considerably to speed up import and queries.
On a 6-core machine with 32GB RAM and SSDs the import of a full planet takes
a bit more than 2 days. Without SSDs 7-8 days are more realistic.
-Setup of the server
--------------------
+# Setup of the server
-### PostgreSQL tuning
+## PostgreSQL tuning
You might want to tune your PostgreSQL installation so that the later steps
make best use of your hardware. You should tune the following parameters in
corruption. Autovacuum must not be switched off because it ensures that the
tables are frequently analysed.
-### Webserver setup
+## Webserver setup
The `website/` directory in the build directory contains the configured
website. Include the directory into your webbrowser to serve php files
from there.
-#### Configure for use with Apache
+### Configure for use with Apache
Make sure your Apache configuration contains the required permissions for the
directory and create an alias:
After making changes in the apache config you need to restart apache.
The website should now be available on http://localhost/nominatim.
-#### Configure for use with Nginx
+### Configure for use with Nginx
Use php-fpm as a deamon for serving PHP cgi. Install php-fpm together with nginx.
}
Restart the nginx and php5-fpm services and the website should now be available
-on http://localhost/.
+at `http://localhost/`.
Now continue with [importing the database](Import-and-Update.md).
--- /dev/null
+Database Migrations
+===================
+
+This page describes database migrations necessary to update existing databases
+to newer versions of Nominatim.
+
+SQL statements should be executed from the postgres commandline. Execute
+`psql nominiatim` to enter command line mode.
+
+# 3.0.0 -> 3.1.0
+
+### Postcode Table
+
+A new separate table for artificially computed postcode centroids was introduced.
+Migration to the new format is possible but **not recommended**.
+
+Create postcode table and indexes, running the following SQL statements:
+
+```sql
+CREATE TABLE location_postcode
+ (place_id BIGINT, parent_place_id BIGINT, rank_search SMALLINT,
+ rank_address SMALLINT, indexed_status SMALLINT, indexed_date TIMESTAMP,
+ country_code varchar(2), postcode TEXT,
+ geometry GEOMETRY(Geometry, 4326));
+CREATE INDEX idx_postcode_geometry ON location_postcode USING GIST (geometry);
+CREATE UNIQUE INDEX idx_postcode_id ON location_postcode USING BTREE (place_id);
+CREATE INDEX idx_postcode_postcode ON location_postcode USING BTREE (postcode);
+GRANT SELECT ON location_postcode TO "www-data";
+```
+
+Add postcode column to `location_area` tables with SQL statement:
+
+```sql
+ALTER TABLE location_area ADD COLUMN postcode TEXT;
+```
+
+Then reimport the functions:
+
+```sh
+./utils/setup.php --create-functions --enable-diff-updates --create-partition-functions
+```
+
+Create appropriate triggers with SQL:
+
+```sql
+CREATE TRIGGER location_postcode_before_update BEFORE UPDATE ON location_postcode
+ FOR EACH ROW EXECUTE PROCEDURE postcode_update();
+```
+
+Finally populate the postcode table (will take a while):
+
+```sh
+./utils/setup.php --calculate-postcodes --index --index-noanalyse
+```
+
+This will create a working database. You may also delete the old artificial
+postcodes now. Note that this may be expensive and is not absolutely necessary.
+The following SQL statement will remove them:
+
+```sql
+DELETE FROM place_addressline a USING placex p
+ WHERE a.address_place_id = p.place_id and p.osm_type = 'P';
+ALTER TABLE placex DISABLE TRIGGER USER;
+DELETE FROM placex WHERE osm_type = 'P';
+ALTER TABLE placex ENABLE TRIGGER USER;
+```
--- /dev/null
+Nominatim (from the Latin, 'by name') is a tool to search OSM data by name and address and to generate synthetic addresses of OSM points (reverse geocoding).
--- /dev/null
+site_name: Nominatim Documentation
+theme: readthedocs
+docs_dir: ${CMAKE_CURRENT_BINARY_DIR}
+site_url: http://nominatim.org
+repo_url: https://github.com/openstreetmap/Nominatim
+pages:
+ - 'Introduction' : 'index.md'
+ - 'Administration Guide':
+ - 'Basic Installation': 'admin/Installation.md'
+ - 'Importing and Updating' : 'admin/Import-and-Update.md'
+ - 'Migration from older Versions' : 'admin/Migration.md'
+ - 'Troubleshooting' : 'admin/Faq.md'
+ - 'Appendix':
+ - 'Installation on CentOS 7' : 'appendix/Install-on-Centos-7.md'
+ - 'Installation on Ubuntu 16' : 'appendix/Install-on-Ubuntu-16.md'