mirror of
https://github.com/osm-search/Nominatim.git
synced 2024-12-23 13:06:15 +03:00
update Ubuntu22 install script for pip install
This commit is contained in:
parent
a408da4ccc
commit
c4a726c96b
@ -25,15 +25,7 @@ export DEBIAN_FRONTEND=noninteractive #DOCS:
|
|||||||
libbz2-dev libpq-dev liblua5.3-dev lua5.3 lua-dkjson \
|
libbz2-dev libpq-dev liblua5.3-dev lua5.3 lua-dkjson \
|
||||||
nlohmann-json3-dev postgresql-14-postgis-3 \
|
nlohmann-json3-dev postgresql-14-postgis-3 \
|
||||||
postgresql-contrib-14 postgresql-14-postgis-3-scripts \
|
postgresql-contrib-14 postgresql-14-postgis-3-scripts \
|
||||||
libicu-dev python3-dotenv \
|
libicu-dev virtualenv git
|
||||||
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]
|
|
||||||
|
|
||||||
#
|
#
|
||||||
# System Configuration
|
# System Configuration
|
||||||
@ -109,7 +101,7 @@ fi #DOCS:
|
|||||||
#
|
#
|
||||||
if [ "x$1" == "xyes" ]; then #DOCS: :::sh
|
if [ "x$1" == "xyes" ]; then #DOCS: :::sh
|
||||||
cd $USERHOME
|
cd $USERHOME
|
||||||
git clone --recursive https://github.com/openstreetmap/Nominatim.git
|
git clone https://github.com/osm-search/Nominatim.git
|
||||||
cd Nominatim
|
cd Nominatim
|
||||||
else #DOCS:
|
else #DOCS:
|
||||||
cd $USERHOME/Nominatim #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
|
wget -O data/country_osm_grid.sql.gz https://nominatim.org/data/country_grid.sql.gz
|
||||||
fi #DOCS:
|
fi #DOCS:
|
||||||
|
|
||||||
# The code must be built in a separate directory. Create this directory,
|
# Nominatim needs osm2pgsql >= 1.8. The version that comes with Ubuntu is
|
||||||
# then configure and build Nominatim in there:
|
# too old. Download and compile your own:
|
||||||
|
|
||||||
mkdir $USERHOME/build
|
cd $USERHOME
|
||||||
cd $USERHOME/build
|
git clone https://github.com/osm2pgsql-dev/osm2pgsql
|
||||||
cmake $USERHOME/Nominatim
|
mkdir osm2pgsql-build
|
||||||
|
cd osm2pgsql-build
|
||||||
|
cmake ../osm2pgsql
|
||||||
make
|
make
|
||||||
sudo make install
|
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
|
# 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
|
# [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
|
# The Python frontend is contained in the nominatim-api package. To run
|
||||||
# frontend from a Python virtualenv with current packages.
|
# 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
|
$USERHOME/nominatim-venv/bin/pip install falcon uvicorn gunicorn
|
||||||
virtualenv $USERHOME/nominatim-venv
|
cd $USERHOME/Nominatim
|
||||||
$USERHOME/nominatim-venv/bin/pip install SQLAlchemy PyICU psycopg[binary] \
|
$USERHOME/nominatim-venv/bin/pip install packaging/nominatim-api
|
||||||
psycopg2-binary python-dotenv PyYAML falcon uvicorn gunicorn
|
|
||||||
#DOCS:```
|
#DOCS:```
|
||||||
|
|
||||||
|
|
||||||
# Next you need to create a systemd job that runs Nominatim on gunicorn.
|
# Next you need to create a systemd job that runs Nominatim on gunicorn.
|
||||||
# First create a systemd job that manages the socket file:
|
# First create a systemd job that manages the socket file:
|
||||||
|
|
||||||
@ -178,14 +188,11 @@ Requires=nominatim.socket
|
|||||||
|
|
||||||
[Service]
|
[Service]
|
||||||
Type=simple
|
Type=simple
|
||||||
Environment="PYTHONPATH=/usr/local/lib/nominatim/lib-python/"
|
|
||||||
User=www-data
|
User=www-data
|
||||||
Group=www-data
|
Group=www-data
|
||||||
WorkingDirectory=$USERHOME/nominatim-project
|
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
|
PrivateTmp=true
|
||||||
TimeoutStopSec=5
|
TimeoutStopSec=5
|
||||||
KillMode=mixed
|
KillMode=mixed
|
||||||
|
@ -98,7 +98,7 @@ fi #DOCS:
|
|||||||
#
|
#
|
||||||
if [ "x$1" == "xyes" ]; then #DOCS: :::sh
|
if [ "x$1" == "xyes" ]; then #DOCS: :::sh
|
||||||
cd $USERHOME
|
cd $USERHOME
|
||||||
git clone https://github.com/openstreetmap/Nominatim.git
|
git clone https://github.com/osm-search/Nominatim.git
|
||||||
cd Nominatim
|
cd Nominatim
|
||||||
else #DOCS:
|
else #DOCS:
|
||||||
cd $USERHOME/Nominatim #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:
|
# Now install Nominatim using pip:
|
||||||
|
|
||||||
cd $USERHOME/Nominatim
|
cd $USERHOME/Nominatim
|
||||||
@ -143,7 +147,7 @@ fi #DOCS:
|
|||||||
# To install all packages, run:
|
# To install all packages, run:
|
||||||
|
|
||||||
#DOCS:```sh
|
#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
|
cd $USERHOME/Nominatim
|
||||||
$USERHOME/nominatim-venv/bin/pip install packaging/nominatim-api
|
$USERHOME/nominatim-venv/bin/pip install packaging/nominatim-api
|
||||||
#DOCS:```
|
#DOCS:```
|
||||||
@ -179,10 +183,8 @@ Type=simple
|
|||||||
User=www-data
|
User=www-data
|
||||||
Group=www-data
|
Group=www-data
|
||||||
WorkingDirectory=$USERHOME/nominatim-project
|
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
|
PrivateTmp=true
|
||||||
TimeoutStopSec=5
|
TimeoutStopSec=5
|
||||||
KillMode=mixed
|
KillMode=mixed
|
||||||
|
Loading…
Reference in New Issue
Block a user