Compile linBPQ with Podman in Debian
First create a folder where the linbpq software will be placed. Everything else will be generated, used and destroyed with the container.
note: These directories are of my choice, linBPQ in the end is a single executable file that will looks for everything it needs in the folder you'll run it.
export PODNAME="bpq-jru"
mkdir -p $PODNAME/opt
cd $PODNAME/opt
Run the pod interactively, clone the source code and compile it.
note: As a container image I choose the slim version of the Debian Trixie.
podman run \
--rm \
--volume $PWD:/opt/linbpq \
--interactive \
--tty \
docker.io/debian:stable-slim
Inside the container download all the packages required
export DEBIAN_FRONTEND=noninteractive
mkdir /buildd && cd /buildd
apt update
apt install -y --no-install-recommends git ca-certificates \
make gcc sudo patch \
libcap2-bin \
libconfig-dev \
libminiupnpc-dev \
libpcap-dev \
zlib1g-dev \
libjansson-dev \
libpaho-mqtt-dev
Clone linBPQ source code1
git clone https://github.com/g8bpq/linbpq
cd linbpq
Warning: compile will try to execute the binary at the end which is not needed.
patch makefile
note: to patch there are different ways, ex. install an editor and comment out the line (apt install vim-tiny) or save the patch below in a file and apply it using the patch command.
diff --git a/makefile b/makefile
index 26403e5..d70be61 100644
--- a/makefile
+++ b/makefile
@@ -75,7 +75,7 @@ noi2c: linbpq
linbpq: $(OBJS)
cc $(OBJS) $(CFLAGS) $(LDFLAGS) $(LIBS) -o linbpq
- sudo setcap "CAP_NET_ADMIN=ep CAP_NET_RAW=ep CAP_NET_BIND_SERVICE=ep" linbpq
+ #sudo setcap "CAP_NET_ADMIN=ep CAP_NET_RAW=ep CAP_NET_BIND_SERVICE=ep" linbpq
-include *.d
compile and save the file in the volume monted.
make
cp linbpq /opt/linbpq/
exit
Test (run interactive).
Run a new container where we will install all the dependencies, this time we also publish the un-priviledge ports used by the software.
# Do not set cap if we use root users inside the container
# to use cap add
#
# --cap-add=CAP_NET_ADMIN \
# --cap-add=CAP_NET_RAW \
# --cap-add=CAP_NET_BIND_SERVICE \
export PODNAME="bpq-jru"
cd $PODNAME/opt
podman run \
--rm \
--volume $PWD:/opt/linbpq \
--interactive \
--tty \
--publish 8080:8080 \
--publish 8100:8100 \
--publish 8101:8101 \
docker.io/debian:stable-slim
deploy any config file if available, linBPQ at least requires the bpq32.cfg.
cd /opt/linbpq
# Run it (install required libraries)
export DEBIAN_FRONTEND=noninteractive
apt update
apt install -y sudo \
libcap2-bin \
libconfig11 \
libminiupnpc18 \
libpcap0.8t64 \
zlib1g \
libjansson4 \
libpaho-mqttpp3-1
./linbpq
Links: