installation for Ubuntu 24.04 with packages

Also remove Ubuntu 20.04 instructions.
This commit is contained in:
Sarah Hoffmann
2024-06-24 20:07:02 +02:00
parent 1e88321371
commit e2416f90af
8 changed files with 100 additions and 79 deletions

View File

@@ -178,7 +178,7 @@ Environment="PYTHONPATH=/usr/local/lib/nominatim/lib-python/"
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.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
StandardOutput=append:/var/log/gunicorn-nominatim.log
StandardError=inherit

View File

@@ -6,12 +6,12 @@ export APT_LISTCHANGES_FRONTEND=none #DOCS:
export DEBIAN_FRONTEND=noninteractive #DOCS:
# *Note:* these installation instructions are also available in executable
# form for use with vagrant under vagrant/Install-on-Ubuntu-20.sh.
# form for use with vagrant under vagrant/Install-on-Ubuntu-24.sh.
#
# Installing the Required Software
# ================================
#
# These instructions expect that you have a freshly installed Ubuntu 20.04.
# These instructions expect that you have a freshly installed Ubuntu 24.04.
#
# Make sure all packages are up-to-date by running:
#
@@ -20,19 +20,8 @@ export DEBIAN_FRONTEND=noninteractive #DOCS:
# Now you can install all packages needed for Nominatim:
sudo apt-get install -y build-essential cmake g++ libboost-dev libboost-system-dev \
libboost-filesystem-dev libexpat1-dev zlib1g-dev \
libbz2-dev libpq-dev liblua5.3-dev lua5.3 lua-dkjson \
nlohmann-json3-dev postgresql-12-postgis-3 \
postgresql-contrib-12 postgresql-12-postgis-3-scripts \
libicu-dev python3-dotenv \
python3-psycopg2 python3-psutil python3-jinja2 python3-pip \
python3-icu python3-datrie python3-yaml git
# Some of the Python packages that come with Ubuntu 20.04 are too old, so
# install the latest version from pip:
pip3 install --user sqlalchemy asyncpg
sudo apt-get install -y osm2pgsql postgresql-postgis postgresql-postgis-scripts \
pkg-config libicu-dev virtualenv git
#
@@ -78,14 +67,14 @@ fi #DOCS:
# ---------------------
#
# Tune the postgresql configuration, which is located in
# `/etc/postgresql/12/main/postgresql.conf`. See section *Tuning the PostgreSQL database*
# `/etc/postgresql/14/main/postgresql.conf`. See section *Tuning the PostgreSQL database*
# in [the installation page](../admin/Installation.md#tuning-the-postgresql-database)
# for the parameters to change.
#
# Restart the postgresql service after updating this config file.
if [ "x$NOSYSTEMD" == "xyes" ]; then #DOCS:
sudo pg_ctlcluster 12 main start #DOCS:
sudo pg_ctlcluster 16 main start #DOCS:
else #DOCS:
sudo systemctl restart postgresql
fi #DOCS:
@@ -109,7 +98,7 @@ fi #DOCS:
#
if [ "x$1" == "xyes" ]; then #DOCS: :::sh
cd $USERHOME
git clone --recursive https://github.com/openstreetmap/Nominatim.git
git clone https://github.com/openstreetmap/Nominatim.git
cd Nominatim
else #DOCS:
cd $USERHOME/Nominatim #DOCS:
@@ -122,32 +111,39 @@ 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:
# The code must be built in a separate directory. Create this directory,
# then configure and build Nominatim in there:
# Nominatim should be installed in a separate Python virtual environment.
# Create the virtual environment:
mkdir $USERHOME/build
cd $USERHOME/build
cmake $USERHOME/Nominatim
make
sudo make install
virtualenv $USERHOME/nominatim-venv
# Nominatim is now ready to use. You can continue with
# Now install Nominatim using pip:
cd $USERHOME/Nominatim
$USERHOME/nominatim-venv/bin/pip install packaging/nominatim-{core,db}
# Nominatim is now ready to use. The nominatim binary is available at
# `$USERHOME/venv/bin/nominatim`. If you want to have 'nominatim' in your
# path, simply activate the virtual environment:
# You can continue with
# [importing a database from OSM data](../admin/Import.md). If you want to set up
# the API frontend first, continue reading.
#
# 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/gunicorn to
# serve the API.
#
# To set up the virtualenv, run:
# To install all packages, run:
#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 psycopg[binary] falcon uvicorn gunicorn
cd $USERHOME/Nominatim
$USERHOME/nominatim-venv/bin/pip install packaging/nominatim-api
#DOCS:```
# Next you need to create a systemd job that runs Nominatim on gunicorn.
@@ -182,7 +178,7 @@ Environment="PYTHONPATH=/usr/local/lib/nominatim/lib-python/"
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.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
StandardOutput=append:/var/log/gunicorn-nominatim.log
StandardError=inherit
@@ -204,7 +200,6 @@ if [ "x$NOSYSTEMD" != "xyes" ]; then #DOCS:
sudo systemctl enable nominatim.service
fi #DOCS:
# Setting up a webserver
# ======================
#
@@ -216,23 +211,25 @@ fi #DOCS:
# [during the import process](../admin/Import.md#creating-the-project-directory)
# Already create the project directory itself now:
mkdir $USERHOME/nominatim-project
#
# Option 1: Using Apache
# ----------------------
#
if [ "x$2" == "xinstall-apache" ]; then #DOCS:
#
# First install apache itself and enable the proxy module:
sudo apt-get install -y apache2
sudo a2enmod proxy_http
#
# To set up proxying for Apache add the following configuration:
#DOCS:```sh
sudo tee /etc/apache2/conf-available/nominatim.conf << EOFAPACHECONF
ProxyPass /nominatim "unix:/run/nominatim.sock|http://localhost/"
EOFAPACHECONF
#DOCS:```
@@ -241,7 +238,10 @@ EOFAPACHECONF
# Then enable the configuration and restart apache
#
sudo a2enconf nominatim
#DOCS:```sh
sudo a2enconf nominatim
#DOCS:```
if [ "x$NOSYSTEMD" == "xyes" ]; then #DOCS:
sudo apache2ctl start #DOCS:
else #DOCS:
@@ -262,6 +262,7 @@ if [ "x$2" == "xinstall-nginx" ]; then #DOCS:
sudo apt-get install -y nginx
# Then create a Nginx configuration to forward http requests to that socket.
#DOCS:```sh
@@ -293,8 +294,6 @@ else #DOCS:
sudo systemctl restart nginx
fi #DOCS:
# The Nominatim API is now available at `http://localhost/`.
# The Nominatim API is now available at `http://localhost/nominatim/`.
fi #DOCS: