How to Install Nominatim on POP! OS

Introduction

Nominatim is a powerful open-source tool that allows you to search for addresses and locations across the globe. It is used extensively in map applications and geocoders. In this tutorial, we will explain the step-by-step process of installing Nominatim on the latest version of POP! OS (as of this writing). Let's get started.

Prerequisites

Step 1: Update and upgrade your system

The first thing you need to do is to update and upgrade your system. Type the following command in your terminal:

sudo apt update && sudo apt upgrade -y

Step 2: Prepare your system

In order to install Nominatim, you need to prepare your system. Type the following command in your terminal:

sudo apt install build-essential cmake g++ gcc git libboost-all-dev libbz2-dev libexpat1-dev libgeos-dev libgeos++-dev liblua5.3-dev libmapnik-dev libpq-dev lua5.3 make postgresql postgresql-contrib postgresql-server-dev-12 proj-bin proj-data libproj-dev osmium-tool zlib1g-dev pkg-config -y

Step 3: Clone Nominatim repository

Next, clone the Nominatim repository. Type the following command in your terminal:

git clone --recursive https://github.com/osm-search/Nominatim.git

Step 4: Install Nominatim dependencies

Now you need to install Nominatim dependencies. Type the following command in your terminal:

cd Nominatim
mkdir build && cd build
cmake ..
make
sudo make install

Step 5: Create a user for Nominatim

You need to create a user for Nominatim. Type the following commands in your terminal:

sudo adduser nominatim
sudo passwd nominatim

Step 6: Install Nominatim data

Next, you need to download and install Nominatim data. Type the following commands in your terminal:

sudo su - nominatim
wget http://download.geofabrik.de/asia/maldives-latest.osm.pbf
./utils/setup.php --osm-file maldives-latest.osm.pbf --all --osm2pgsql-cache 18000 2>&1 | tee setup.log
exit

Step 7: Configure Nginx

Now you need to configure Nginx for Nominatim. Type the following command in your terminal:

sudo apt install nginx -y
sudo nano /etc/nginx/sites-available/nominatim.conf

Add the following code to the conf file:

server {
        listen 8080;
        server_name localhost;

        location / {
                proxy_pass http://localhost:8085;
                proxy_set_header Host $http_host;
                proxy_set_header X-Real-IP $remote_addr;
                proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
                proxy_set_header X-Forwarded-Proto $scheme;
        }
}

Save and exit the file. Then create a symbolic link:

sudo ln -s /etc/nginx/sites-available/nominatim.conf /etc/nginx/sites-enabled/

Restart nginx service:

sudo systemctl restart nginx

Step 8: Start Nominatim

Finally, you can start Nominatim. Type the following command in your terminal:

sudo su - nominatim -s /bin/bash
./Nominatim/nominatim -p 8085 --osm2pgsql-cache 18000

Conclusion

In this tutorial, we have explained how to install Nominatim on the latest version of POP! OS. If you followed the steps carefully, you should have successfully installed Nominatim on your system.

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!