This project is built on an Orange Pi 3 LTS specifically for mountaintop site use as a BPQ link/BBS node and APRS Digipeater/Igate (TX/RX)

*** Installing the OS and Basic Configuration ***
Start with a clean OS installation. This project started with a foundation of Armbian Jammy Linux 6.1.30 (http://www.orangepi.org/html/hardWare/computerAndMicrocontrollers/details/orange-pi-3-LTS.html)

To start with, you can use Win32DiscImager (https://win32diskimager.org/) or Etcher (https://etcher.balena.io/) to burn the OS ISO image onto a 32GB MicroSD card. You can use as small a card as 8GB but 32GB gives you a lot more space for application development and data services for LinBPQ.

Once you have the MicroSD card ready, insert it in the Pi and power up the Pi. You will want to have the Pi connected to a monitor and hardline ethernet to make the initial setup as simple as possible.

When you first start the Pi it will run you through a setup up wizard with location, password, and network settings. When the settings are done it will ask if you want to run the updates, I suggest running the updates.

Make sure you write down the password. When the updates are done it will ask if you want to restart the Pi. Go ahead and restart it.

Basic Configurations
These are the basic configuration questions and answers

Root Password
     Hamaker: [ASK THE INFRASTRUCTURE TEAM]
Choose default shell
     bash
Create new user account
     [ASK THE INFRASTRUCTURE TEAM]
Create user password
     [ASK THE INFRASTRUCTURE TEAM]
Real name
     W7VWadmin
Timezone (Auto detects)
     America/Los_Angeles
Set language based in location
     Y
Set local
     ((1) en_US.TUF-8)
     1

After answering these questions you should have a cursor something like this:
     root@orangepi3-lts:~#

System
Let's star with some basic system changes using the config tool
     armbian-config
Starting with the System Settings section.

The first thing we want to set up is SSH. Use the arrow keys to move between options and enter to select an option.

There are four settings for SSH, use the space bar to toggle the options on or off. Default has the first three on [*], we want to turn off PermitRootLogin.
     [ ] PermitRootLogin
     [*] PasswordAuthentication
     [*] PubkeyAuthentication
     [ ] PhoneAuthentication
Use the tab key to switch between <Save> and <Cancel>. Once saved use <Cancel> to go to the previous screen.

Earlier we selected bash as our default shell, ZSH is a very useful tool and I do recommend using it for day to day use. To get the best out of ZSH we should set it up. Select ZSH from the System Settings menu. This will run an installation script and switch the default root shell to ZSH. Press the return key to go back one menu.

In the System Settings menu tab to <Cancel> and press enter to get back to the main menu.

If you are on the network you will be running this box, you will want to use the Network option set your IP address ( I recommend a Static IP address for a server) and unless you need WiFi I would turn off the WiFi interface. These can also be done in the Network Manager. As I am installing this on the bench I will be coming back to these in the cleanup at the end of the configuration and software installation.

Now we are ready to exit the configuration tool, from the main menu tab to <Exit> and press enter.

Let's take care of that default hostname orangepi3-lts, since we are already root we can do this easily.

lets edit the /etc/hostname file and change the top line to what we want our hostname to be, in this case Hamaker-PktAPRS.
     nano /etc/hostname

Once you are done editing the following keystrokes [ctl] x  followed by y will save the file and exit nano.

This wraps up the basic install and configuration. Now its time to reboot the Pi  before continuing on. Make sure you note the IP address so you can SSH in to continue.
     ip a
     reboot

Now that the Pi is accessible remotely, log in through SSH.

Before doing any further installation or configuration it is a good idea to update the OS and software.
     sudo apt update && sudo apt upgrade -y

Network Configuration
The Pi I am working with does not have WiFi enabled by default so I don't neet to turn it off.   If you are working with a Pi that will be installed in a location like a mountaintop, with radios, including some on 2.4GHz it is a good idea to turn it off unless you need it. The best practice for this environment is to use hardwire ethernet for all network connections, shielded CAT5 minimum.

Also on the topic of networking, since there is only one ethernet port on the Pi, and we want to have the Pi on two networks for this project, the local net and AREDN, we will have to create a VLAN port as well.

This distribution already has vlan installed, but if yours does not, go ahead and install it.
     sudo apt-get install vlan

Enter the following command to se what the network device name is so we can create the VLAN port.
     nmcli device status

You should see something like this report back

DEVICE        TYPE                STATE                CONNECTION
eth0                ethernet        connected                Wired connection 1
Wlan0        ethernet        disconnected        Wireless connection 1
lo                loopback        unmanaged                --

Load the 8021q module into the kernel.
     sudo modprobe 8021q

Create a new interface that is a member of a specific VLAN, VLAN id 10 is used in this example. This command will add an additional interface next to the interfaces which have been configured already, so your existing configuration of eth1 will not be affected.
     sudo ip link add link eth0 name eth0.10 type vlan id 10

Assign an address to the new interface.
     sudo ip addr add 10.101.255.62/28 dev eth0.10

Starting the new interface.
     sudo ip link set up eth0.10

Add the module to the kernel on boot:
     sudo su -c 'echo "8021q" >> /etc/modules'

Create the interface and make it available when the system boots. Add the following lines to /etc/network/interfaces (change the values according to your scenario):

     auto eth0.10
     iface eth0.10 inet static
         address 10.101.255.62
         netmask 255.255.255.240
         vlan-raw-device eth0

User Configuration 
The primary User (listed here, and throught as pi)  will need to be added to the tty group to use telnet to access the LinBPQ node locally, and remotely if enabled, and you will need to install telnet and libcap2-bin as well.
     sudo adduser w7vwadmin tty

The user may already be a member of tty, this is just to ensure it is'
     sudo apt install telnet libcap2-bin

On my machine, libcap2-bin was already installed.

Next it’s time to make a remote location image directory and mount it.

*** Installing Direwolf ***
Install Direwolf with the following commands.
     sudo apt-get install cmake libasound2-dev libudev-dev automake libtool texinfo ax25-tools
     git clone https://github.com/Hamlib/Hamlib
     ./bootstrap
     ./configure
     make
     make check
     sudo make install
     git clone https://www.github.com/wb2osz/direwolf
     cd direwolf
     mkdir build && cd build
     cmake ../direwolf/
     cmake -DUNITTEST=1 ../direwolf/
     make –j4
     make test
     sudo make install
     make install-conf

An additional package that may become useful is text-to-speech functionality so we will install this now. This is optional.

     sudo apt-get install speak

*** Installing LinBPQ ***
Now its time to install the LinPBQ software.
     sudo dpkg --add-architecture armhf
     sudo apt install libstdc++6:armhf zlib1g:armhf
     wget http://www.cantab.net/users/john.wiseman/Downloads/installLinBPQ
     chmod +x installLinBPQ
     ./installLinBPQ

To use some of the IP features of LinBPQ you will need to set some capabilities for linbpq, or run it as root which is not a good idea. a couple of steps back you installed libcap2.bin, here is where you use it.
     sudo setcap "CAP_NET_ADMIN=ep CAP_NET_RAW=ep CAP_NET_BIND_SERVICE=ep" linbpq

*** RA-35 Audio Interface  ***
A quick run of
     cat /proc/asound/cards

Returns
     0 [sun9ihdmi ]: sun9i-hdmi - sun9i-hdmi
               sun9i-hdmi
     1 [Device    ]: USB-Audio - USB PnP Sound Device
              C-Media Electronics Inc. USB PnP Sound Device at usb-xhci-hcd.1.auto-1, full sp
      2 [Device_1  ]: USB-Audio - USB PnP Sound Device
               C-Media Electronics Inc. USB PnP Sound Device at usb-5311400.usb-1, full speed

The first column is the ALSA device (major) number. In this case,

device 0 (hw:0) is the sun9i-hdmi audio over HDMI
device 1 (hw:1) is the USB 1-1 device. This is identified by the usb-xhci-hcd.1.auto-1
device 2 (hw:2) is the USB 6-1 device. Identified by usb-5311400.usb-1

The usb-xxx are important for us to know, we will refer back to them in a minute and they will be important in future troubleshooting.

Now run the cm108 application. This is a part of the Direwolf installation.

     cm108

The output is wide so I wont reproduce it here and I highly recommend making your terminal window wide enough so there is no word wrap. The output clearly identifies your devices, where they are located and most importantly, how to make the USB device locations permanent.

Read the text after the device output, create the file the output suggests, and copy the suggested file contents into the file, then reboot the OPi.

     sudo nano /etc/udev/rueld.d/85-my-usb-audio.rules

In the new file input your recommended text which will be a little different

     SUBSYSTEM!="sound", GOTO="my_usb_audio_end"
     ACTION!="add", GOTO="my_usb_audio_end"
     DEVPATH=="/devices/platform/soc/5200000.usb/xhci-hcd.1.auto/usb1/1-1/1-1:1.0/sound/card?", ATTR{id}="Fred"
     DEVPATH=="/devices/platform/soc/5311400.usb/usb6/6-1/6-1:1.0/sound/card?", ATTR{id}="Wilma"
     LABEL="my_usb_audio_end"

Save the file
     sudo reboot

This is also a good time to copy down the important bits of the data for future reference as we start doing the configuration

Set Audio Levels
We need to check the audio levels and make sure the input is not muted.

The alsamixer -c 1 will open up a command line graphical display showing the 'speaker' and 'microphone' levels. Both should be set around 30 to start with. Make sure the microphone is not muted. If it is muted there will be an MM at the bottom of its bar scale. If there is a 00 and looks like the speaker bar scale then it is not muted. To toggle the mute function press the "m" key. After setting channel 1 set channel 2 and to make sure the settings doesn't default with sudo alsactl store.

When we start running Direwolf  we may have to come back and adjust the input and or output settings, but this is a good place to start.

*** Configuring Direwolf - direwolf.conf ***   
Direwolf is a complex application with a lot of configuration possibilities. This implementation uses Direwolf as the APRS processor internally. BPQ will use the TCP connection 127.0.0.0:8001

The configuration data is pretty short so a stripped down version of the file can be used. Just be sure to copy the big default dirwolf.conf to another file like direwolf.conf.default

     cp direwolf.conf direwolf.conf.default

Then edit the direwolf.conf file with the following

    # FIRST AUDIO DEVICE PROPERTIES (Channel 0 + 1 if in stereo)
    ADEVICE pasym0
    ADEVICE plughw:Fred,0
    ACHANNELS 1

    # SECOND AUDIO DEVICE PROPERTIES (Channel 2 + 3 if in stereo)
    ADEVICE1 pasym2
    ADEVICE1 plughw:Wilma,0
    ACHANNELS 1

    # CHANNEL 0 PROPERTIES APRS
    CHANNEL 0
    MYCALL KFALLS
    MODEM 1200
    FIX_BITS 0
    PTT CM108

    # DIGIPEATER PROPERTIES
    DIGIPEAT 0 0 ^WIDE[3-7]-[1-7]$ ^WIDE[12]-[12]$ ^TRACE

    # BEACONING PROPERTIES
    PBEACON sendto=IG delay=0:30 every=60:00 symbol="igate" overlay=T lat=42^04.18N long=121^58.39W
     CBEACON sendto=0 dest=MORSE-10 delay=0:30 every=60:00 info="de W7VW"

     # INTERNET GATEWAY
     IGSERVER noam.aprs2.net
     IGLOGIN W7VW 29314
     IGTXVIA 0 WIDE1-1,WIDE2-1
     IGFILTER t/m/KFALLS/50
     IGTXLIMIT 6 10
     FILTER IG 0 t/mwa

     # CHANNEL 2 PROPERTIES PACKET
     CHANNEL 2
     MYCALL W7VW
     MODEM 1200
     FIX_BITS 0
     PTT CM108
     KISSPORT 8001

This sets up direwolf as the APRS processor directly all on Channel 0 and leaves Channel 2 open for PBQ and regular packet communications.

*** Configuring LinBPQ - bpq32.cfg ***
Next you will need to set up the LinBPQ configuration file bpq32.cfg This file is larger than Direwolf.conf

;------------------ HAMAKR:W7VW BPQ Configuration File -----------------
; Last Edited 04-26-2023
;
; Node run on Orange Pi 3 LTS with one network card (Running VLAN for Private
; WAN/LAN, AREDN, and INET access) The Node has 2 RF ports for Packet (1) and
; APRS (2), 1 AIX port (7), 1 telnet (8) and 1 HTTP (8) port, both
; accessable over the 2 ethernet ports, on on the local networks (9) and the
; other over AREDN (10).
;
;-------------------------------- BASE CONFIG --------------------------
LOCATOR=CN92DE
MAPCOMMENT=<p>Klamath Basin Amateur Radio Association<br/>W7VW<br/>Klamath County, OR<br/>APRS Digi/IS<br/>Packet 145.050 MHz<br/>BBS, Chat, Mail<br/>email hidden; JavaScript is required<br/>Admin:jon@kk6gxg.com<br/>email hidden; JavaScript is required<br/></p>
;PASSWORD=   ;Do I need this?
NODECALL=W7VW-1 ;Hamaker W7VW-1, Hogback W7VW-2, Stukel W7VW-3
NODEALIAS=HMKR  ;Hamaker - HMKR, Hogback - HGBK, Stukle - STKL
IDMSG:
W7VW HMKR Network Node, Hamaker Mtn. OR CN92AB
****
;
BTEXT:
W7VW HMKR Network Node, Hamaker Mtn. OR CN92AB
QSO email hidden; JavaScript is required
****
;
INFOMSG:
Welcome to the Klamath Basin Amateur Radio Association BPQ node
Located on Hamaker Mtn. in Southern Oregon CN92AB
This node provides local club and EmComm message handling
for OR, and parts of CA, and NV.

HMKR:W7VW-1    BPQ Node
HMKRBB:W7VW    BBS (Local & Net Mail)
HMKRCH:W7VW-6  Chat

Type ? for Help
****
;
CTEXT:
LMTNET:KK6GXG-4} BBS CONNECT INFO NODES ROUTES PORTS USERS MHEARD BYE
****
;
FULL_CTEXT=0
;
;------------------------------ END BASE CONFIG ------------------------
;
;-------------------------------- NETWORK CONFIG -----------------------
OBSINIT=5
OBSMIN=4
NODESINTERVAL=30
IDINTERVAL=30
BTINTERVAL=30
L3TIMETOLIVE=25
L4RETRIES=3
L4TIMEOUT=60
L4DELAY=10
L4WINDOW=4
MAXLINKS=63
MAXNODES=450
MAXROUTES=64
MAXCIRCUITS=128
MINQUAL=143
MAXHOPS=6
MAXRTT=90
BUFFERS=999
PACLEN=236
T3=180
IDLETIME=1200
AUTOSAVE=1
SAVEMH=1
BBS=1
NODE=1
HIDENODES=0
ENABLE_LINKED=A
LINMAIL=1
LINCHAT=1
;
;------------------------------ END NETWORK CONFIG ---------------------
;
;-------------------------------- BEGIN PORTS --------------------------
;
;---------------------------- VHF Packet 145.050 -----------------------
PORT
 PORTNUM=1;
 ID=Packet 145.050 MHz 1k2
 TYPE=ASYNC
 PROTOCOL=KISS
 FULLDUP=0
 IPADDR=127.0.0.0
 TCPPORT=8001
 SPEED=9600
 CHANNEL=A
 PERSIST=255
 SLOTTIME=20
 TXTAIL=1
 QUALITY=1
 MINQUAL=81
 FRACK=6000
 RESPTIME=40
 RETRIES=20
 MAXFRAME=1
 PACLEN=236
 UNPROTO=ID
 L3ONLY=0
 DIGIFLAG=1
 DIGIPORT=0
 USERS=3
 IGNOREUNLOCKEDROUTES=1
ENDPORT
;--------------------------- END VHF Packet RADIO ----------------------
;
;--------------------------------- Telnet ------------------------------
; Telnet port for local and AREDN direct BBS access. Username and 
; password must be set up by admin in advance. No self registration 
; function.
;
PORT
PORTNUM=8
 ID=Telnet Server
 Driver=Telnet
CONFIG
 LOGGING=1
 DisconnectOnClose=1
 TCPPORT=8023
 FBBPORT=8011 8012 8013 8014
 HTTPPORT=8000
 LOGINPROMPT=user:
 PASSWORDPROMPT=password:
 MAXSESSIONS=12
 FALLBACKTORELAY=1
 RELAYHOST=127.0.0.1
 RELAYAPPL=BBS
; USER=username,password,callsign,,SYSOP
ENDPORT
;--------------------------------- End Telnet --------------------------
;
;--------------------------------- ETHERNET 1 --------------------------
; Ethernet port 1 is to allow local network access to HTTP and telnet.
;
PORT
PORTNUM=9
 ID=BPQEther Link
 TYPE=EXTERNAL
 DRIVER=BPQETHER
 QUALITY=200
 IOADDR=2
 CHANNEL=A
 MAXFRAME=7
 FRACK=5000
 RESPTIME=1000
 RETRIES=10
 PACLEN=236
 MINQUAL=255
 UNPROTO=MAIL
 CONFIG
  TXMODE BPQ
  RXMODE BPQ
  TYPE 08FF
  DEST ff-ff-ff-ff-ff-ff
  SOURCE 02:07:46:a9:d3:d1
  ADAPTER eth0
ENDPORT
;------------------------------- END ETHERNET 1 ------------------------
;
;--------------------------------  ETHERNET 2 --------------------------
; Ethernet port 2 is for AREDN network access to HTTP and telnet.
PORT
PORTNUM=10
 ID=BPQEther Link
 TYPE=EXTERNAL
 DRIVER=BPQETHER
 QUALITY=200
 IOADDR=4
 CHANNEL=A
 MAXFRAME=7
 FRACK=5000
 RESPTIME=1000
 RETRIES=10
 PACLIN=236
 MINQUAL=255
 UNPROTO=MAIL
 CONFIG
  TXMODE BPQ
  RXMODE BPQ
  TYPE 08FF
  DEST ff-ff-ff-ff-ff-ff
  SOURCE 02:07:46:a9:d3:d1
  ADAPTER eth0.10
ENDPORT
;------------------------------- END ETHERNET 2 -----------------------
;
;------------------------------ APPLICATIONS --------------------------
;
APPLICATION 1,BBS,,W7VW,HMKRBB,254
APPLICATION 2,CHAT,,W7VW-6,HMKRCH,254
;
;-------------------------- END APPLICATIONS --------------------------
;
;--------------------- END CONFIGURATION FILE --------------------------

*** END ***
************************************************************************
************************************************************************

*** Reference Material *** 

Direwolf of LinBPQ
https://packet-radio.net/installing-direwolf-and-linbpq-on-raspian-stretch/ 

Direwolf LinBPQ config
https://packet-radio.net/direwolf-to-linbpq-configuration-and-parms/ 

https://github.com/nwdigitalradio/direwolf/blob/master/99-direwolf-cmedia.rules 

*** Still To Do  ***

Direwolf - service startup and cron check

LinBPQ - service startup and cron check

Set up remote location for backups

Set up remote backups

************************************************************************
************************************************************************