Host your own FCC Ham Radio Database for Offline Use with HamDB

Host your own FCC Ham Radio Database for Offline Use with HamDB

First, I want to give all credit for this blog post and script to this website(, and the ham who created it (K3NG). The only reason I am posting it here is to walk through the database installation portion, and show how the database can be expanded onto to include extra information, as well as add some more detailed documentation. His mission seems to align with mine in making database lookup tools for logbooks for accessible, instead of taking user data and selling it back (such as what QRZ does). As such, most of the information here is ripped from his post, and presented in a different way.

exampel of hamdb

This guide is going to assume you are running Debian 12, or Ubuntu 22.04

Creating our User

This section is Linux 101, but I usually go over it anyways just in case. We will be running mostly everything here as a non root user, that is in the sudo group. As such, the following commands below will create our new user, install sudo, and swap to it. If you already have a user created that you would like to use, you may skip this step.

As Root:

add user your-desired-user
apt install sudo
usermod -aG sudo your-desired-user
su kn4mkb

Installing and Configuring MariaDB Database

The following will perform some updates, and install MariaDB. Everything else from here on should be done under the user we just created, not root.

sudo apt-get update
sudo apt-get upgrade
sudo apt -y install mariadb-server
systemctl restart mariadb

Now we will configure it for best security practices:

sudo mysql_secure_installation 

You will be asked several questions. As we are running the command as root, press [Enter](none) when asked for the root password, as we haven’t configured one. We can answer ‘n’ for most of the others until asked if we want to remove anonymous users. From here, we want to say ‘y’, for the rest of the questions.

Enter current password for root (enter for none):
Switch to unix_socket authentication [Y/n] n
Change the root password? [Y/n] n
Remove anonymous users? [Y/n] y
Disallow root login remotely? [Y/n] y
Remove test database and access to it? [Y/n] y
Reload privilege tables now? [Y/n] y
creating secure mysql isntall

Creating the Database User

We will now create the user which will be used to update the database with the latest information from the FCC database. We will start the sql prompt as root, and use the prompt to create the user, giving it privileges to create new databases.

sudo mysql

Replace “hamdbuser” and “SECURE_PASSWORD” with your desired username and password for the database user. Enter the following 3 commands at the MariaDB prompt:




We now have the database and a user ready to go. Next we will proceed with K3NGs database updating script.

Installing HamDB

First we will install wget, which will allow us to pull the most recent version of the hamdb script form github. unzip is also needed as hamdb uses it for database downloads. We will then pull the script into our current working folder and run a full database build.

sudo apt install wget unzip
sudo chmod +x hamdb
./hamdb full

The script will ask you a few questions. Would you like to create a config file (y), what is your Database sser, database password. afterwards, it gets to work pulling the current database in full.

creating mysql user

Using HamDB to lookup Ham Radio Callsign Information

You can use HamDB in a few ways to lookup information. But the true power will be building third party or external tools to extract information from the database.

offline lookup of ham fcc callsign

Look up a callsign: ./hamdb k3ng
Wildcard Search: ./hamdb like k3ng%
Search for amateurs in a zip: ./hamdb zipcode 17701
Search by last name: ./hamdb lastname Jones

./hamdb -h will give you all of the lookup options built into the application.

Maintaining and Updating the Database

You will want to run and update daily on your database to keep things current. You can use cron to accomplish this.
Take note of where you have downloaded the hamdb script (mine is at /home/kn4mkb/hamdb)

Enter the following command. If you are unsure with what editor to use when asked, go with nano.

crontab -e

Enter the following line at the end of the file to update the database every day at 2:30 am.
Take care to replace /home/kn4mkb/hamdb with the path of your hamdb script.

30 2 * * * /home/kn4mkb/hamdb update

Ctrl X + Y to save (if using nano), and you should be good to go!

Consider Subscribing!

Signup for our once a month newsletter!

We don’t spam! Read our privacy policy for more info.

1 thought on “Host your own FCC Ham Radio Database for Offline Use with HamDB

Leave a Reply

Your email address will not be published. Required fields are marked *