Skip to content
tadscottsmith edited this page Jun 22, 2023 · 92 revisions

Each segment below depicts certain platform installation steps for Trunk Recorder. Once you have completed the installation steps for your platform, continue to the Building Trunk Recorder wiki page.

Recommended installation methods:

Other installation methods:

PLEASE NOTE: Some packages currently listed in various installation steps below are outdated. Sometimes the package manager will be able to passively recommend the proper package, and other times, it will throw an error and halt install. Let us know on the Gitter.im chat so we can fix it, or edit the wiki directly.


Docker

If you are not going to be modifying the source code, a Docker based install is the easiest way to get started. Images are published frequently to Docker Hub. The images have GNURadio 3.8 and all other required dependencies built into it, so it should be ready to go and be a much faster solution than compiling. Images have been built for amd64 (amd64 is used by all modern Intel and AMD CPUs) and most popular flavors of ARM - Raspberry Pi 3, 4, armv7, arm64.

To get started, create a directory and place your config.json file there and a talkgroup.csv file if you are using one. Update the command below with the path to that directory.

docker run -it \
  --privileged\
  --log-opt max-size=10m --log-opt max-file=5 \
  -v /REPLACE/WITH/PATH/TO/DIR:/app \
  -v /etc/localtime:/etc/localtime:ro \
  -v /var/run/dbus:/var/run/dbus \
  -v /var/run/avahi-daemon/socket:/var/run/avahi-daemon/socket \
  robotastic/trunk-recorder:latest

Consider substituting "trunk-recorder:latest" with the exact version you want, visible here https://hub.docker.com/r/robotastic/trunk-recorder/tags, as otherwise in the future it can be hard to work out what version you got at the time.

