Notes on installing and running LINBPQ.

Introduction

LINBPQ is a Linux version of the BPQ32 Node,  BBS and Chat Server components. An APRS Mapping and Messaging application is available as a separate program. Although all testing was done on Linux systems (Raspberry PI running Raspbian and a PC running Ubuntu) it should work on other Unix systems.

LINBPQ normally runs as a console application but can be run as a daemon. I usually have it set to run in a virtual console, started by init.

Management is via a Web Browser.

Installation.

The i386 Ubuntu version can be downloaded from

http://www.cantab.net/users/john.wiseman/Downloads/Beta/linbpq

and the pi version from

http://www.cantab.net/users/john.wiseman/Downloads/Beta/pilinbpq

The Ubuntu version should run on most Linux distributions on x386 hardware. The PI version should run on similar ARM based platforms, including the Beaglebone Black. The source is available for those who want to try it on another platform.

I suggest you create a directory linbpq to hold the software and files. The simplest way to download is to use wget. If you use the pi version, rename to linbpq after downloading.

You will need to make it executable.

chmod +x linbpq

If you want to use UDP or TCP ports below 1024, or the BPQEther Driver, you must also set some capabilites on the file (or run as root, which is not advisable). You may need to install setcap if it isn't already on your system - sudo apt-get install libcap2-bin (or the equivalent for your disatribution.

sudo setcap "CAP_NET_ADMIN=ep CAP_NET_RAW=ep CAP_NET_BIND_SERVICE=ep" linbpq

You also need some web pages for the management interface. Create directory HTML (capitals) under your linbpq directory, and download and unzip http://www.cantab.net/users/john.wiseman/Downloads/Beta/HTMLPages.zip into it.

Configuration.

