CentOS8.5 下编译 kamailio5.7.6 和 rtpengine9.5.8

CentOS8 已经停更了,但还是有人用

尝试了下,特记录如下

CentOS8 最小安装,之后,是这样的:

  • 下载国内 yum 源文件

curl -o /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-8.repo

yum clean all && yum makecache

  • kamailio 编译

dnf group install -y "Development Tools"
yum install -y mysql-devel curl-devel
yum install -y wget curl autoconf openssl-libs openssl-devel libcurl-devel libxml2-devel pcre-devel uuid libuuid-devel libwebsockets-devel libunistring-devel
yum install -y jansson jansson-devel libev libevent-devel lua-devel libmaxminddb-devel
cd /usr/local/src
curl https://www.kamailio.org/pub/kamailio/5.7.6/src/kamailio-5.7.6_src.tar.gz -o kamailio-5.7.6_src.tar.gz
tar zxvf kamailio-5.7.6_src.tar.gz
cd kamailio-5.7.6
make include_modules="db_mysql http_client http_async_client jansson tls uuid utils app_lua geoip2 websocket" cfg
make all
make install

ln -sf /usr/local/etc/kamailio /etc/kamailio

  • rtpengine 编译 

yum install -y git
yum -y install dnf-plugins-core
yum config-manager --set-enabled PowerTools
dnf -y install https://download.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rpm
dnf -y localinstall --nogpgcheck https://download1.rpmfusion.org/free/el/rpmfusion-free-release-8.noarch.rpm
dnf -y install --nogpgcheck https://download1.rpmfusion.org/nonfree/el/rpmfusion-nonfree-release-8.noarch.rpm
dnf -y install http://rpmfind.net/linux/epel/7/x86_64/Packages/s/SDL2-2.0.10-1.el7.x86_64.rpm
dnf -y install ffmpeg
dnf -y install ffmpeg-devel
yum -y install iptables-devel kernel-devel kernel-headers xmlrpc-c xmlrpc-c-client
yum -y install kernel-devel
yum -y install glib2 glib2-devel gcc zlib zlib-devel openssl openssl-devel pcre pcre-devel libcurl libcurl-devel xmlrpc-c-devel libwebsockets-devel
yum -y install libevent-devel glib2-devel json-glib-devel gperf gperftools-libs gperftools gperftools-devel libpcap libpcap-devel git hiredis hiredis-devel redis perl-IPC-Cmd
yum -y install spandsp-devel spandsp
yum -y install epel-release
yum -y install elfutils-libelf-devel gcc-toolset-9-elfutils-libelf-devel
rpm --import http://li.nux.ro/download/nux/RPM-GPG-KEY-nux.ro
rpm -Uvh http://li.nux.ro/download/nux/dextop/el7/x86_64/nux-dextop-release-0-1.el7.nux.noarch.rpm
cd /usr/local/src
git clone https://github.com/sipwise/rtpengine.git -b mr9.5.8
cd /usr/local/src/rtpengine/daemon/
make

cp rtpengine /usr/bin

把 rtpengine 配置成服务,这个后面讲


  • rtpengine 配置成服务

mkdir -p /etc/rtpengine

先编辑 /etc/rtpengine/rtpengine.conf, 内容为:

[rtpengine]
# 需要根据实际情况进行修改
interface=127.0.0.1
#interface=priv/127.0.0.1;pub/127.0.0.1!154.92.108.215
#interface=priv/ens3;pub/ens3!154.92.108.215
#foreground=true
log-stderr=true
listen-ng=127.0.0.1:2223
port-min=10000
port-max=20000
recording-dir=/tmp
#recording-method=pcap
#recording-format=eth
log-level=6
delete-delay=30
log-facility=local1
#listen-http=LOCAL_IP:8222

编辑 /lib/systemd/system/rtpengine.service, 内容为:

[Unit]
Description=Kernel based rtp proxy
#After=syslog.target
After=network-online.target
#After=iptables.service
Requires=network-online.target

[Service]
Type=forking
PIDFile=/var/run/rtpengine.pid
#EnvironmentFile=-/etc/sysconfig/rtpengine
ExecStart=/usr/bin/rtpengine --no-log-timestamps --pidfile /var/run/rtpengine.pid --config-file /etc/rtpengine/rtpengine.conf
User=root
Group=root
SyslogFacility=local1
LimitNOFILE=150000
#TimeoutSec=45s
#Restart=always
RestartSec=3s
TimeoutSec=15s
Restart=on-failure

[Install]
WantedBy=multi-user.target

 接下来运行下面的命令:

systemctl daemon-reload

systemctl enable rtpengine

systemctl start rtpengine


  •  kamailio 配置成服务

编辑 /lib/systemd/system/kamailio.service,内容为:

[Unit]
Description=Kamailio - the Open Source SIP Server
Wants=network-online.target
After=network-online.target