This will run docker & trunk recorder with the terminal attached, so you see any output, and it dies with your terminal or ctrl+c, see "Useful Docker commands" for the command to daemonize it (background with auto restart) but consider converting your command into a docker-compose config (with https://www.composerize.com/ to save it for later, handy when upgrading) and 'backgrounding that way.

Docker Compose

Docker Compose is a tool for running single or multi-container applications on Docker. A Compose file is used to define how the one or more containers that make up your application are configured. Once you have a Compose file, you can create and start your application with a single command.

To use trunk-recorder as part of a Docker Compose file first create a directory for the application to run:

sudo mkdir -p /home/radio/trunk-recorder

Then copy your config.json and talkgroup.csv file to the newly created directory:

sudo cp /path/to/config.json /home/radio/trunk-recorder
sudo cp /path/to/talkgroup.csv /home/radio/trunk-recorder

Next, create a docker-compose.yml file:

sudo vi /home/radio/trunk-recorder/docker-compose.yaml

The contents of the docker-compose.yml file should be similar to this:

version: '3'
services:
  recorder:
    image: robotastic/trunk-recorder:latest
    container_name: trunk-recorder
    restart: always
    privileged: true
    logging:
        options:
             {'max-size':'10m', 'max-file':'5'}
    volumes:
      - /var/run/dbus:/var/run/dbus 
      - /var/run/avahi-daemon/socket:/var/run/avahi-daemon/socket 
      - /home/radio/trunk-recorder:/app
      - /etc/localtime:/etc/localtime:ro

Modify your config.json file to ensure that the captureDir is set to a subdirectory of /app/:

  "captureDir": "/app/media"

Change to the home directory and start the Docker containers:

cd /home/radio/trunk-recorder
sudo docker-compose up

Once you have confirmed trunk-recorder is running correctly, you can start the containers in detached (background) mode:

cd /home/radio/trunk-recorder
sudo docker-compose up -d

Docker Compose Updates

To update to the latest stable version using Docker Compose file:

sudo docker pull robotastic/trunk-recorder:latest
sudo docker-compose down
sudo docker rm trunk-recorder
sudo docker-compose up -d

To update to a test/debug branch version using Docker Compose file:

sudo docker build https://github.com/robotastic/trunk-recorder.git#<BRANCH-NAME> -t robotastic/trunk-recorder:<BRANCH-NAME>
sudo docker-compose down
sudo vi docker-compose.yaml
version: '3'
services:
  recorder:
    image: robotastic/trunk-recorder:<BRANCH-NAME>
    container_name: trunk-recorder
    restart: always
    privileged: true
    volumes:
      - /var/run/dbus:/var/run/dbus 
      - /var/run/avahi-daemon/socket:/var/run/avahi-daemon/socket 
      - ./:/app
sudo docker-compose up -d

Docker notes and tips

If you get any errors about avahi-daemon, it might not be on your system and is needed, so you should install it and check its running.

The above command will run trunk recorder in docker as root, so will create recordings (and directories) in /REPLACE/WITH/PATH/TO/DIR/media with owner and group 'root', you can specify a different user/group id with --user "$(id -u):$(id -g)" to use current user or specify uid/gid.

If you want to use the uploadScript setting to for example run a python script, make your shebang is #!/usr/bin/python2 or #!/usr/bin/python3 as /usr/bin/python is not present in the container.

If you are using uploadScript to connect to for example liquidsoap socket/s running outside the container you will need to share/mount them into the container at start by adding -v /var/run/liquidsoap/:/var/run/liquidsoap

uploadScript function will execute your script within the container, passing your script an absolute path of inside the container, so you will need for example a symlink to connect this back to your recordings if liquisoap on he outside of the container is to find them: ln -s /REPLACE/WITH/PATH/TO/DIR /app

You will want some log rotation/limits otherwise your disk will fill up, such as option --log-opt max-size=10m --log-opt max-file=5

You can edit an existing container config (visible via inspect command) by stopping the container, edit either config.v2.json or hostconfig.json in /var/lib/docker/containers/[id]/ , restart docker service: systemctl restart docker. and the changes should have taken effect.

Useful Docker commands

  • To view running containers (images started with run) and see their name/id "docker container list"
  • To rename a container, "docker rename currentName newName"
  • To view container parameters "docker inspect [name/id]"
  • To view logs inside container "docker logs [name/id]" (or logs --follow to tail/watch) (alternatively the log is default stored in host /var/lib/docker/containers/[id]/[id]-json.log - so can tail it just from here)
  • To connect to a running container's shell "docker exec -it [name/id] bash"
  • To run container in background and restart on failure and boot replace "run -it" with "run -d --restart always"

Events that create new images

Currently, Docker image builds are triggered by the following events:

  • After every push to the master branch the edge tag is built and pushed to Docker Hub.
  • Every day at 10 AM UTC the nightly tag is built and pushed to Docker Hub.
  • When a new release happens the <version> and latest tags are built and pushed to Docker Hub.

Ubuntu 20 Series

There are some package name changes for v20 compared to previous iterations of Ubuntu. The lines below should install all needed packages on v20.

sudo apt install -y gr-osmosdr osmo-sdr libosmosdr0 libosmosdr-dev libuhd4.1.0 libuhd-dev gnuradio-dev libgnuradio-uhd3.10.1 libgnuradio-osmosdr0.2.0 

Additional packages, only if using HackRF:

sudo apt install -y hackrf libhackrf-dev libhackrf0

Additional packages for/and building Trunk Recorder (many listed below may have been installed by the first command above):

sudo apt install -y git gcc cpp cmake make build-essential libboost-all-dev  libusb-dev fdkaac sox openssl libssl-dev curl libcurl4 libcurl4-openssl-dev pkg-config liborc-0.4-dev

If you receive an error during the CMake process similar to the error below, you may need to add an additional package:

CMake Error at CMakeLists.txt:341 (add_executable):
  Target "trunk-recorder" links to target "sndfile::sndfile" but the target
  was not found.  Perhaps a find_package() call is missing for an IMPORTED
  target, or an ALIAS target is missing?

This can be resolved by installing the libsndfile1-dev

sudo apt install libsndfile1-dev

Ubuntu / Debian

These instructions should work on Ubuntu 16.x to 17.x, including Debian 9 and 10. For Ubuntu 18.04 add bionic universe before updating the available packages list

sudo add-apt-repository "deb http://archive.ubuntu.com/ubuntu bionic universe"

Then run an apt update to pull in the new repo: sudo apt-get update

Install GNU Radio and other associated packages...

GNU Radio may be installed by manually compiling from source, the PyBOMBS GNU Radio install management system, or using APT to install from the APT package repository.

Using the Ubuntu package repository and the APT package manager is the currently preferred method for installing GNU Radio:

Ubuntu

sudo apt install gnuradio gnuradio-dev libuhd-dev libgnuradio-uhd3.7.11

Debian

sudo apt install gnuradio gnuradio-dev libuhd-dev libgnuradio-uhd3.7.13

For all SDR based devices...

sudo apt install gr-osmosdr libosmosdr0

If using HackRF or one of its derivatives...

sudo apt install hackrf libhackrf0 libhackrf-dev

Install tools to compile Trunk Recorder

sudo apt install git cmake make build-essential libboost-all-dev libusb-1.0-0.dev 

Install dependencies for Trunk Recorder

sudo apt install libaacs0 libcppunit-dev libcppunit-1.14-0 libssl-dev openssl curl fdkaac sox libcurl3-gnutls libcurl4 libcurl4-openssl-dev

Arch Linux

Make sure your package lists are up to date:

sudo pacman -Syy

It is suggested to make sure your installed packages are up to date and to review the Arch Linux documentation regarding upgrades:

sudo pacman -Syu

Most systems will already have base-devel group installed, if yours does not:

sudo pacman -S base-devel

Install the packages required to build Trunk Recorder:

sudo pacman -S cmake git boost gnuradio gnuradio-osmosdr libuhd

MacOS

There are two main "package managers" used on MacOS: Homebrew and MacPorts. Trunk-recorder can be installed with dependencies from one or the other

Using Homebrew

Install Homebrew

See the Brew homepage for more information.

/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"

Install GNURadio and other dependencies

Install GNURadio, the OsmoSDR package for GNURadio, CMake, pkgconfig, cppunit, and openssl through Homebrew:

brew install gnuradio uhd gr-osmosdr cmake pkgconfig cppunit openssl fdk-aac-encoder sox

Note that you will need to provide the flag -DOPENSSL_ROOT_DIR=/usr/local/opt/openssl to the invocation of cmake in the Build Instructions or you will receive an error from CMake about not finding libssl or a linking error from make about not having a library for -lssl:

cmake ../trunk-recorder -DOPENSSL_ROOT_DIR=/usr/local/opt/openssl

Using MacPorts

These instructions should work on OS X 10.10, OS X 10.11, and macOS 10.12.

Install MacPorts

Follow the instructions from the MacPorts project to install the appropriate version of MacPorts for your version of macOS.

If you have already installed MacPorts, make sure your ports tree is up to date:

sudo port selfupdate

(7/24/21) Note: this has been tested and works on an M1 based Mac. Some dependencies for gr-osmosdr do not support ARM64 yet and can be removed by adding a -, eg: -docs

Install GNU Radio

The preferred method for installing GNU Radio on macOS is:

sudo port install gnuradio uhd gr-osmosdr

Install tools to compile Trunk Recorder

sudo port install cmake boost libusb cppunit

Install tools for OpenMHz

If you are interested in uploading recordings to OpenMHz, install FDK-AAC and Sox to convert the Wav files to M4a.

sudo port install sox

Download and make libfdk-aac.

1) extract the source, and cd to the source directory
2) autoreconf -i
3) ./configure
4) make
5) sudo make install

