]> git.openstreetmap.org Git - nominatim.git/blob - docs/admin/Installation.md
remove datrie dependency
[nominatim.git] / docs / admin / Installation.md
1 # Basic Installation
2
3 This page contains generic installation instructions for Nominatim and its
4 prerequisites. There are also step-by-step instructions available for
5 the following operating systems:
6
7   * [Ubuntu 24.04](Install-on-Ubuntu-24.md)
8   * [Ubuntu 22.04](Install-on-Ubuntu-22.md)
9
10 These OS-specific instructions can also be found in executable form
11 in the `vagrant/` directory.
12
13 Users have created instructions for other frameworks. We haven't tested those
14 and can't offer support.
15
16   * [Docker](https://github.com/mediagis/nominatim-docker)
17   * [Docker on Kubernetes](https://github.com/peter-evans/nominatim-k8s)
18   * [Kubernetes with Helm](https://github.com/robjuz/helm-charts/blob/master/charts/nominatim/README.md)
19   * [Ansible](https://github.com/synthesio/infra-ansible-nominatim)
20
21 ## Prerequisites
22
23 ### Software
24
25 For running Nominatim:
26
27   * [PostgreSQL](https://www.postgresql.org) (12+ will work, 13+ strongly recommended)
28   * [PostGIS](https://postgis.net) (3.0+ will work, 3.2+ strongly recommended)
29   * [osm2pgsql](https://osm2pgsql.org) (1.8+)
30   * [Python 3](https://www.python.org/) (3.7+)
31
32 Furthermore the following Python libraries are required:
33
34   * [Psycopg3](https://www.psycopg.org)
35   * [Python Dotenv](https://github.com/theskumar/python-dotenv)
36   * [psutil](https://github.com/giampaolo/psutil)
37   * [Jinja2](https://palletsprojects.com/p/jinja/)
38   * [PyICU](https://pypi.org/project/PyICU/)
39   * [PyYaml](https://pyyaml.org/) (5.1+)
40
41 These will be installed automatically when using pip installation.
42
43 For running continuous updates:
44
45   * [pyosmium](https://osmcode.org/pyosmium/)
46
47 For running the Python frontend:
48
49   * [SQLAlchemy](https://www.sqlalchemy.org/) (1.4.31+ with greenlet support)
50   * [asyncpg](https://magicstack.github.io/asyncpg) (0.8+, only when using SQLAlchemy < 2.0)
51   * one of the following web frameworks:
52     * [falcon](https://falconframework.org/) (3.0+)
53     * [starlette](https://www.starlette.io/)
54   * [uvicorn](https://www.uvicorn.org/)
55
56 For dependencies for running tests and building documentation, see
57 the [Development section](../develop/Development-Environment.md).
58
59 ### Hardware
60
61 A minimum of 2GB of RAM is required or installation will fail. For a full
62 planet import 128GB of RAM or more are strongly recommended. Do not report
63 out of memory problems if you have less than 64GB RAM.
64
65 For a full planet install you will need at least 1TB of hard disk space.
66 Take into account that the OSM database is growing fast.
67 Fast disks are essential. Using NVME disks is recommended.
68
69 Even on a well configured machine the import of a full planet takes
70 around 2.5 days. When using traditional SSDs, 4-5 days are more realistic.
71
72 ## Tuning the PostgreSQL database
73
74 You might want to tune your PostgreSQL installation so that the later steps
75 make best use of your hardware. You should tune the following parameters in
76 your `postgresql.conf` file.
77
78     shared_buffers = 2GB
79     maintenance_work_mem = (10GB)
80     autovacuum_work_mem = 2GB
81     work_mem = (50MB)
82     synchronous_commit = off
83     max_wal_size = 1GB
84     checkpoint_timeout = 60min
85     checkpoint_completion_target = 0.9
86     random_page_cost = 1.0
87     wal_level = minimal
88     max_wal_senders = 0
89
90 The numbers in brackets behind some parameters seem to work fine for
91 128GB RAM machine. Adjust to your setup. A higher number for `max_wal_size`
92 means that PostgreSQL needs to run checkpoints less often but it does require
93 the additional space on your disk.
94
95 Autovacuum must not be switched off because it ensures that the
96 tables are frequently analysed. If your machine has very little memory,
97 you might consider setting:
98
99     autovacuum_max_workers = 1
100
101 and even reduce `autovacuum_work_mem` further. This will reduce the amount
102 of memory that autovacuum takes away from the import process.
103
104 ## Installing the latest release
105
106 Nominatim is easiest installed directly from Pypi. Make sure you have installed
107 osm2pgsql, PostgreSQL/PostGIS and libICU together with its header files.
108
109 Then you can install Nominatim with:
110
111     pip install nominatim-db nominatim-api
112
113 ## Downloading and building Nominatim
114
115 ### Downloading the latest release
116
117 You can download the [latest release from nominatim.org](https://nominatim.org/downloads/).
118 The release contains all necessary files. Just unpack it.
119
120 ### Downloading the latest development version
121
122 If you want to install latest development version from github:
123
124 ```
125 git clone https://github.com/osm-search/Nominatim.git
126 ```
127
128 The development version does not include the country grid. Download it separately:
129
130 ```
131 wget -O Nominatim/data/country_osm_grid.sql.gz https://nominatim.org/data/country_grid.sql.gz
132 ```
133
134 ### Building Nominatim
135
136 Nominatim is easiest to run from its own virtual environment. To create one, run:
137
138     sudo apt-get install virtualenv
139     virtualenv /srv/nominatim-venv
140
141 To install Nominatim directly from the source tree into the virtual environment, run:
142
143     /srv/nominatim-venv/bin/pip install packaging/nominatim-{db,api}
144
145
146 Now continue with [importing the database](Import.md).