1 This page contains generic installation instructions for Nominatim and its
2 prerequisites. There are also step-by-step instructions available for
3 the following operating systems:
5 * [Ubuntu 16.04](../appendix/Install-on-Ubuntu-16.md)
6 * [CentOS 7.2](../appendix/Install-on-Centos-7.md)
8 These OS-specific instructions can also be found in executable form
9 in the `vagrant/` directory.
17 * [cmake](https://cmake.org/)
18 * [libxml2](http://xmlsoft.org/)
19 * a recent C++ compiler
21 Nominatim comes with its own version of osm2pgsql. See the
22 [osm2pgsql README](../osm2pgsql/README.md) for additional dependencies
23 required for compiling osm2pgsql.
27 * [behave](http://pythonhosted.org/behave/)
28 * [Psycopg2](http://initd.org/psycopg)
29 * [nose](https://nose.readthedocs.io)
30 * [phpunit](https://phpunit.de)
32 For running Nominatim:
34 * [PostgreSQL](http://www.postgresql.org) (9.1 or later)
35 * [PostGIS](http://postgis.refractions.net) (2.0 or later)
36 * [PHP](http://php.net) (5.4 or later)
38 * PHP-intl (bundled with PHP)
39 * [PEAR::DB](http://pear.php.net/package/DB)
40 * a webserver (apache or nginx are recommended)
42 For running continuous updates:
44 * [pyosmium](http://osmcode.org/pyosmium/)
48 A minimum of 2GB of RAM is required or installation will fail. For a full
49 planet import 32GB of RAM or more strongly are recommended.
51 For a full planet install you will need about 600GB of hard disk space (as of
52 January 2017, take into account that the OSM database is growing fast). SSD disks
53 will help considerably to speed up import and queries.
55 On a 6-core machine with 32GB RAM and SSDs the import of a full planet takes
56 a bit more than 2 days. Without SSDs 7-8 days are more realistic.
63 You might want to tune your PostgreSQL installation so that the later steps
64 make best use of your hardware. You should tune the following parameters in
65 your `postgresql.conf` file.
68 maintenance_work_mem (10GB)
70 effective_cache_size (24GB)
71 synchronous_commit = off
72 checkpoint_segments = 100 # only for postgresql <= 9.4
73 checkpoint_timeout = 10min
74 checkpoint_completion_target = 0.9
76 The numbers in brackets behind some parameters seem to work fine for
77 32GB RAM machine. Adjust to your setup.
79 For the initial import, you should also set:
82 full_page_writes = off
84 Don't forget to reenable them after the initial import or you risk database
85 corruption. Autovacuum must not be switched off because it ensures that the
86 tables are frequently analysed.
90 The `website/` directory in the build directory contains the configured
91 website. Include the directory into your webbrowser to serve php files
94 ### Configure for use with Apache
96 Make sure your Apache configuration contains the required permissions for the
97 directory and create an alias:
99 <Directory "/srv/nominatim/build/website">
100 Options FollowSymLinks MultiViews
101 AddType text/html .php
102 DirectoryIndex search.php
105 Alias /nominatim /srv/nominatim/build/website
107 `/srv/nominatim/build` should be replaced with the location of your
110 After making changes in the apache config you need to restart apache.
111 The website should now be available on http://localhost/nominatim.
113 ### Configure for use with Nginx
115 Use php-fpm as a deamon for serving PHP cgi. Install php-fpm together with nginx.
117 By default php listens on a network socket. If you want it to listen to a
118 Unix socket instead, change the pool configuration (`pool.d/www.conf`) as
121 ; Comment out the tcp listener and add the unix socket
122 ;listen = 127.0.0.1:9000
123 listen = /var/run/php5-fpm.sock
125 ; Ensure that the daemon runs as the correct user
126 listen.owner = www-data
127 listen.group = www-data
130 Tell nginx that php files are special and to fastcgi_pass to the php-fpm
131 unix socket by adding the location definition to the default configuration.
133 root /srv/nominatim/build/website;
134 index search.php index.html;
135 location ~ [^/]\.php(/|$) {
136 fastcgi_split_path_info ^(.+?\.php)(/.*)$;
137 if (!-f $document_root$fastcgi_script_name) {
140 fastcgi_pass unix:/var/run/php5-fpm.sock;
141 fastcgi_index search.php;
142 include fastcgi.conf;
145 Restart the nginx and php5-fpm services and the website should now be available
146 at `http://localhost/`.
149 Now continue with [importing the database](Import-and-Update.md).