Installation

Debian packages

Per-architecture .deb packages (amd64, arm64, armhf), statically linked — no runtime dependencies:

PackageContents
can-hubhub daemon, can-hub-cli and the can-hub-web admin panel, can-hub.service and can-hub-web.service (both enabled and started on install, the panel on loopback), /etc/can-hub/hub.conf and web.conf, dedicated can-hub system user
can-hub-agentSocketCAN exporter, can-hub-agent.service (installed but not started until configured), /etc/can-hub/agent.conf, state in /var/lib/can-hub-agent
can-hub-clientreference consumer, plus an optional can-hub-socketcand.service bridge (not started by default), /etc/can-hub/socketcand.conf

APT repository

curl -fsSL https://apt.can-hub.io/key.gpg | sudo tee /usr/share/keyrings/can-hub.gpg >/dev/null
echo "deb [signed-by=/usr/share/keyrings/can-hub.gpg] https://apt.can-hub.io stable main" | sudo tee /etc/apt/sources.list.d/can-hub.list
sudo apt update

gpg --show-keys /usr/share/keyrings/can-hub.gpg must print the signing key fingerprint 882FA1A7753DE71C0FEC849CBCEB231428DE4144.

The repository keeps the last ten releases. Until the wire protocol is frozen, hub and agents should run the same version; pin one with sudo apt install can-hub-agent=0.6.1.

Without the repository, every release ships the same debs: sudo dpkg -i can-hub_*.deb.

Hub

sudo apt install can-hub          # services start immediately

The packaged hub does not use the bare-binary defaults: hub.conf ships --listen quic://0.0.0.0:7227 --listen unix:///run/can-hub/hub.sock — QUIC plus the local unix socket only. To also accept TLS-over-TCP or plaintext TCP, add listeners in /etc/can-hub/hub.conf and systemctl restart can-hub:

HUB_LISTEN_ARGS=--listen quic://0.0.0.0:7227 --listen tls://0.0.0.0:7227 --listen unix:///run/can-hub/hub.sock

Agent

sudo apt install can-hub-agent
sudo editor /etc/can-hub/agent.conf      # HUB_URL, INTERFACES; AGENT_NAME defaults to the hostname
sudo systemctl enable --now can-hub-agent

The unit runs as the can-hub user with CAP_NET_RAW only. Remote interface reconfiguration (can-hub-cli interface set ...) additionally needs CAP_NET_ADMIN — see agent.

socketcand bridge (optional)

The client package includes a service that exposes the hub's interfaces as a local socketcand server (for python-can, Kayak, SavvyCAN):

sudo editor /etc/can-hub/socketcand.conf   # defaults: local hub, 127.0.0.1:29536, beacon on
sudo systemctl enable --now can-hub-socketcand

HUB_URL points the bridge at a remote hub (quic:// or tls://); its TLS identity and known_hubs live in /var/lib/can-hub-client.

Every unit carries the same defaults as its /etc/can-hub/*.conf, so a service still starts with the file removed; the file only overrides.

Static binaries (from releases)

can-hub-<tag>-linux-<arch>-static.tar.gz contains all four binaries, fully static (musl) — drop them on any Linux, including distros the debs do not target:

tar xzf can-hub-v*-linux-x86_64-static.tar.gz
./can-hub-agent --connect quic://hub.example.com:7227 --name edge can0

Python

pip install python-can-hub

Manylinux wheels for x86_64, aarch64 and armv7l, plus a win_amd64 wheel; the wheel bundles libcanhub with the TLS/QUIC stack statically linked. See python/README.md.

From source

Requirements: cmake >= 3.16, ninja, gcc, git. The first configure needs network access — picotls and Monocypher are cloned and built once per build tree, and ngtcp2 plus the SQLite amalgamation are fetched and built statically. There is no OpenSSL: perl is no longer needed and nothing links libssl or libcrypto.

make release                  # build/x86_64/release
make install [PREFIX=/usr/local]
make test                     # unit tests (CEST)

make install installs the four binaries, libcanhub (static + shared) and include/canhub.h. It ships no systemd units: they run as the can-hub system user, which only the debs create, so use the debs for service deployment.

Other targets:

make release ARCH=arm64|armhf   # cross builds (toolchain files in cmake/)
make deb                        # glibc .debs into build/<arch>/package
make static ARCH=x86_64|arm64|armv7   # fully static binaries via docker, into dist/
make windows                    # libcanhub + canhub-dump for Windows (llvm-mingw / mingw-w64)

Shell completion

The Debian packages ship bash and zsh completions for every binary, so tab completion works out of the box after apt install (bash-completion loads them on demand; zsh reads /usr/share/zsh/vendor-completions). Beyond subcommands and flags they complete the painful dynamic values — namespaced interface names (agent/iface), agent names and peer ids — by querying the hub, and fall back to static completion when it is unreachable.

Building from source instead of installing a deb? Drop the scripts in by hand:

sudo cp packaging/completions/bash/* /usr/share/bash-completion/completions/
sudo cp packaging/completions/zsh/_*  /usr/share/zsh/vendor-completions/

State directories

ComponentDefaultContents
hub/var/lib/can-hub (fallback ~/.local/state/can-hub)TLS identity, hub.db (agent pins, client ACLs, bridge routes and groups)
agent/var/lib/can-hub-agent (deb) or the same defaultagent.crt/agent.key, known_hubs pins
client/var/lib/can-hub (fallback ~/.local/state/can-hub)TLS identity, pinned hub fingerprints
web/var/lib/can-hub/web.dbusers, groups, sessions, audit log

--state-dir overrides the location on hub, agent and client.