How to Install Nominatim on OpenBSD

Nominatim is a free and open source geocoding software that allows you to convert addresses into geographic coordinates. In this tutorial, we’ll show you how to install Nominatim on OpenBSD.

Requirements

Step 1: Update and install prerequisites

Before we can install Nominatim, we’ll need to install the prerequisites. Make sure your OpenBSD server is up to date by running the following commands:

sudo su
pkg_add -u && pkg_add vim git cmake automake autoconf libtool gcc g++ wget unzip bzip2 zlib postgresql-server postgis

Step 2: Create a user account and download Nominatim

Next, we need to create a user account for the Nominatim software to run under. Run the following command to create a new user called "nominatim":

adduser

Download Nominatim from the official website and extract the files:

wget https://nominatim.org/release/Nominatim-3.6.0.tar.bz2
bzip2 -d Nominatim-3.6.0.tar.bz2
tar xvf Nominatim-3.6.0.tar

Move the extracted files to the directory where the user "nominatim" has write access:

mv Nominatim-3.6.0 /home/nominatim/
chown -R nominatim:nominatim /home/nominatim/Nominatim-3.6.0

Step 3: Install Nominatim

Now that we have the prerequisites and Nominatim files, we can install Nominatim. Run the following commands:

cd /home/nominatim/Nominatim-3.6.0
./configure
make
make install

Step 4: Set up PostgresSQL and PostGIS

Nominatim requires PostgresSQL and PostGIS to run. Run the following commands to set up PostgresSQL and PostGIS:

su postgres
initdb -D /var/postgresql/data
pg_ctl -D /var/postgresql/data -l /var/postgresql/logfile start
exit

Create a new user for Nominatim to use:

sudo su postgres
createuser nominatim
exit

Create a new database and enable PostGIS extensions:

sudo su postgres
createdb -E UTF8 -O nominatim nominatim
psql -d nominatim -c "CREATE EXTENSION postgis;CREATE EXTENSION postgis_topology;"
exit

Step 5: Install and set up Apache

Lastly, we need to install and set up Apache to serve the Nominatim website. Run the following commands:

pkg_add apache-httpd
echo "ServerName localhost" >> /etc/httpd.conf

Create a new Apache configuration for Nominatim:

cd /etc/httpd/conf
vim nominatim.conf

Add the following contents to the file:

<VirtualHost *:80>
   ServerName your-domain.com
   DocumentRoot /home/nominatim/Nominatim-3.6.0/build/website/
   <Directory "/">
      AllowOverride All
      Require all granted
   </Directory>
</VirtualHost>

Restart Apache to load the new configuration:

apachectl restart

Conclusion

In this tutorial, we’ve shown you how to install Nominatim on OpenBSD. By following these instructions, you should now have a fully functional Nominatim installation that you can use for geocoding addresses.

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!