Skip to content

Commit c4a726c

Browse files
committed
update Ubuntu22 install script for pip install
1 parent a408da4 commit c4a726c

File tree

2 files changed

+40
-31
lines changed

2 files changed

+40
-31
lines changed

Diff for: vagrant/Install-on-Ubuntu-22.sh

+33-26
Original file line numberDiff line numberDiff line change
@@ -25,15 +25,7 @@ export DEBIAN_FRONTEND=noninteractive #DOCS:
2525
libbz2-dev libpq-dev liblua5.3-dev lua5.3 lua-dkjson \
2626
nlohmann-json3-dev postgresql-14-postgis-3 \
2727
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
3729

3830
#
3931
# System Configuration
@@ -109,7 +101,7 @@ fi #DOCS:
109101
#
110102
if [ "x$1" == "xyes" ]; then #DOCS: :::sh
111103
cd $USERHOME
112-
git clone --recursive https://github.com/openstreetmap/Nominatim.git
104+
git clone https://github.com/osm-search/Nominatim.git
113105
cd Nominatim
114106
else #DOCS:
115107
cd $USERHOME/Nominatim #DOCS:
@@ -122,14 +114,31 @@ if [ ! -f data/country_osm_grid.sql.gz ]; then #DOCS: :::sh
122114
wget -O data/country_osm_grid.sql.gz https://nominatim.org/data/country_grid.sql.gz
123115
fi #DOCS:
124116

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:
127119

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
131125
make
132126
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
133142

134143
# Nominatim is now ready to use. You can continue with
135144
# [importing a database from OSM data](../admin/Import.md). If you want to set up
@@ -138,18 +147,19 @@ fi #DOCS:
138147
# Setting up the Python frontend
139148
# ==============================
140149
#
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.
143153
#
144-
# To set up the virtualenv, run:
154+
# To install all packages, run:
145155

146156
#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
151160
#DOCS:```
152161

162+
153163
# Next you need to create a systemd job that runs Nominatim on gunicorn.
154164
# First create a systemd job that manages the socket file:
155165

@@ -178,14 +188,11 @@ Requires=nominatim.socket
178188
179189
[Service]
180190
Type=simple
181-
Environment="PYTHONPATH=/usr/local/lib/nominatim/lib-python/"
182191
User=www-data
183192
Group=www-data
184193
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()"
186195
ExecReload=/bin/kill -s HUP \$MAINPID
187-
StandardOutput=append:/var/log/gunicorn-nominatim.log
188-
StandardError=inherit
189196
PrivateTmp=true
190197
TimeoutStopSec=5
191198
KillMode=mixed

Diff for: vagrant/Install-on-Ubuntu-24.sh

+7-5
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ fi #DOCS:
9898
#
9999
if [ "x$1" == "xyes" ]; then #DOCS: :::sh
100100
cd $USERHOME
101-
git clone https://github.com/openstreetmap/Nominatim.git
101+
git clone https://github.com/osm-search/Nominatim.git
102102
cd Nominatim
103103
else #DOCS:
104104
cd $USERHOME/Nominatim #DOCS:
@@ -116,6 +116,10 @@ fi #DOCS:
116116

117117
virtualenv $USERHOME/nominatim-venv
118118

119+
# We want the faster binary version pf psycopg, so install that:
120+
121+
$USERHOME/nominatim-venv/bin/pip install psycopg[binary]
122+
119123
# Now install Nominatim using pip:
120124

121125
cd $USERHOME/Nominatim
@@ -143,7 +147,7 @@ fi #DOCS:
143147
# To install all packages, run:
144148

145149
#DOCS:```sh
146-
$USERHOME/nominatim-venv/bin/pip install psycopg[binary] falcon uvicorn gunicorn
150+
$USERHOME/nominatim-venv/bin/pip install falcon uvicorn gunicorn
147151
cd $USERHOME/Nominatim
148152
$USERHOME/nominatim-venv/bin/pip install packaging/nominatim-api
149153
#DOCS:```
@@ -179,10 +183,8 @@ Type=simple
179183
User=www-data
180184
Group=www-data
181185
WorkingDirectory=$USERHOME/nominatim-project
182-
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+
ExecStart=$USERHOME/nominatim-venv/bin/gunicorn -b unix:/run/nominatim.sock -w 4 -k uvicorn.workers.UvicornWorker "nominatim_api.server.falcon.server:run_wsgi()"
183187
ExecReload=/bin/kill -s HUP \$MAINPID
184-
StandardOutput=append:/var/log/gunicorn-nominatim.log
185-
StandardError=inherit
186188
PrivateTmp=true
187189
TimeoutStopSec=5
188190
KillMode=mixed

0 commit comments

Comments
 (0)