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.
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
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
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
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.
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', 'me@example.com');
Save and close the file.
Start the Nominatim service using the following command:
sudo systemctl start nominatim
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.
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!