Download and make the command line fdkaac program.

1) extract the source, and cd to the source directory
2) autoreconf -i
3) ./configure
4) make
5) sudo make install

Raspberry Pi OS

Unless you need to modify source code, you probably want to use Docker instead. Gathering all dependencies and compiling trunk-recorder for Raspberry Pi takes a very long time (almost 3 hours!). Docker takes less than 10 minutes to get up and running.

Prologue

  • this is a command issued to the bash prompt. These can be entered at the console or via an SSH session.
  • this is a command / combination from the keyboard.
  • apt is used instead of apt-get for it's much more pleasant presentation to the end user.
  • This is not the "end all, be all" guide, please don't treat it as such. It is written for myself, but shared in hopes that others will find it useful.

Prerequisites

This page assumes the following.

  • You are using a Raspberry Pi 3B+ or 4, anything else probably can't keep up.
  • You have just downloaded the latest version of Raspbian Buster.
  • You have already installed it on the SD Card with something like etcher.
  • You have setup network access to the device by Ethernet or WiFi.
    • Simply plugging in an Ethernet cable will give you network access in most cases.
    • If you only have WiFi network availability.
      • You can do the following as many times as needed for multiple networks
      • (From the console, aka plugged into a TV with a keyboard attached.)
      • sudo raspi-config.
      • Select 2 Network Options and press Enter.
      • Select N2 Wi-fi and press Enter.
      • Please enter SSID and press Enter.
      • Please enter passphrase. Leave it empty if none. and press Enter.
      • Press > and > again to highlight Finish and press Enter.
      • Reboot the Pi with sudo reboot.
  • You are at the console or have secured, enabled and established an SSH session to the device.
    • You can secure your device by changing the default password for pi.
      • sudo raspi-config
      • Select 1 Change User Password and press Enter.
      • You will now be asked to enter a new password for the pi user and press Enter.
    • Enabled SSH
      • sudo raspi-config
      • Select 5 Interfacing Options and press Enter.
      • Select P2 SSH and press Enter.
      • Select Yes to the question Would you like the SSH server to be enabled? and press Enter.

FDK-AAC

(It takes about 1 minute for this section.)

