]> git.openstreetmap.org Git - nominatim.git/commitdiff
update Ubuntu22 install script for pip install
authorSarah Hoffmann <lonvia@denofr.de>
Fri, 15 Nov 2024 21:50:53 +0000 (22:50 +0100)
committerSarah Hoffmann <lonvia@denofr.de>
Mon, 18 Nov 2024 17:51:54 +0000 (18:51 +0100)
vagrant/Install-on-Ubuntu-22.sh
vagrant/Install-on-Ubuntu-24.sh

index a13758317743f5c50ec3cde2714ce3610fff1d63..2ad337bbd4f83cc89766bd26737b5d8e0d0b8244 100755 (executable)
@@ -25,15 +25,7 @@ export DEBIAN_FRONTEND=noninteractive #DOCS:
                         libbz2-dev libpq-dev liblua5.3-dev lua5.3 lua-dkjson \
                         nlohmann-json3-dev postgresql-14-postgis-3 \
                         postgresql-contrib-14 postgresql-14-postgis-3-scripts \
                         libbz2-dev libpq-dev liblua5.3-dev lua5.3 lua-dkjson \
                         nlohmann-json3-dev postgresql-14-postgis-3 \
                         postgresql-contrib-14 postgresql-14-postgis-3-scripts \
-                        libicu-dev python3-dotenv \
-                        python3-pip python3-psutil python3-jinja2 \
-                        python3-sqlalchemy python3-asyncpg \
-                        python3-icu python3-datrie python3-yaml git
-
-# Some of the Python packages that come with Ubuntu 22.04 are too old,
-# so install the latest version from pip:
-
-    pip3 install --user psycopg[binary]
+                        libicu-dev virtualenv git
 
 #
 # System Configuration
 
 #
 # System Configuration
@@ -109,7 +101,7 @@ fi                                    #DOCS:
 #
 if [ "x$1" == "xyes" ]; then  #DOCS:    :::sh
     cd $USERHOME
 #
 if [ "x$1" == "xyes" ]; then  #DOCS:    :::sh
     cd $USERHOME
-    git clone --recursive https://github.com/openstreetmap/Nominatim.git
+    git clone https://github.com/osm-search/Nominatim.git
     cd Nominatim
 else                               #DOCS:
     cd $USERHOME/Nominatim         #DOCS:
     cd Nominatim
 else                               #DOCS:
     cd $USERHOME/Nominatim         #DOCS:
@@ -122,14 +114,31 @@ if [ ! -f data/country_osm_grid.sql.gz ]; then       #DOCS:    :::sh
     wget -O data/country_osm_grid.sql.gz https://nominatim.org/data/country_grid.sql.gz
 fi                                 #DOCS:
 
     wget -O data/country_osm_grid.sql.gz https://nominatim.org/data/country_grid.sql.gz
 fi                                 #DOCS:
 
-# The code must be built in a separate directory. Create this directory,
-# then configure and build Nominatim in there:
+# Nominatim needs osm2pgsql >= 1.8. The version that comes with Ubuntu is
+# too old. Download and compile your own:
 
 
-    mkdir $USERHOME/build
-    cd $USERHOME/build
-    cmake $USERHOME/Nominatim
+    cd $USERHOME
+    git clone https://github.com/osm2pgsql-dev/osm2pgsql
+    mkdir osm2pgsql-build
+    cd osm2pgsql-build
+    cmake ../osm2pgsql
     make
     sudo make install
     make
     sudo make install
+    cd $USERHOME/Nominatim
+
+# Nominatim should be installed in a separate Python virtual environment.
+# Create the virtual environment:
+
+    virtualenv $USERHOME/nominatim-venv
+
+# We want the faster binary version pf psycopg, so install that:
+
+    $USERHOME/nominatim-venv/bin/pip install psycopg[binary]
+
+# Now install Nominatim using pip:
+
+    cd $USERHOME/Nominatim
+    $USERHOME/nominatim-venv/bin/pip install packaging/nominatim-db
 
 # Nominatim is now ready to use. You can continue with
 # [importing a database from OSM data](../admin/Import.md). If you want to set up
 
 # Nominatim is now ready to use. You can continue with
 # [importing a database from OSM data](../admin/Import.md). If you want to set up
@@ -138,18 +147,19 @@ fi                                 #DOCS:
 # Setting up the Python frontend
 # ==============================
 #
 # Setting up the Python frontend
 # ==============================
 #
-# Some of the Python packages in Ubuntu are too old. Therefore run the
-# frontend from a Python virtualenv with current packages.
+# The Python frontend is contained in the nominatim-api package. To run
+# the API as a webservice, you also need falcon with uvicorn to serve the API.
+# It is generally recommended to run falcon/uvicorn on top of gunicorn.
 #
 #
-# To set up the virtualenv, run:
+# To install all packages, run:
 
 #DOCS:```sh
 
 #DOCS:```sh
