Pages

10/04/2019

APRS - Installing Direwolf 1.5 on a Raspberry Pi running Raspbian Lite

I've previously written a blog post about setting up an APRS Digipeater with a Tait 8105. Almost a year has passed since then and the latest release of Direwolf now natively supports the CM108 Sound Fobs, so we can ditch Hamlib. This makes configuration much simpler.

The following is a quick and dirty guide to getting Direwolf setup as a Digitpeater on Raspbian. For more detailed instructions on getting a Tait radio configured see the previous blog post.

My node shown on http://aprs.fi

Click read more for the configuration instructions.

Install and configure Direwolf
The version of Direwolf in the Raspbian repository is quite old and doesn't include support for the CM108, so instead we need to build it from source.

First of all you need to sudo:
sudo su


Then you need to update your repositories and packages:
apt-get update
apt-get upgrade


Next, install the required dependencies:
apt-get install git build-essential libasound2-dev libudev-dev alsa-utils rsyslog logrotate gpsd libgps-dev

  1. 
    
Build direwolf from the source code by running the following commands one by one:
cd /usr/src
git clone http://github.com/wb2osz/direwolf
cd direwolf
make
make install


Create the direwolf config file:
vim /etc/direwolf.conf


And  then fill it in as required, using the excellent documentation for reference. Mine looks something like this:
#############################################################
#                                                           #
#               Configuration file for Dire Wolf            #
#                                                           #
#                   Linux version                           #
#                                                           #
#############################################################

# Consult the User Guide for more details on configuration options.

#############################################################
#                                                           #
#               FIRST AUDIO DEVICE PROPERTIES               #
#               (Channel 0 + 1 if in stereo)                #
#                                                           #
#############################################################

# You may need to update the "ADEVICE":
ADEVICE  plughw:1,0
ACHANNELS 1

#############################################################
#                                                           #
#               CHANNEL 0 PROPERTIES                        #
#                                                           #
#############################################################

# You will need to update your call sign, and potentially your PTT configuration

CHANNEL 0
MYCALL 2E0SIP-10
MODEM 1200
PTT CM108

#############################################################
#                                                           #
#               BEACONING PROPERTIES                        #
#                                                           #
#############################################################

# The following will beacon a location over RF every 15 minutes. You should edit your location, comment etc

PBEACON delay=1 every=15 overlay=S symbol="digi" lat=51.655715 long=-0.419245 power=25 height=20 gain=3 comment="Direwolf - (No Antenna, currently testing)" via=WIDE1-1,WIDE2-1

#############################################################
#                                                           #
#               DIGIPEATER PROPERTIES                       #
#                                                           #
#############################################################

# The following will digipeat packets recieved via RF back over RF. You should study the documentation and ensure you're using a suitable path.

DIGIPEAT 0 0 ^WIDE[3-7]-[1-7]$|^TEST$ ^WIDE[12]-[12]$ TRACE

#############################################################
#                                                           #
#               INTERNET GATEWAY                            #
#                                                           #
#############################################################

# Configuring the below section will relay APRS packets recieved over APRS to APRS-IS, so they will display on sites such as http://aprs.fi

# First you need to specify the name of a Tier 2 server.
# The current preferred way is to use one of these regional rotate addresses:
# noam.aprs2.net   - for North America
# soam.aprs2.net  - for South America
# euro.aprs2.net  - for Europe and Africa
# asia.aprs2.net   - for Asia
# aunz.aprs2.net  - for Oceania

IGSERVER euro.aprs2.net

# You also need to specify your login name and passcode.
# Contact the author if you can't figure out how to generate the passcode.

IGLOGIN [YOUR CALL / SSID] [YOUR PASSCODE]

# Some might want to send an IGate client position directly to a server
# without sending it over the air and relying on someone else to
# forward it to an IGate server.  This is done by using sendto=IG rather
# than a radio channel number. Overlay R for receive only, T for two way.
# Remember to update the latitude and longitude etc.

PBEACON sendto=IG delay=1 every=15 overlay=S symbol="digi" lat=51.555715 long=-0.419245 power=25 height=20 gain=3 comment="Direwolf - (No Antenna, currently testing)" via=WIDE1-1,WIDE2-1

#############################################################
#                                                           #
#                LOGGGING PROPERTIES                        #
#                                                           #
#############################################################

# Direwolf can log to a file as well as stdout. No rotation is included by default, so use logrotate. Define the path below.

LOGDIR /var/log/direwolf/


Create the direwolf user:
adduser --system --no-create-home --group direwolf


Add them to the audio group:
usermod -g audio -G audio direwolf


Starting Direwolf on boot

Next we need to create a systemd service so direwolf starts on boot. We also redirect stdout and stderr to syslog, so we can treat it as a log file.

First create the direwolf.service file:
vim /lib/systemd/system/direwolf.service


Enter the following:
[Unit]
Description=Direwolf Daemon
Wants=network-online.target
After=sound.target syslog.target network-online.target

[Service]
User=direwolf
ExecStart=/usr/local/bin/direwolf -t 0 -c /etc/direwolf.conf
StandardOutput=syslog
StandardError=syslog
SyslogIdentifier=direwolf

[Install]
WantedBy=multi-user.target


Symlink the service:
ln -s /lib/systemd/system/direwolf.service /etc/systemd/system/direwolf.service


Reload systemctl:
systemctl daemon-reload


Enable the direwolf service:
systemctl enable direwolf


Also enable the systemd-networkd-wait-online service so Direwolf starts after the network is up.
systemctl enable systemd-networkd-wait-online


Configure Logging 

Earlier we configured the direwolf systemd service file to redirect all stdout and stderr to syslog. So it's easier to read we need to redirect the log entries to their own file.

Create the directory for the log files:
mkdir /var/log/direwolf


Set the permissions to the correct user:
chown -R direwolf:direwolf /var/log/direwolf/


Create a .conf file for rsyslog:
vim /etc/rsyslog.d/direwolf.conf


And enter the following:
if $programname == 'direwolf' then /var/log/direwolf/direwolf.log
& stop


Then create a logrotate configuration file
vim /etc/logrotate.d/direwolf


And enter the following. Feel free to edit the parameters to suit your needs:
/var/log/direwolf/aprs.log
{
    rotate 5
    daily
    missingok
}

/var/log/direwolf/direwolf.log
{
    rotate 5
    daily
    missingok
    postrotate
        invoke-rc.d rsyslog rotate > /dev/null
    endscript
}


Finishing Off 

That concludes the configuration, you should now be able to reboot the Raspberry Pi and Direwolf should start running.

To check Direwolf is running run the following:
systemctl status direwolf


To restart Direwolf, run the following:
systemctl restart direwolf


To view the logs in real time:
tail -n 100 -f /var/log/direwolf/direwolf.log


No comments:

Post a Comment