echo 'deb http://www.deb-multimedia.org/ bullseye main non-free' | sudo tee -a /etc/apt/sources.list
sudo apt install debian-keyring -y
sudo gpg --keyserver pgp.mit.edu --recv-keys 5C808C2B65558117
sudo gpg --armor --export 5C808C2B65558117 | sudo apt-key add -
sudo apt update
sudo apt install fdkaac -y

Setup

(It takes about 15 - 30 minutes for this section.)

  • This will get updated information for your system.
  • Upgrade to the latest version of already installed components.
  • Then install new components needed for the building and running of trunk-recorder.
sudo apt update
sudo apt -y upgrade
sudo apt -y install gnuradio gnuradio-dev gr-osmosdr libhackrf-dev libuhd-dev git cmake build-essential libboost-all-dev libusb-1.0-0-dev libcppunit-dev liblog4cpp5-dev libssl-dev autoconf automake libass-dev libfreetype6-dev libsdl2-dev libtheora-dev libtool libva-dev libvdpau-dev libvorbis-dev libxcb1-dev libxcb-shm0-dev libxcb-xfixes0-dev pkg-config texinfo zlib1g-dev libcurl4-openssl-dev sox

Build

(It takes about 15 - 30 minutes to do this with a Class 10 SD Card. But 10 - 15 minutes with a RPI4)

git clone https://github.com/robotastic/trunk-recorder.git ~/trunk-recorder/
cd ~/trunk-recorder
mkdir build
cd build
cmake ..
make -j `nproc`

Note: If the Pi hangs during the final make -k 'nproc' command, try this instead (it may take longer but may also prevent locking up the Pi due to all processor cores being 100% in use):

cd ~/trunk-recorder
cmake .
make 

Profile

(It takes about 15 minutes for this section.)

Run the command volk_profile to ensure that VOLK (Vector-Optimized Library of Kernels) uses the best SIMD (Single instruction, multiple data) architecture for your processor.

Configuration

Configure the system.

Run

./recorder


Raspberry PI 64

Unless you need to modify source code, you probably want to use Docker instead. Gathering all dependencies and compiling trunk-recorder for Raspberry Pi takes a very long time (almost 3 hours!). Docker takes less than 10 minutes to get up and running.

Prerequisites

This page assumes the following.

  • You are using a Raspberry Pi 3B+ or 4, anything else probably can't keep up.
  • You have just downloaded the latest working version (18.0.4) of Ubuntu for ARM64.
  • You have the image unzipped using a tooll like Winzip.
  • You have already installed it on the SD Card with something like etcher.
  • You have access to SSH
    • Default username and password are ubuntu/ubuntu

SSH into the Pi with ssh [email protected] and change the default password. Store this password as you won't have access to it later.

These instructions should work with Ubuntu 18.0.4 installed on the Pi.

For Ubuntu 18.0.04, install the bionic universe repository

sudo add-apt-repository "deb http://archive.ubuntu.com/ubuntu bionic universe"

Then run an apt update to pull in the new repo: sudo apt-get update

Some packages are no longer installable from the bionic repository using the 18.0.4 image. You will need to install aptitude to continue.

sudo apt-get install aptitude

Once Aptitude is installed, any command you issue with aptitude will need confirmation to downgrade the packages. If you see this prompt after issuing the aptitude install command:

    Accept this solution? [Y/n/q/?]

Enter 'n' and press enter. You will then be prompted to downgrade existing packages for the dependencies to be installed. Once the downgrade option is presented:

    Accept this solution? [Y/n/q/?]

Enter 'y' and press enter. You will then be prompted to proceed with installation.

Install GNU Radio and other associated packages...

GNU Radio may be installed by manually compiling from source, the PyBOMBS GNU Radio install management system, or using APT to install from the APT package repository.

Using the Ubuntu package repository and the APT package manager is the currently preferred method for installing GNU Radio:

sudo aptitude install gnuradio gnuradio-dev libuhd-dev libgnuradio-uhd3.7.11

For all SDR based devices...

sudo aptitude install gr-osmosdr libosmosdr0

If using HackRF or one of its derivatives...

sudo aptitude install hackrf libhackrf0 libhackrf-dev

Install tools to compile Trunk Recorder

sudo apt-get install libusb-1.0-0.dev 
sudo aptitude install git cmake make build-essential libboost-all-dev

Install dependencies for Trunk Recorder

sudo aptitude install libaacs0 libcppunit-dev libcppunit-1.14-0 libvo-aacenc0 libssl-dev openssl curl libcurl3-gnutls libcurl4 libcurl4-openssl-dev fdkaac sox

Continue to the Building Trunk Recorder wiki page.


Clone this wiki locally