fs.1.10 ON rockylinux8 docker镜像制作

概述

freeswitch是一款简单好用的VOIP开源软交换平台。

rockylinux docker上编译安装fs1.10版本的流程记录。

环境

docker engine:Version 24.0.6

rockylinux docker:8

freeswitch:v1.10.7

手动模式

rockylinux准备

docker hub拉取rockylinux镜像。

sudo docker pull rockylinux:8

启动docker容器,版本使用rockylinux8。

sudo docker run -itd --name rockylinux.8-fs.1.10-compile rockylinux:8

sudo docker exec -it rockylinux.8-fs.1.10-compile bash

以下步骤均为docker容器“rockylinux.8-fs.1.10-compile”内部操作。

依赖库

FreeSWITCH 的安装将从源代码完成,以便您可以看到依赖项和库的安装过程,在某些情况下,这些依赖项和库也将从源代码安装。显然,可以从可用的存储库安装 FreeSWITCH,但最好学会直接管理源。在编译 FreeSWITCH 之前,将安装一系列库和依赖项,这些库和依赖项将允许您安装几乎所有最重要的 FS 模块。首先,激活 Power-Tools 存储库,这允许安装标准 Rocky Linux 存储库中不存在的一些软件包:

dnf install 'dnf-command(config-manager)' nano

dnf config-manager --set-enabled powertools

您从Vorbis开始,它是一个音频压缩/解压缩库,对于正确编译mod_shout模块至关重要:

dnf install libvorbis libvorbis-devel vorbis-tools libogg libogg-devel -y

mpg123和libshout旁边:

dnf install mpg123-devel mpg123-libs libshout-devel -y

对于 GSM 音频格式,安装相关包:

dnf install gsm gsm-devel -y

FFMPEG 是mod_av模块的依赖项,允许您在 Verto 中使用视频 H264 编解码器、FreeSWITCH 中用于 WebRTC 的信令、SIP 信令之外的另一个选项:

dnf install --nogpgcheck https://mirrors.rpmfusion.org/free/el/rpmfusion-free-release-8.noarch.rpm -y

dnf install ffmpeg ffmpeg-devel -y

接下来是 CURL,它是一个客户端,允许您使用 HTTP、HTTPS、FTP、GOPHER、DICT、TELNET 协议接收和/或发送文件;由mod_xml_curl模块使用:

dnf install curl curl-devel libidn-devel -y

编译源所需的所有库和依赖项均已安装:

dnf install gcc ncurses-devel make gcc-c++ zlib-devel libtool bison-devel bison openssl-devel bzip2-devel wget newt-devel subversion flex gtk2-devel bzip2 patch libjpeg-devel yasm libsndfile-devel net-tools git perl-ExtUtils-Embed -y

(可选)在 Rocky Linux 8 中,对于数据库管理,默认情况下不再存在 MySQL,而是安装了 MariaDB:

dnf install mariadb mariadb-server mariadb-devel -y

UNIXODBC 是 ODBC API 的 Linux 实现,允许连接到许多数据库管理系统(例如 MySQL/MariaDB):

dnf install unixODBC unixODBC-devel mariadb-connector-odbc libtool-ltdl-devel -y

由于FreeSWITCH的内部数据库默认是基于SQLite的,因此安装了程序包和开发包:

dnf install sqlite sqlite-devel libpq-devel -y

(可选)PostgreSQL:

dnf install postgresql-devel postgresql-server -y

(可选)从来源安装FLITE 、Festival Lite,这是 FS 的mod_flite模块使用的文本到语音系统:

cd /usr/src

git clone GitHub - festvox/flite: A small fast portable speech synthesis system

cd flite/

./configure --enable-shared --with-audio=none --prefix=/usr

make

make get_voices

make install

Libuuid和uiid用于SoftSWITCH通道和进程线程的唯一标识:

dnf install libuuid libuuid-devel uuid uuid-devel -y

继续安装其他音频格式:SPEEX WAW 和 LAME;后者也是mod_shout模块的依赖项:

dnf install speex speex-devel speexdsp-devel wavpack wavpack-devel lame-devel -y

(可选)继续使用LIBMAD,它是一个高质量的 MPEG 音频解码器:

cd /usr/src

wget https://campus.voztovoice.org/FreeSWITCH/libmad-0.15.1b.tar.gz

tar -xf libmad-0.15.1b.tar.gz

cd libmad-0.15.1b

./configure --prefix=/usr --libdir=/usr/lib64

为了编译成功,必须修改Makefile中的一行:

