目录
[RTPEngine 正常提供功能](#RTPEngine 正常提供功能)
[1. 启动RTPEngine服务](#1. 启动RTPEngine服务)
[2. 删除 RTPEngine服务](#2. 删除 RTPEngine服务)
[3. 加载内核模块](#3. 加载内核模块)
**博主wx:**yuanlai45_csdn **博主qq:**2777137742
后期会创建粉丝群,为同学们提供分享交流平台以及提供官方发送的福利奖品~
ubuntu:focal.tar 上传到了资源里面
Dockerfile
bash
FROM ubuntu:focal
ENV DEBIAN_FRONTEND=noninteractive
ENV DEB_BUILD_PROFILES="pkg.ngcp-rtpengine.nobcg729"
# Add backports repository and install updates and dependencies
RUN apt-get update && \
apt-get install -y software-properties-common && \
add-apt-repository -y ppa:ubuntu-toolchain-r/test && \
apt-get update && \
apt-get -y install git vim tmux dpkg-dev debhelper libxtables-dev default-libmysqlclient-dev gperf libavcodec-dev libavfilter-dev libavformat-dev \
libavutil-dev libbencode-perl libcrypt-openssl-rsa-perl libcrypt-rijndael-perl libdigest-crc-perl libdigest-hmac-perl \
libevent-dev libhiredis-dev libio-multiplex-perl libio-socket-inet6-perl libiptc-dev libjson-glib-dev libjson-perl libnet-interface-perl \
libpcap0.8-dev libpcre3-dev libsocket6-perl libspandsp-dev libssl-dev libswresample-dev libsystemd-dev libxmlrpc-core-c3-dev \
markdown dkms module-assistant keyutils libnfsidmap2 nfs-common rpcbind libglib2.0-dev zlib1g-dev libavcodec-extra \
libcurl4-openssl-dev netcat-openbsd netcat iptables iproute2 net-tools iputils-ping libconfig-tiny-perl libwebsockets-dev \
libmnl-dev libmosquitto-dev libncurses-dev libnftnl-dev libopus-dev libtest2-suite-perl pandoc python3-websockets
# Fetch RTPEngine code (tag mr12.0)
RUN git clone https://github.com/sipwise/rtpengine && \
cd rtpengine && git checkout mr12.0
# Copy configuration file
COPY rtpengine.conf /etc/rtpengine/rtpengine.conf
# Expose ports
EXPOSE 22222/udp 30000-40000/udp
# Set working directory
WORKDIR /rtpengine
# Start a shell by default
CMD ["/bin/bash"]
rtpengine.conf
bash
[rtpengine]
interface = eth0
listen-ng = 22222
port-min = 30000
port-max = 40000
log-level = 6
log-facility = daemon
log-facility-cdr = local0
log-facility-rtcp = local1
容器内编译安装
进入容器的 bash shell
bash
docker run --privileged -it rtpengine:mr12.0 /bin/bash
重新进入
bash
docker exec --privileged -it ebbac54ad7c7 /bin/bash
先直接make,可以发现 daemon 和 recording-daemon 和 perf-tester模块编译完成,也就是说四个主要模块,只差 kernel-module 没有编译完成
bash
cd /rtpengine/kernel-module
bash
root@ebbac54ad7c7:/rtpengine/kernel-module# make
make -C /lib/modules/5.15.0-113-generic/build M=/rtpengine/kernel-module O=/lib/modules/5.15.0-113-generic/build modules
make[1]: *** /lib/modules/5.15.0-113-generic/build: No such file or directory. Stop.
make: *** [Makefile:34: modules] Error 2
安装内核头文件:
bash
apt-get update
apt-get install -y linux-headers-$(uname -r)
然后make就可以了
到现在为止四个模块就已经全部编译完成
RTPEngine 正常提供功能
1. 启动RTPEngine服务
在容器内,您需要启动RTPEngine守护进程。通常,这可以通过以下命令完成:
bash
nohup /rtpengine/daemon/rtpengine --config-file=/etc/rtpengine/rtpengine.conf > /var/log/rtpengine.log 2>&1 &
2. 删除RTPEngine服务
bash
pkill -f rtpengine
3. 加载内核模块
bash
exit
docker run --privileged -it rtpengine:mr12.0 /bin/bash
尝试使用 insmod 命令直接加载编译好的模块:
bash
insmod /rtpengine/kernel-module/xt_RTPENGINE.ko
检查所有进程是否正在运行
bash
ps aux | grep rtpengine
上传到仓库
打镜像
bash
docker commit [OPTIONS] CONTAINER [REPOSITORY[:TAG]]
//如果您的容器 ID 是 abc123,想将新镜像命名为 rtpengine:new_version,可以运行:
docker commit abc123 rtpengine:new_version
docker images 命令验证新镜像是否已创建
bash
docker images | grep rtpengine
将这个镜像推送到私有仓库(ip:port),需要给镜像添加适当的标签
bash
docker tag rtpengine:new_version ip:port/rtpengine:new_version
然后推送到私有仓库
bash
docker push ip:port/rtpengine:new_version
注意配置
bash
cat /etc/docker/daemon.json
{
"insecure-registries": ["ip:port"]
}
创作不易,希望读者三连支持 💖
赠人玫瑰,手有余香 💖