Order the Rigi with Debian 13 preselected through this deploy link. Remember the KVM console before you write firewall rules; it is how you get back in after an nftables policy locks out your own SSH session. Put the firewall in place before Kamailio starts listening, then install from Debian:
Set DBENGINE=MYSQL in /etc/kamailio/kamctlrc and create the schema with kamdbctl create. The stock /etc/kamailio/kamailio.cfg is organised around #!define switches; for a registrar with media relay and flood protection, enable these at the top of the file:
On a 32 GB machine the 64 MB shared-memory default is a lab setting. Raise SHM_MEMORY in /etc/default/kamailio to 1024 or 2048 and PKG_MEMORY to 16, then watch kamcmd core.shmmem under real load before tuning further. In /etc/rtpengine/rtpengine.conf, set interface to the server's public IPv4, keep port-min = 30000 and port-max = 40000 in step with your firewall, and bind listen-ng to 127.0.0.1 so the control socket never faces the internet. Kernel forwarding depends on a packet-filter rule that points at rtpengine's kernel table, and whether rtpengine installs it or you do depends on the version, so read the README of the release Debian ships before writing a drop-everything policy.
For TLS, take a certificate for your SIP hostname from Let's Encrypt (the DNS-01 challenge avoids opening port 80), point /etc/kamailio/tls.cfg at it and run kamcmd tls.reload after each renewal. Publish NAPTR and SRV records for _sip._udp, _sip._tcp and _sips._tcp. Then register a test account from a softphone or a SIP test client such as SIPp or sipexer, check that it appears in kamctl ul show, place a call and confirm in rtpengine's log that its media is being relayed.
Docker works if you prefer it. The project publishes kamailio-ci images on Docker Hub and GHCR, built to run with host, bridge or swarm networking; use --net=host, because pushing ten thousand RTP ports through Docker's bridge NAT gains nothing, and rtpengine's kernel module has to live in the host kernel anyway. On a server with one job, native packages under systemd are simpler to patch, and patching matters here: CVE-2026-39863, published in April 2026, let a crafted TCP packet crash Kamailio processes on any instance with TCP or TLS listeners. Debian fixed it in Debian 13 with DSA-6494-1. If you need features from 6.1, the project publishes its own Debian and Ubuntu packages; you then follow upstream's release cadence rather than Debian's.