@@ -25,15 +25,7 @@ export DEBIAN_FRONTEND=noninteractive #DOCS:
25
25
libbz2-dev libpq-dev liblua5.3-dev lua5.3 lua-dkjson \
26
26
nlohmann-json3-dev postgresql-14-postgis-3 \
27
27
postgresql-contrib-14 postgresql-14-postgis-3-scripts \
28
- libicu-dev python3-dotenv \
29
- python3-pip python3-psutil python3-jinja2 \
30
- python3-sqlalchemy python3-asyncpg \
31
- python3-icu python3-datrie python3-yaml git
32
-
33
- # Some of the Python packages that come with Ubuntu 22.04 are too old,
34
- # so install the latest version from pip:
35
-
36
- pip3 install --user psycopg[binary]
28
+ libicu-dev virtualenv git
37
29
38
30
#
39
31
# System Configuration
@@ -109,7 +101,7 @@ fi #DOCS:
109
101
#
110
102
if [ " x$1 " == " xyes" ]; then # DOCS: :::sh
111
103
cd $USERHOME
112
- git clone --recursive https://github.com/openstreetmap /Nominatim.git
104
+ git clone https://github.com/osm-search /Nominatim.git
113
105
cd Nominatim
114
106
else # DOCS:
115
107
cd $USERHOME /Nominatim # DOCS:
@@ -122,14 +114,31 @@ if [ ! -f data/country_osm_grid.sql.gz ]; then #DOCS: :::sh
122
114
wget -O data/country_osm_grid.sql.gz https://nominatim.org/data/country_grid.sql.gz
123
115
fi # DOCS:
124
116
125
- # The code must be built in a separate directory. Create this directory,
126
- # then configure and build Nominatim in there :
117
+ # Nominatim needs osm2pgsql >= 1.8. The version that comes with Ubuntu is
118
+ # too old. Download and compile your own :
127
119
128
- mkdir $USERHOME /build
129
- cd $USERHOME /build
130
- cmake $USERHOME /Nominatim
120
+ cd $USERHOME
121
+ git clone https://github.com/osm2pgsql-dev/osm2pgsql
122
+ mkdir osm2pgsql-build
123
+ cd osm2pgsql-build
124
+ cmake ../osm2pgsql
131
125
make
132
126
sudo make install
127
+ cd $USERHOME /Nominatim
128
+
129
+ # Nominatim should be installed in a separate Python virtual environment.
130
+ # Create the virtual environment:
131
+
132
+ virtualenv $USERHOME /nominatim-venv
133
+
134
+ # We want the faster binary version pf psycopg, so install that:
135
+
136
+ $USERHOME /nominatim-venv/bin/pip install psycopg[binary]
137
+
138
+ # Now install Nominatim using pip:
139
+
140
+ cd $USERHOME /Nominatim
141
+ $USERHOME /nominatim-venv/bin/pip install packaging/nominatim-db
133
142
134
143
# Nominatim is now ready to use. You can continue with
135
144
# [importing a database from OSM data](../admin/Import.md). If you want to set up
@@ -138,18 +147,19 @@ fi #DOCS:
138
147
# Setting up the Python frontend
139
148
# ==============================
140
149
#
141
- # Some of the Python packages in Ubuntu are too old. Therefore run the
142
- # frontend from a Python virtualenv with current packages.
150
+ # The Python frontend is contained in the nominatim-api package. To run
151
+ # the API as a webservice, you also need falcon with uvicorn to serve the API.
152
+ # It is generally recommended to run falcon/uvicorn on top of gunicorn.
143
153
#
144
- # To set up the virtualenv , run:
154
+ # To install all packages , run:
145
155
146
156
# DOCS:```sh
147
- sudo apt-get install -y virtualenv
148
- virtualenv $USERHOME /nominatim-venv
149
- $USERHOME /nominatim-venv/bin/pip install SQLAlchemy PyICU psycopg[binary] \
150
- psycopg2-binary python-dotenv PyYAML falcon uvicorn gunicorn
157
+ $USERHOME /nominatim-venv/bin/pip install falcon uvicorn gunicorn
158
+ cd $USERHOME /Nominatim
159
+ $USERHOME /nominatim-venv/bin/pip install packaging/nominatim-api
151
160
# DOCS:```
152
161
162
+
153
163
# Next you need to create a systemd job that runs Nominatim on gunicorn.
154
164
# First create a systemd job that manages the socket file:
155
165
@@ -178,14 +188,11 @@ Requires=nominatim.socket
178
188
179
189
[Service]
180
190
Type=simple
181
- Environment="PYTHONPATH=/usr/local/lib/nominatim/lib-python/"
182
191
User=www-data
183
192
Group=www-data
184
193
WorkingDirectory=$USERHOME /nominatim-project
185
- ExecStart=$USERHOME /nominatim-venv/bin/gunicorn -b unix:/run/nominatim.sock -w 4 -k uvicorn.workers.UvicornWorker nominatim_api.server.falcon.server:run_wsgi
194
+ ExecStart=$USERHOME /nominatim-venv/bin/gunicorn -b unix:/run/nominatim.sock -w 4 -k uvicorn.workers.UvicornWorker " nominatim_api.server.falcon.server:run_wsgi()"
186
195
ExecReload=/bin/kill -s HUP \$ MAINPID
187
- StandardOutput=append:/var/log/gunicorn-nominatim.log
188
- StandardError=inherit
189
196
PrivateTmp=true
190
197
TimeoutStopSec=5
191
198
KillMode=mixed
0 commit comments