-sudo apt-get install -y virtualenv
-virtualenv $USERHOME/nominatim-venv
-$USERHOME/nominatim-venv/bin/pip install SQLAlchemy PyICU psycopg[binary] \
-              psycopg2-binary python-dotenv PyYAML falcon uvicorn gunicorn
+$USERHOME/nominatim-venv/bin/pip install falcon uvicorn gunicorn
+cd $USERHOME/Nominatim
+$USERHOME/nominatim-venv/bin/pip install packaging/nominatim-api
 #DOCS:```
 
 #DOCS:```
 
+
 # Next you need to create a systemd job that runs Nominatim on gunicorn.
 # First create a systemd job that manages the socket file:
 
 # Next you need to create a systemd job that runs Nominatim on gunicorn.
 # First create a systemd job that manages the socket file:
 
@@ -178,14 +188,11 @@ Requires=nominatim.socket
 
 [Service]
 Type=simple
 
 [Service]
 Type=simple
-Environment="PYTHONPATH=/usr/local/lib/nominatim/lib-python/"
 User=www-data
 Group=www-data
 WorkingDirectory=$USERHOME/nominatim-project
 User=www-data
 Group=www-data
 WorkingDirectory=$USERHOME/nominatim-project
-ExecStart=$USERHOME/nominatim-venv/bin/gunicorn -b unix:/run/nominatim.sock -w 4 -k uvicorn.workers.UvicornWorker nominatim_api.server.falcon.server:run_wsgi
+ExecStart=$USERHOME/nominatim-venv/bin/gunicorn -b unix:/run/nominatim.sock -w 4 -k uvicorn.workers.UvicornWorker "nominatim_api.server.falcon.server:run_wsgi()"
 ExecReload=/bin/kill -s HUP \$MAINPID
 ExecReload=/bin/kill -s HUP \$MAINPID
-StandardOutput=append:/var/log/gunicorn-nominatim.log
-StandardError=inherit
 PrivateTmp=true
 TimeoutStopSec=5
 KillMode=mixed
 PrivateTmp=true
 TimeoutStopSec=5
 KillMode=mixed
index 35882a79ea9742e5bddf2b5f8d7b1f935b2fe0b7..b15eb3d884975d8c1026bb32eba5ffb84e319d31 100755 (executable)
@@ -98,7 +98,7 @@ fi                                    #DOCS:
 #
 if [ "x$1" == "xyes" ]; then  #DOCS:    :::sh
     cd $USERHOME
 #
 if [ "x$1" == "xyes" ]; then  #DOCS:    :::sh
     cd $USERHOME
-    git clone https://github.com/openstreetmap/Nominatim.git
+    git clone https://github.com/osm-search/Nominatim.git
     cd Nominatim
 else                               #DOCS:
     cd $USERHOME/Nominatim         #DOCS:
     cd Nominatim
 else                               #DOCS:
     cd $USERHOME/Nominatim         #DOCS:
@@ -116,6 +116,10 @@ fi                                 #DOCS:
 
     virtualenv $USERHOME/nominatim-venv
 
 
     virtualenv $USERHOME/nominatim-venv
 
+# We want the faster binary version pf psycopg, so install that:
+
+    $USERHOME/nominatim-venv/bin/pip install psycopg[binary]
+
 # Now install Nominatim using pip:
 
     cd $USERHOME/Nominatim
 # Now install Nominatim using pip:
 
     cd $USERHOME/Nominatim
@@ -143,7 +147,7 @@ fi                                 #DOCS:
 # To install all packages, run:
 
 #DOCS:```sh
 # To install all packages, run:
 
 #DOCS:```sh
-$USERHOME/nominatim-venv/bin/pip install psycopg[binary] falcon uvicorn gunicorn
+$USERHOME/nominatim-venv/bin/pip install falcon uvicorn gunicorn
 cd $USERHOME/Nominatim
 $USERHOME/nominatim-venv/bin/pip install packaging/nominatim-api
 #DOCS:```
 cd $USERHOME/Nominatim
 $USERHOME/nominatim-venv/bin/pip install packaging/nominatim-api
 #DOCS:```
@@ -179,10 +183,8 @@ Type=simple
 User=www-data
 Group=www-data
 WorkingDirectory=$USERHOME/nominatim-project
 User=www-data
 Group=www-data
 WorkingDirectory=$USERHOME/nominatim-project
-ExecStart=$USERHOME/nominatim-venv/bin/gunicorn -b unix:/run/nominatim.sock -w 4 -k uvicorn.workers.UvicornWorker nominatim_api.server.falcon.server:run_wsgi
+ExecStart=$USERHOME/nominatim-venv/bin/gunicorn -b unix:/run/nominatim.sock -w 4 -k uvicorn.workers.UvicornWorker "nominatim_api.server.falcon.server:run_wsgi()"
 ExecReload=/bin/kill -s HUP \$MAINPID
 ExecReload=/bin/kill -s HUP \$MAINPID
-StandardOutput=append:/var/log/gunicorn-nominatim.log
-StandardError=inherit
 PrivateTmp=true
 TimeoutStopSec=5
 KillMode=mixed
 PrivateTmp=true
 TimeoutStopSec=5
 KillMode=mixed