The Node configuration is read from file bpq32.cfg, the format of which is the same as for the Windows version. (note like all Unix names it is case sensitive - BPQ32.cfg won't work).

As management is web based, you must have a Telnet port with an HTTPPORT line and a user record for yourself. Set the SYSOP flag on the user record - something like:

USER=john,pass,g8bpq,,SYSOP

You may also need TCPPORT and FBBPORT lines for access using telnet or bpqtermtcp

The BBS config is stored in linmail.cfg. . This will be created when the software first runs if it doesn't already exist. If you are switching from Windows to Linux you can copy the BBS configuration file (BPQMail.cfg) to linmail.cfg.

The Chat Server config is stored in chatconfig.cfg. This will be created the first time the software runs, and can be updated using the web management interface.

Running.

If run without a parameter, ie ./linbpq only the node will run. If you add mail as a parameter, ie ./linbpq mail the BBS will be started. If you add chat, the Chat Node will be started. See below for details of how to run LinBPQ automatically when Linux loads.

You can also add the lines

LINMAIL
and/or
LINCHAT

to bpq32.cfg to enable the Mail or Chat servers

To close LinBPQ type ctrl/c.

Management.

Management is via a Web browser, I've tested with Chrome and Firefox, but others may work. Just point the browser to host:HTTPPORT, and the rest should be obvious. If you access locally as 127.0.0.1 (not localhost) you don't need a password to access the mail pages. If not you will have to sign in using the user and password from the telnet port configuration.

Debuging

Problems are likely in the early stages. Set your system up to create core files when a program fails if this isn't enabled by default. On my systems this needs the command

ulimit -c unlimited



I added it to file .bashrc

Using TNC-PI

The TNC-PI is configured much the same as a normal KISS port, but with the following line added

KISSOPTIONS=PITNC,NOPARAMS

This will prevent the Node sending KISS Parameters, and thus overriding the values set using the pitnc_setparams program.

   via Serial port.

Note that SPEED must be set to 19200

   via i2c Port

TYPE is set to I2C instead of ASYNC, and IOADDR/COMPORT are replaced with I2CBUS and I2CDEVICE:

TYPE=I2C
PROTOCOL=KISS
I2CBUS=0                ; 0 for Version 1 board, 1 for Version 2
I2CDEVICE=16            ; This is in decimal

The following instructions were originally written for the Raspberry PI, with the LinBPQ software running as user pi. The user name can be changed to suit your installation. It is possible to run as root, but this is not advisable

Running LinBPQ automatically

The following instructions were originally written for the Raspberry PI, with the LinBPQ software running as user pi. The user name can be changed to suit your installation. It is possible to run as root, but this is not advisable

You can have LinBPQ start automatially when the OS is loaded, and restart if it fails. I suggest running it in a Linux Virtual Console - the examples use tty2, but you can change to suit you requirements The mechanism uses  the init process, but the details depend on the disribution.

Note the script includes a rename. This is to simplify updating - with some systems you can't overwrite linbpq when it is running. so to update, download the new version to another location, rename to linbpq.new, run setcap if needed, then move to the linbpq directory. Then close linbpq (ctrl/c). The new version will then be renamed and started.

Create a script to run linbpq

/home/pi/linbpq/runbpq

cd /home/pi/linbpq
sudo -u pi mv linbpq.new linbpq
sudo -u pi ./linbpq

Set runbpq ax executable:

chmod a+x /home/pi/linbpq/runbpq

For Rasbian Wheezy

Add the following lines to /etc/inittab

#
# Start LinBPQ on bootup and respawn it should it crash
BPQ:2345:respawn:/home/pi/linbpq/runbpq >/dev/tty2

Remove (or comment out) the line

2:23:respawn:/sbin/getty 38400 tty2

For Rasbian Jessie

Change runbpq to:

cd /home/pi/linbpq
sudo -u pi mv linbpq.new linbpq
sudo -u pi ./linbpq >/dev/tty2

Add user pi to group tty

Create file /etc/systemd/system/linbpq.service containing:

[Unit]
After=network.target

[Service]
ExecStart=/bin/bash /home/pi/linbpq/runbpq
Restart=always

[Install]
WantedBy=multi-user.target

Run command:
sudo systemctl enable linbpq.service

For Ubuntu

Create a file bpq.conf in directory /etc/init

/etc/init/bpq.conf

#
start on runlevel [2345]
stop on runlevel [!2345]
respawn
exec "/home/pi/linbpq/runbpq" >/dev/tty2

In directory /etc/init rename tty2.conf to tty2.save

For those unfamilair with Linux Virtual Consoles, the linux system has several console windows (usually 7) that you can switch between using the key combination alt/fn1 to alt/fn7. If you are running the X gui this nomally runs in 7, and you can switch to the others using ctrl/alt/fn1 etc. If you are accessing remotely, for example using ssh, there is a program conspy that allows to to interact with the virtual consoles.You''ll probably need to install it - eg sudo apt-get install conspy.

Running Spider DX Cluster with LinBPQ

See here for instructons for running the Spider DX Cluster software with LinBPQ.

Using 3rd party APRS Clients

LinBPQ has an APRS client, but if you prefer to run another (eg Xastir), you can configure the LinBPQ to APRS code to bridge packets to/from it.

This uses a pair of socat virtual serial ports, with one defined to the APRS Client and the other to LinBPQ

socat -d -d -ly pty,raw,echo=0,link=com5 pty,raw,echo=0,link=com6

Add a KISS port definiton to bpq32.cfg - something like

PORT
 ID=COM5 Bridge to XASTIR
 TYPE=ASYNC
 PROTOCOL=KISS
 QUALITY=0
 COMPORT=com5 
 CHANNEL=A 
 SPEED=9600
 MAXFRAME=6
 FRACK=5000
 RESPTIME=1000
 RETRIES=10
 PACLEN=236
ENDPORT

Add the following to the APRSDIGI section. This assumes your APRS RF port is Port 1 and the virtual port is Port 2

 APRSPath 2=APRS

Bridge 1=2
Bridge 2=1

Any packet received on Port 1 will be sent unchanged to Port2, and vice versa. Note this is not the same as if they were digipeated - the digi stings are not examined or updated. It looks to the APRS client that is has direct access to the RF port. The Client should not be set to digi anything - that is done by LinBPQ. The Client is just providing the messaging and display/mapping functions.



John Wiseman G8BPQ
16th March 2013