[Service]
Type=forking
User=root
Group=root
#Environment='CFGFILE=/etc/kamailio/kamailio.cfg'
#Environment='SHM_MEMORY=64'
#Environment='PKG_MEMORY=8'
#EnvironmentFile=-/etc/default/kamailio
#EnvironmentFile=-/etc/default/kamailio.d/*
# PIDFile requires a full absolute path
PIDFile=/run/kamailio/kamailio.pid
# ExecStart requires a full absolute path
ExecStart=/usr/local/sbin/kamailio -P /run/kamailio/kamailio.pid -m 2048 -M 64 --atexit=no
Restart=on-failure
# /run/kamailio in tmpfs
RuntimeDirectory=kamailio
RuntimeDirectoryMode=0770
# necessary for chown of control files e.g. for jsonrpcs and ctl modules
AmbientCapabilities=CAP_CHOWN

[Install]
WantedBy=multi-user.target

systemctl daemon-reload

systemctl enable kamailio

systemctl start kamailio


  •  syslog 配置

local0.* /var/log/kamailio.log
local1.* /var/log/rtpengine.log
还要配置 syslog 轮转

请参考相关资料,不难

附我的 /etc/rsyslog.conf

# /etc/rsyslog.conf configuration file for rsyslog
#
# For more information install rsyslog-doc and see
# /usr/share/doc/rsyslog-doc/html/configuration/index.html


#################
#### MODULES ####
#################

module(load="imuxsock") # provides support for local system logging
module(load="imklog")   # provides kernel logging support
#module(load="immark")  # provides --MARK-- message capability

# provides UDP syslog reception
#module(load="imudp")
#input(type="imudp" port="514")

# provides TCP syslog reception
#module(load="imtcp")
#input(type="imtcp" port="514")


###########################
#### GLOBAL DIRECTIVES ####
###########################

#
# Set the default permissions for all log files.
#
$FileOwner root
$FileGroup adm
$FileCreateMode 0640
$DirCreateMode 0755
$Umask 0022

#
# Where to place spool and state files
#
$WorkDirectory /var/spool/rsyslog

#
# Include all config files in /etc/rsyslog.d/
#
$IncludeConfig /etc/rsyslog.d/*.conf


###############
#### RULES ####
###############

#
# Log anything besides private authentication messages to a single log file
#
*.*;auth,authpriv.none;local0.none;local1.none		-/var/log/syslog

#
# Log commonly used facilities to their own log file
#
auth,authpriv.*			/var/log/auth.log
cron.*				-/var/log/cron.log
kern.*				-/var/log/kern.log
mail.*				-/var/log/mail.log
user.*				-/var/log/user.log

#
# Emergencies are sent to everybody logged in.
#
*.emerg				:omusrmsg:*

local0.* /var/log/kamailio.log
local1.* /var/log/rtpengine.log

附 /etc/logrotate.d/kam_rtpe

{
    missingok
    daily
    copytruncate
    rotate 7
    notifempty
}

  • sngrep 安装
yum install -y https://packages.irontec.com/centos/8/x86_64/sngrep-1.4.7+20200521.20+b132ce9-0.el8.x86_64.rpm

  • 参考链接:

https://github.com/fredposner/scripts/blob/master/kamailio/centos8_install.md

  • 8
    点赞
  • 20
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
编译 CentOS 8.5 的 Linux 内核源码需要以下步骤: 1. 下载内核源码: 在 CentOS 官方网站或者 Linux 内核官方网站上下载 CentOS 8.5 对应的内核源码包。你可以使用 `wget` 命令来下载,例如: ``` wget https://www.kernel.org/pub/linux/kernel/v5.x/linux-5.15.tar.gz ``` 2. 解压源码包: 使用 `tar` 命令将下载的源码包解压,例如: ``` tar -xzvf linux-5.15.tar.gz ``` 3. 安装编译依赖: 安装编译内核所需的依赖包,例如: ``` sudo yum install gcc make ncurses-devel openssl-devel elfutils-libelf-devel ``` 4. 配置内核选项: 进入解压后的源码目录,并执行以下命令以配置内核选项: ``` cd linux-5.15 make menuconfig ``` 在文本界面的配置界面中,可以修改内核选项,例如启用或禁用某些功能、添加或删除驱动程序等。完成后保存并退出。 5. 编译内核: 执行以下命令开始编译内核: ``` make ``` 这将花费一些时间进行编译,可以使用 `-j` 参数指定并发任务数量,例如 `make -j4`。 6. 安装内核: 编译完成后,执行以下命令安装内核: ``` sudo make install ``` 7. 配置引导管理器: 根据你使用的引导管理器(如 GRUB 或 LILO),更新引导配置文件以引导新内核。 8. 重新启动: 完成上述步骤后,重新启动计算机,选择新编译的内核进行启动。 请注意,编译内核需要一定的编译知识和经验,如果你对此不太熟悉,建议在测试环境中进行操作,并备份重要数据。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值