nano +129 Makefile

CFLAGS = -Wall -g -O -fforce-mem -fforce-addr -fthread-jumps -fcse-follow-jumps -fcse-skip-blocks -fexpensive-optimizations -fregmove -fschedule-insns2

使其保持:

CFLAGS = -Wall -g -O -fforce-addr -fthread-jumps -fcse-follow-jumps -fcse-skip-blocks -fexpensive-optimizations -fregmove -fschedule-insns2

我们继续编译和安装:

make

make install

要安装与 Opus 音频编解码器相关的mod_opus模块,您必须按照以下步骤从源安装编解码器:

wget https://archive.mozilla.org/pub/opus/opus-1.3.1.tar.gz

tar -xf opus-1.3.1.tar.gz

cd opus-1.3.1

./configure --prefix=/usr --libdir=/usr/lib64

make

make install

第一部分以S或X结尾,这是一个允许操作音频文件并可以将它们从一种格式传输到另一种格式的程序:

cd /usr/src

wget https://campus.voztovoice.org/FreeSWITCH/sox-14.4.2.tar.gz

tar -xf sox-14.4.2.tar.gz

cd sox-14.4.2

./configure --prefix=/usr --libdir=/usr/lib64

make && make install

继续使用libtiff。

dnf install libtiff libtiff-devel libxml2 libxml2-devel -y

安装spandsp3的依赖库,需要先安装fs官方仓库,访问官方仓库需要鉴权。

echo "signalwire" > /etc/yum/vars/signalwireusername

echo "TOKEN" > /etc/yum/vars/signalwiretoken

dnf install -y https://$(< /etc/yum/vars/signalwireusername):$(< /etc/yum/vars/signalwiretoken)@freeswitch.signalwire.com/repo/yum/centos-release/freeswitch-release-repo-0-1.noarch.rpm

dnf install spandsp3 spandsp3-devel libks -y

(可选)OpenLDAP是轻量级目录访问协议的开源版本。通常它用于创建可以远程查阅和/或修改的用户目录。许多程序实现了连接到 OpenLDAP 服务器的可能性,FreeSWITCH 通过mod_ldap模块提供了这种可能性,尽管它被认为是过时的模块:

dnf install openldap openldap-clients openldap-devel openldap-servers -y

(可选)SNMP是简单网络管理协议,用于控制和监视 Linux 服务器和某些应用程序的性能:

dnf install net-snmp net-snmp-devel net-snmp-libs net-snmp-utils -y

服务器的准备工作继续进行LUA编程语言的安装,该语言最常用于编写与FS交互的脚本和代码:

dnf install lua lua-devel -y

安装这些软件包是为了编译mod_memcache模块,该模块在某些类型的数据库查询中用作缓存:

dnf install memcached memcached-devel libmemcached libmemcached-devel -y --skip-broken

最后,LIBSRTP 库允许通过 SRTP 协议(RFC3711)和 FS 使用的 SIP 堆栈(SIP SOFIA)在 FreeSWITCH 中实现媒体流加密:

dnf install libsrtp libsrtp-devel sofia-sip* -y

以及 Jansson 库来支持mod_verto模块用作 WebRTC 的信号系统:

dnf install jansson jansson-devel -y

最后,您必须安装一些库,这些库将允许您安装更多模块,并以这种方式获得 FreeSWITCH 及其模块的几乎完整安装:

dnf install portaudio portaudio-devel python2-devel perl-devel erlang ldns-devel libedit-devel diffutils signalwire-client-c -y

fs编译安装

服务器准备好后,就开始安装FreeSWITCH;下载 1.10 分支的最新可用版本:

cd /usr/src

git clone -b v1.10.7 GitHub - signalwire/freeswitch: FreeSWITCH is a Software Defined Telecom Stack enabling the digital transformation from proprietary telecom switches to a versatile software implementation that runs on any commodity hardware. From a Raspberry PI to a multi-core server, FreeSWITCH can unlock the telecommunications potential of any device.

进入创建的文件夹:

cd freeswitch

