Tutorial: How to Install Nominatim on Fedora CoreOS Latest?
Nominatim is an open-source tool that helps in searching and reverse-geocoding geographical locations based on OpenStreetMap data. In this tutorial, we will discuss the steps to install Nominatim on Fedora CoreOS latest.
Prerequisites
- Machine or Virtual Machine with the latest version of Fedora CoreOS installed.
- Root access.
- At least 10GB of free disk space.
Steps to Install Nominatim
Step 1: Install Required Packages
Firstly, update the system and install the required packages using the following command:
sudo dnf update -y && sudo dnf install -y postgresql-server postgis proj-devel geos-devel osmium-tool bzip2 unzip planet.osm
Step 2: Set Up PostgreSQL Database
Next, create a new PostgreSQL database cluster and initialize it using the following command:
sudo postgresql-setup --initdb
After setting up the database, start the PostgreSQL service using the following command:
sudo systemctl start postgresql
Step 3: Install Nominatim
Download Nominatim by using the following command:
sudo git clone --recursive https://github.com/openstreetmap/Nominatim.git /opt/Nominatim
Navigate to the Nominatim directory:
cd /opt/Nominatim
Compile and install Nominatim:
sudo mk/build.sh
sudo make install
Step 4: Import OpenStreetMap Data
Download OpenStreetMap data of your preferred region or country using the following command:
sudo osm2pgsql -c -d nominatim -U postgres --slim --hstore --exclude-invalid-polygon -S /opt/Nominatim/src/pgsimple.style <region/country>-latest.osm.pbf
This command will import the OpenStreetMap data to the Nominatim database.
Step 5: Configure Nominatim
Create a custom configuration file for Nominatim using the following command:
sudo cp /opt/Nominatim/build/settings/local.php.sample /opt/Nominatim/build/settings/local.php
Edit the local.php file using the following command:
sudo nano /opt/Nominatim/build/settings/local.php
Update the following lines with your PostgreSQL and OpenStreetMap data details:
// Database connection settings
@define('CONST_Database_DSN', 'pgsql://username:password@localhost/nominatim');
@define('CONST_Database_ReadOnly_DSN', 'pgsql://username:password@localhost/nominatim');
...
// Email address for error reports
@define('CONST_Website_AdminEmail', '[email protected]');
Save and close the file.
Step 6: Start Nominatim Service
Start the Nominatim service using the following command:
sudo systemctl start nominatim
Step 7: Test Nominatim Installation
To test the Nominatim installation, run the following command:
sudo nominatim -v -s 'Country/City' 'Location'
This command will search for the specified location in the specified country or city.
Congratulations! You have now installed Nominatim on Fedora CoreOS Latest.