How to Install Nominatim on Debian Latest

Nominatim is a free and open-source tool that provides world-wide address lookup services. It can be used to convert addresses into geographic coordinates, to find nearby points of interest, and to adjust OpenStreetMap data.

In this tutorial, we will go through the steps to install Nominatim on Debian Latest.

Prerequisites

Before we start with the installation, make sure you have the following:

Step 1: Update your system

The first step is to make sure your system is up-to-date.

sudo apt update
sudo apt upgrade

Step 2: Install dependencies

Next, you need to install some dependencies required for Nominatim.

sudo apt install build-essential cmake g++ libboost-dev libboost-system-dev \
    libboost-filesystem-dev libexpat1-dev zlib1g-dev libxml2-dev libbz2-dev \
    libpq-dev libproj-dev postgresql-server-dev-12 postgresql-12-postgis-3 \
    postgresql-contrib-12

Step 3: Create a new user

Since Nominatim requires a lot of resources to run, it is recommended that you create a new user specifically for it.

sudo adduser nominatim

Step 4: Download and build Nominatim

Login with the new user by running the following command:

sudo su nominatim

Now clone the Nominatim repository and build it:

git clone https://github.com/osm-search/Nominatim.git
cd Nominatim
mkdir build
cd build
cmake ..
make

Note: The build process can take several hours, depending on the resources of your system.

Step 5: Configure PostgreSQL

Next, you need to create a new PostgreSQL user and database for Nominatim.

sudo su postgres
createuser -s nominatim
createdb -O nominatim nominatim
exit

Step 6: Import data

You can now import data into the Nominatim database. This can be done by downloading a data dump from the Nominatim website or by creating your own from OpenStreetMap data.

wget https://nominatim.org/data/country_grid.sql.gz
gunzip country_grid.sql.gz
psql -d nominatim -f country_grid.sql

Note: The import process can take a few hours, depending on the size of the data.

Step 7: Configure Nominatim

Copy the Nominatim configuration file:

cp ../settings/local.php.sample ../settings/local.php

Edit the local.php file with your specific settings. For example, to set the website name:

@define('CONST_WebsiteName', 'My Nominatim');

Step 8: Start Nominatim

You can now start Nominatim by running the following command:

./utils/setup.php --create-website /var/www/nominatim

This will create a new website in the /var/www/nominatim directory.

Conclusion

In this tutorial, you learned how to install Nominatim on Debian Latest. You can now use Nominatim to provide address lookup services for your applications.

If you want to self-host in an easy, hands free way, need an external IP address, or simply want your data in your own hands, give IPv6.rs a try!

Alternatively, for the best virtual desktop, try Shells!