chmod 775 -R ./*

并准备好源代码进行编译:

./bootstrap.sh -j

./configure -C --enable-portable-binary \

--with-gnu-ld --with-python=/usr/bin/python2 --with-erlang --with-openssl \

--enable-core-odbc-support --enable-zrtp \

--enable-core-pgsql-support \

--enable-static-v8 --disable-parallel-build-v8

make

make install

空间优化

dnf autoremove

dnf clean all

package-cleanup --quiet --leaves | xargs dnf remove -y

package-cleanup --quiet --dupes | xargs dnf remove -y

dnf remove -y devtoolset-9-gcc scl-utils scl-utils-build yum-utils centos-release-scl centos-release-scl-rh rpmdevtools yum-plugin-ovl

rm -rf /var/cache/dnf/*

rm -rf /root/*

rm -rf /usr/local/share/*
 

手动模式简版

rockylinux准备

docker hub拉取rockylinux镜像。

sudo docker pull rockylinux:8

启动docker容器,版本使用rockylinux8。

sudo docker run -itd --name rockylinux.8-fs.1.10-compile rockylinux:8

sudo docker exec -it rockylinux.8-fs.1.10-compile bash

以下步骤均为docker容器“rockylinux.8-fs.1.10-compile”内部操作。

alias

cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime -f

cd

vi .bashrc

alias ll='ls -l'

依赖库

需要先安装fs官方仓库,访问官方仓库需要鉴权。

dnf install 'dnf-command(config-manager)' -y

dnf config-manager --set-enabled powertools

echo "signalwire" > /etc/yum/vars/signalwireusername

echo "TOKEN" > /etc/yum/vars/signalwiretoken

dnf install -y https://$(< /etc/yum/vars/signalwireusername):$(< /etc/yum/vars/signalwiretoken)@freeswitch.signalwire.com/repo/yum/centos-release/freeswitch-release-repo-0-1.noarch.rpm

dnf install -y epel-release -y

dnf makecache

dnf update

dnf remove -y spandsp-devel spandsp

dnf install -y sofia-sip-devel spandsp3-devel libks signalwire-client-c erlang postgresql-devel libtool python2-devel gcc-c++ zlib-devel libpng-devel sqlite-devel libcurl-devel pcre-devel speex-devel speexdsp-devel ldns-devel libedit-devel ilbc2-devel opus-devel lua-devel libsndfile-devel

dnf install -y which tzdata yasm git

fs编译安装

服务器准备好后,就开始安装FreeSWITCH;下载 1.10 分支的最新可用版本:

cd

git clone -b v1.10.7 https://github.com/signalwire/freeswitch.git

进入创建的文件夹:

cd freeswitch

chmod 775 -R ./*

并准备好源代码进行编译:

./bootstrap.sh -j

./configure

cd /root/freeswitch/src/mod/codecs/mod_g729/

make

cd -

make

make install

空间优化

dnf autoremove

dnf clean all

package-cleanup --quiet --leaves | xargs dnf remove -y

package-cleanup --quiet --dupes | xargs dnf remove -y

dnf remove -y devtoolset-9-gcc scl-utils scl-utils-build yum-utils centos-release-scl centos-release-scl-rh rpmdevtools yum-plugin-ovl

rm -rf /var/cache/dnf/*

rm -rf /root/freeswitch

rm -rf /usr/share/icons /usr/share/themes/ /usr/share/doc /usr/share/man

镜像操作

制作镜像。

sudo docker commit -m="rockylinux.8-fs.1.10-release" -a="zr" rockylinux.8-fs.1.10-compile 10.55.55.136:5000/zr/rockylinux.8-fs.1.10-release:v1.2

上传镜像到registry。

sudo docker images

sudo docker push 10.55.55.136:5000/zr/rockylinux.8-fs.1.10-release:v1.2

下载镜像。

sudo docker pull 10.55.55.136:5000/zr/rockylinux.8-fs.1.10-release:v1.2

启动容器release。

sudo docker run -itd --net=host -v /usr/local/freeswitch/conf:/usr/local/freeswitch/conf -v /usr/local/freeswitch/log:/usr/local/freeswitch/log -v /usr/local/freeswitch/recordings:/usr/local/freeswitch/recordings --name rockylinux.8-fs.1.10-sbc 10.55.55.136:5000/zr/rockylinux.8-fs.1.10-release:v1.2 /usr/local/freeswitch/bin/freeswitch -nonat -nosql -nonatmap -nocal -nort

sudo docker logs rockylinux.8-fs.1.10-sbc

sudo docker exec -it rockylinux.8-fs.1.10-sbc /usr/local/freeswitch/bin/fs_cli -x status

sudo docker rm -f rockylinux.8-fs.1.10-sbc

总结

fs.1.10版本比1.6版本的安装依赖要更多,最终产生的镜像大小也更大。

后续继续整理fs.1.10镜像的dockerfile模式。

空空如常

求真得真

  • 9
    点赞
  • 14
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值