1、安装预备 yum 源
yum -y install make gettext-devel expat-devel curl-devel zlib-devel openssl-devel bzip2 readline-devel
yum install -y epel-release
yum install -y --skip-broken git gcc-c++ wget alsa-lib-devel autoconf automake bison broadvoice-devel bzip2 curl-devel db-devel e2fsprogs-devel flite-devel g722_1-devel gdbm-devel gnutls-devel ilbc2-devel ldns-devel libcodec2-devel libcurl-devel libedit-devel libidn-devel libjpeg-devel libmemcached-devel libogg-devel libsilk-devel libsndfile-devel libtiff-devel libtheora-devel libtool libvorbis-devel libxml2-devel lua-devel lzo-devel mongo-c-driver-devel ncurses-devel net-snmp-devel openssl-devel opus-devel pcre pcre-devel perl perl-ExtUtils-Embed pkgconfig portaudio-devel postgresql-devel python26-devel python-devel soundtouch-devel speex speex-devel sqlite-devel unbound-devel unixODBC-devel libuuid-devel which yasm zlib-devel libatomic hiredis-devel diffutils
yum install -y https://download1.rpmfusion.org/free/el/rpmfusion-free-release-8.noarch.rpm
yum install -y https://rpmfind.net/linux/epel/7/x86_64/Packages/s/SDL2-2.0.14-2.el7.x86_64.rpm
yum install -y ffmpeg ffmpeg-devel
2、安装成功后,安装opus
yum install -y opus-devel
安装完成之后要将 opus.pc复制到 pkgconfig 中,并且创建软连接
cp /usr/local/lib/pkgconfig/opus.pc /usr/lib64/pkgconfig/
ln -s /usr/lib64/pkgconfig/opus.pc /usr/lib64/pkgconfig/libopus.pc
3、安装编译需要的库
dnf install -y speex.x86_64 baresip-speex_pp.x86_64 speexdsp.x86_64
dnf install -y http://repo.okay.com.mx/centos/8/x86_64/release/speex-devel-1.2.0-1.el8.x86_64.rpm
dnf install -y http://mirror.centos.org/centos/8/PowerTools/x86_64/os/Packages/speexdsp-devel-1.2-0.13.rc3.el8.x86_64.rpm
dnf install -y http://mirror.centos.org/centos/8/PowerTools/x86_64/os/Packages/ldns-devel-1.7.0-21.el8.x86_64.rpm
dnf install -y http://mirror.centos.org/centos/8/PowerTools/x86_64/os/Packages/libedit-devel-3.1-23.20170329cvs.el8.x86_64.rpm
dnf install -y http://mirror.centos.org/centos/8/PowerTools/x86_64/os/Packages/yasm-1.3.0-7.el8.x86_64.rpm
dnf install http://mirror.centos.org/centos/8/BaseOS/x86_64/os/Packages/pcre-devel-8.42-4.el8.x86_64.rpm
dnf install -y http://mirror.centos.org/centos/8/PowerTools/x86_64/os/Packages/lua-devel-5.3.4-11.el8.x86_64.rpm
dnf install libpq-devel
dnf install -y http://mirror.centos.org/centos/8/PowerTools/x86_64/os/Packages/libsndfile-devel-1.0.28-10.el8.x86_64.rpm
4、加载环境变量
export PKG_CONFIG_PATH=$PKG_CONFIG_PATH:/usr/local/lib/pkgconfig/:/usr/local/lib64/pkgconfig/:/usr/lib64/pkgconfig/
5、安装spandsp3
yum install libtiff libtiff-devel libjpeg-devel
cd /usr/src/
git clone https://github.com/freeswitch/spandsp.git
cd spandsp
./bootstrap.sh -j
./configure
make
make install
ldconfig
6、安装sofia-sip
cd /usr/src/
git clone https://github.com/freeswitch/sofia-sip.git
cd sofia-sip
./bootstrap.sh -j
./configure
make
make install
ldconfig
7、安装signalwire
dnf install -y cmake
安装libks
yum install libatomic
cd /usr/local/src
git clone https://github.com/signalwire/libks.git
cd libks
cmake .
make
make install
8、安装signalwire-c
cd /usr/local/src
git clone https://github.com/signalwire/signalwire-c.git
cd signalwire-c/
cmake .
make
make install
9、安装freeswitch
cd /usr/local/src/
git clone https://github.com/signalwire/freeswitch.git
cd freeswitch
./bootstrap.sh
./configure --enable-core-pgsql-support
make -j
make install
安装过程中遇到的问题
1、speex and speexdsp 报错
checking for speex >= 1.2rc1 speexdsp >= 1.2rc1... Package speexdsp was not found in the pkg-config search path. Perhaps you should add the directory containing `speexdsp.pc' to the PKG_CONFIG_PATH environment variable Package 'speexdsp', required by 'virtual:world', not found
configure: error: Library requirements (speex >= 1.2rc1 speexdsp >= 1.2rc1) not met; consider adjusting the PKG_CONFIG_PATH environment variable if your libraries are in a nonstandard prefix so pkg-config can find them.
解决方案:
1、执行一下命令重新编译
yum install speex*
执行完上述命令依然报错,则需要手动安装speexdsp-1.2.1.tar.gz包
export PKG_CONFIG_PATH=`` # 清空环境变量
export PKG_CONFIG_PATH=/usr/lib64/pkgconfig:/usr/lib64/pkgconfig:/usr/local/lib/pkgconfig:/usr/local/lib64/pkgconfig:/usr/lib64/pkgconfig:$PKG_CONFIG_PATH # 重新设置环境变量,根据实际情况进行设置
yum reinstall speexdsp* # 安装 speexdsp 包
tar zxvf speexdsp-1.2.1.tar.gz
cd speexdsp-1.2.1
BUILD_LIBS=${HOME}/build_libs
./configure --prefix=${BUILD_LIBS} --disable-oggtest
make
make install
find / -name speexdsp.pc
cd usr/local/src/freeswitch/
./configure --enable-core-pgsql-support
2、libldns-fs没有找到报错
报错现象:
checking for libldns-fs >= 1.6.6... checking for libldns >= 1.6.6... checking for ldns_str2rdf_a in -lldns... no
configure: error: You need to either install libldns-dev or disable mod_enum in modules.conf
解决方法:
vim modules.conf # 打开 modules.conf 文件注释掉第十八行applications/mod_enum
重新编译
3、libedit-dev未安装或未添加忽略
解决方法:
./configure --enable-core-pgsql-support --disable-core-libedit-support # 按照报错信息在编译命令后添加--disable-core-libedit-support即可
4、yasm 或 nasm 未安装
报错现象:
Neither yasm nor nasm have been found. See the prerequisites section in the README for more info.
Configuration failed. This could reflect a misconfiguration of your
toolchains, improper options selected, or another problem. If you
don't see any useful error messages above, the next step is to look
at the configure error log file (config.log) to determine what
configure was trying to do when it died.
make: *** [Makefile:4473: libs/libvpx/Makefile] Error 1
解决方法:
下载yasm-1.3.0.tar.gz 上传到服务器上
tar zxvf yasm-1.3.0.tar.gz
cd yasm-1.3.0
./configure
make
make install
切换到 freeswitch 安装目录重新进行编译安装即可
5、没有找到lua.h头文件
错误现象
mod_lua.cpp:37:10: fatal error: lua.h: No such file or directory
#include "lua.h"
^~~~~~~
compilation terminated.
make[4]: *** [Makefile:1043: libluamod_la-mod_lua.lo] Error 1
make[4]: Leaving directory '/usr/local/src/freeswitch/src/mod/languages/mod_lua'
make[3]: *** [Makefile:723: mod_lua-install] Error 1
make[3]: Leaving directory '/usr/local/src/freeswitch/src/mod'
make[2]: *** [Makefile:625: install-recursive] Error 1
make[2]: Leaving directory '/usr/local/src/freeswitch/src'
make[1]: *** [Makefile:3708: install-recursive] Error 1
make[1]: Leaving directory '/usr/local/src/freeswitch'
make: *** [Makefile:4011: install] Error 2
解决方法
wget curl -R -O http://www.lua.org/ftp/lua-5.3.0.tar.gz
tar zxf lua-5.3.0.tar.gz
cd lua-5.3.0
make linux # 此处的 linux 需要根据实际情况进行选择
安装完成后
ln -sf /usr/local/bin/lua /usr/bin
ln -sf /usr/local/bin/luac /usr/bin
会到 freeswitch 安装目录重新进行编译 一定要重新编译!一定要重新编译!一定要重新编译!重要的事情说三遍
如果安装后依然报错
make[4]: *** [Makefile:945: mod_lua.la] Error 1
make[4]: Leaving directory '/usr/local/src/freeswitch/src/mod/languages/mod_lua'
make[3]: *** [Makefile:723: mod_lua-install] Error 1
make[3]: Leaving directory '/usr/local/src/freeswitch/src/mod'
make[2]: *** [Makefile:625: install-recursive] Error 1
make[2]: Leaving directory '/usr/local/src/freeswitch/src'
make[1]: *** [Makefile:3708: install-recursive] Error 1
make[1]: Leaving directory '/usr/local/src/freeswitch'
make: *** [Makefile:4011: install] Error 2
解决方法
vim modules.conf +129 # 将第 129 行进行注释,该文件中存储的是 freeswitch 的模块
6、没有找到sms_sndfile模块
错误现象
make[5]: Leaving directory '/usr/local/src/freeswitch/src/mod/applications/mod_sms'
make[4]: Leaving directory '/usr/local/src/freeswitch/src/mod/applications/mod_sms'
making install mod_sndfile
make[4]: Entering directory '/usr/local/src/freeswitch/src/mod/formats/mod_sndfile'
Makefile:1454: *** You must install libsndfile-dev to build mod_sndfile. Stop.
make[4]: Leaving directory '/usr/local/src/freeswitch/src/mod/formats/mod_sndfile'
make[3]: *** [Makefile:723: mod_sndfile-install] Error 1
make[3]: Leaving directory '/usr/local/src/freeswitch/src/mod'
make[2]: *** [Makefile:625: install-recursive] Error 1
make[2]: Leaving directory '/usr/local/src/freeswitch/src'
make[1]: *** [Makefile:3708: install-recursive] Error 1
make[1]: Leaving directory '/usr/local/src/freeswitch'
make: *** [Makefile:4011: install] Error 2
解决方法
vim modules.conf # 将 modules.conf 文件下的mod_sndfile进行注释
重新编译即可
出现以下画面则表示freeswitch 安装完成